【英文】反编译 exe 文件

Preface

Decompiling .exe files into .py files.

Clone pyinstxtractor

1
git clone https://github.com/countercept/python-exe-unpacker.git 

Convert exe file to pyc file

<file_name>: file name

1
2
cd python-exe-unpacker
python pyinstxtractor.py <file>.exe

Add magic and timestamp

  • Add a 4-byte magic and a 4-byte timestamp to the header of the lockyfud.pyc file.

  • Copy 4 bytes from the header of the struct file as the magic of the lockyfud.pyc file.

  • Set the 4-byte timestamp as 00 00 00 00.

Convert pyc file to py file

Install uncompyle6

1
pip install uncompyle6

Convert pyc file to py file

1
uncompyle6 <file_name>.pyc > lock.py

Done

References

CSDN - G4rb3n