AS1/2 better deobfuscation

code formatting
This commit is contained in:
Jindra Pet��k
2013-03-10 06:03:15 +01:00
parent 959a413a72
commit 4c1485808f
164 changed files with 1083 additions and 666 deletions
@@ -106,7 +106,7 @@ public class SWFOutputStream extends OutputStream {
write(value.getBytes("utf8"));
write(0);
}
/**
* Writes UI32 (Unsigned 32bit integer) value to the stream
*
@@ -258,7 +258,6 @@ public class SWFOutputStream extends OutputStream {
value = value >> 7;
} while (loop);
}
/**
* Flushes data to underlying stream
@@ -374,6 +373,27 @@ public class SWFOutputStream extends OutputStream {
}
}
public static byte[] getTagHeader(Tag tag, byte data[], int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
SWFOutputStream sos = new SWFOutputStream(baos, version);
int tagLength = data.length;
int tagID = tag.getId();
int tagIDLength = (tagID << 6);
if ((tagLength < 0x3f) && (!tag.forceWriteAsLong)) {
tagIDLength += tagLength;
sos.writeUI16(tagIDLength);
} else {
tagIDLength += 0x3f;
sos.writeUI16(tagIDLength);
sos.writeSI32(tagLength);
}
} catch (IOException iex) {
}
return baos.toByteArray();
}
/**
* Writes Tag value to the stream
*
@@ -382,17 +402,7 @@ public class SWFOutputStream extends OutputStream {
*/
public void writeTag(Tag tag) throws IOException {
byte data[] = tag.getData(version);
int tagLength = data.length;
int tagID = tag.getId();
int tagIDLength = (tagID << 6);
if ((tagLength < 0x3f) && (!tag.forceWriteAsLong)) {
tagIDLength += tagLength;
writeUI16(tagIDLength);
} else {
tagIDLength += 0x3f;
writeUI16(tagIDLength);
writeSI32(tagLength);
}
write(getTagHeader(tag, data, version));
write(data);
}