Beginning of an AFP ByteCode decompiler, starting with a massive code reorg and a control flow graph analyzer.

This commit is contained in:
Jennifer Taylor
2021-04-24 17:59:36 +00:00
parent 011b84aceb
commit b77ccdd5b9
8 changed files with 761 additions and 236 deletions
+14 -2
View File
@@ -101,6 +101,12 @@ def main() -> int:
metavar="FILE",
help="The file to print",
)
print_parser.add_argument(
"-d",
"--decompile-bytecode",
action="store_true",
help="Attempt to decompile and print bytecode instead of printing the raw representation.",
)
print_parser.add_argument(
"-v",
"--verbose",
@@ -119,6 +125,12 @@ def main() -> int:
metavar="BSIFILE",
help="The BSI file to parse",
)
parseafp_parser.add_argument(
"-d",
"--decompile-bytecode",
action="store_true",
help="Attempt to decompile and print bytecode instead of printing the raw representation.",
)
parseafp_parser.add_argument(
"-v",
"--verbose",
@@ -427,7 +439,7 @@ def main() -> int:
afpfile = TXP2File(bfp.read(), verbose=args.verbose)
# Now, print it
print(json.dumps(afpfile.as_dict(), sort_keys=True, indent=4))
print(json.dumps(afpfile.as_dict(decompile_bytecode=args.decompile_bytecode), sort_keys=True, indent=4))
if args.action == "parseafp":
# First, load the AFP and BSI files
@@ -437,7 +449,7 @@ def main() -> int:
# Now, print it
swf.parse(verbose=args.verbose)
print(json.dumps(swf.as_dict(), sort_keys=True, indent=4))
print(json.dumps(swf.as_dict(decompile_bytecode=args.decompile_bytecode), sort_keys=True, indent=4))
if args.action == "parsegeo":
# First, load the AFP and BSI files