Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion assembler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import logging

import cStringIO
try:
import cStringIO
except:
from io import StringIO as cStringIO
import networkx as nx
import dis

Expand Down
5 changes: 4 additions & 1 deletion disassembler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Queue
try:
import Queue
except:
import queue as Queue
import logging
import collections
import dis
Expand Down
17 changes: 14 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ def process(ifile, ofile):
logger.info('Opening file ' + ifile)
ifPtr = open(ifile, 'rb')
header = ifPtr.read(8)
if not header.startswith('\x03\xF3\x0D\x0A'):
raise SystemExit('[!] Header mismatch. The input file is not a valid pyc file.')
if not header.startswith(b'\x03\xF3\x0D\x0A'):
print("Header mismatch. The input file is not a valid pyc file.")
while True:
user_input = input("Do you want to continue? (y/n): ")
if user_input.lower() == 'n':
raise SystemExit('[!] Header mismatch. The input file is not a valid pyc file.')
elif user_input.lower() == 'y':
break
else:
print("Invalid input. Please enter 'y' or 'n'.")
logger.info('Input pyc file header matched')
logger.debug('Unmarshalling file')
rootCodeObject = marshal.load(ifPtr)
try:
rootCodeObject = marshal.load(ifPtr)
except ValueError:
raise SystemExit('[!] Failed to unmarshal file. The input file is not a valid pyc file.')
ifPtr.close()
deob = parse_code_object(rootCodeObject)
logger.info('Writing deobfuscated code object to disk')
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pefile
uncompyle6
networkx
pydotplus
2 changes: 1 addition & 1 deletion verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ def verify_graph(bb_graph):
logger.error('Orphaned block {} has no edges'.format(hex(id(bb))))

except Exception as ex:
print ex
print(ex)
return False
return True