- Put
pyinstxtractor.py
to somewhere included inPATH
by cloningpython-exe-unpacker
or just downloading - Clone
python-uncompyle6
, patch it if on Windows, install - Also put
pycize.py
anddepyinstaller.cmd
along withpyinstxtractor.py
depyinstaller foo.exe
and get source- If
foo
is not the real entry name, try to find the real name among the extracted folder, then do the rest
Last active
May 26, 2018 09:07
-
-
Save acgrid/4f2287df0f953456e3570557a4766089 to your computer and use it in GitHub Desktop.
Everything about extract pyinstaller-ed exe files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
python %~dp0\pyinstxtractor.py %1 | |
cd %1_extracted | |
for /F %%i in ("%1") do ( | |
if not exist %%~ni goto :eof | |
echo %%~ni | |
python %~dp0\pycize.py %%~ni | |
uncompyle6 -o %%~ni.py %%~ni.pyc | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import binascii | |
def main(): | |
if len(sys.argv) < 2: | |
print('[*] Usage: {0} <filename>'.format(sys.argv[0])) | |
else: | |
with open(sys.argv[1], "rb") as src, open('{0}.pyc'.format(sys.argv[1]), "wb") as dst: | |
dst.write(binascii.unhexlify("330D0D0A206A025B0C000000")) | |
dst.write(src.read()) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/uncompyle6/main.py | |
+++ b/uncompyle6/main.py | |
@@ -42,7 +42,7 @@ def _get_outstream(outfile): | |
mode = 'wb' | |
else: | |
mode = 'w' | |
- return open(outfile, mode) | |
+ return open(outfile, mode, encoding='utf-8') | |
def decompile( | |
bytecode_version, co, out=None, showasm=None, showast=False, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment