风吹屁屁凉 发表于 2024-5-9 11:29

pyinstxtractor -- PyInstaller Extractor

# PyInstaller Extractor

PyInstaller Extractor is a Python script to extract the contents of a PyInstaller generated executable file.

The header of the pyc files are automatically fixed so that a Python bytecode decompiler will recognize it. The script can run on both Python 2.x and 3.x. PyInstaller versions 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.5.1, 4.6, 4.7, 4.8, 4.9, 4.10, 5.0, 5.0.1, 5.1, 5.2, 5.3, 5.4, 5.4.1, 5.5, 5.6, 5.6.1, 5.6.2, 5.7.0, 5.8.0, 5.9.0, 5.10.0, 5.10.1, 5.11.0, 5.12.0, 5.13.0, 5.13.1, 5.13.2, 6.0.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0, 6.5.0, 6.6.0 are (https://github.com/pyinstxtractor/pyinstxtractor-test-binaries) & supported. Probably will work with other versions too.

This project was originally hosted on (https://sourceforge.net/projects/pyinstallerextractor/).

## Usage

The script can be run by passing the name of the exe as an argument.

```
$ python pyinstxtractor.py <filename>
X:\>python pyinstxtractor.py <filename>
```

It is recommended to run the script in the same version of Python which was used to generate the executable. This is to prevent unmarshalling errors(if any) while extracting the PYZ archive.

## Example

```
X:\> python pyinstxtractor.py test.exe
[+] Processing dist\test.exe
[+] Pyinstaller version: 2.1+
[+] Python version: 36
[+] Length of package: 5612452 bytes
[+] Found 59 files in CArchive
[+] Beginning extraction...please standby
[+] Possible entry point: pyiboot01_bootstrap.pyc
[+] Possible entry point: test.pyc
[+] Found 133 files in PYZ archive
[+] Successfully extracted pyinstaller archive: dist\test.exe

You can now use a python decompiler on the pyc files within the extracted directory
```

After extracting the pyc's you can use a Python decompiler like (https://github.com/rocky/python-uncompyle6/) and (https://github.com/zrax/pycdc).

```
X:\> uncompyle6.exe test.exe_extracted\test.pyc
X:\> uncompyle6.exe test.exe_extracted\PYZ-00.pyz_extracted\__future__.pyc
```
## Extracting Linux ELF binaries

Pyinstxtractor can natively extract Linux ELF binaries without requiring other tools.

For other questions and information, please see the (https://github.com/extremecoders-re/pyinstxtractor/wiki/Extracting-Linux-ELF-binaries) and the (https://github.com/extremecoders-re/pyinstxtractor/wiki/Frequently-Asked-Questions)

## See also

- (https://github.com/pyinstxtractor/pyinstxtractor-ng):
A standalone binary version of pyinstxtractor. This tool doesn't require Python to run and can extract all supported versions of PyInstaller. It also supports encrypted pyinstaller executables.
- (https://github.com/pyinstxtractor/pyinstxtractor-go): pyinstxtractor running in the web browser, powered by Go & GopherJS.

## License

GNU General Public License v3.0

## Download

https://github.com/extremecoders-re/pyinstxtractor/releases

风吹屁屁凉 发表于 2024-5-9 11:32

# pyinstxtractor-ng

pyinstxtractor-ng is a tool to extract the contents of a Pyinstaller generated executable file. Both Linux ELFs and Windows PE executables are supported.

This project is a fork of (https://github.com/extremecoders-re/pyinstxtractor).

pyinstxtractor-ng uses the (https://github.com/rocky/python-xdis/) library to unmarshal Python bytecode and as a result there is NO requirement to use the same Python version which was used to build the executable.

pyinstxtractor-ng also supports automatic decryption of encrypted pyinstaller executables.

## Usage

Precompiled binaries for Linux and Windows are provided in (https://github.com/pyinstxtractor/pyinstxtractor-ng/releases).
These are generated using PyInstaller itself, so you don't even need a Python installation to run pyinstxtractor-ng

```
PyInstaller Extractor NG

positional arguments:
filename       Path to the file to extract

optional arguments:
-h, --help   show this help message and exit
-d, --one-dirOne directory mode, extracts the pyz to the same directory
```

Pass the exe filename as an argument or drag & drop the pyinstaller exe file over pyinstxtractor.ng icon on Windows.
```
$ ./pyinstxtractor-ng <filename>
X:\> pyinstxtractor-ng <filename>
```

The `--one-dir` mode extracts the pyz in the same directory as the executable. This is useful if you want to run the extracted files straight-away.

```
X:\> pyinstxtractor-ng --one-dir main.exe
X:\> cd main.exe_extracted
X:\main.exe_extracted\> python main.py
```

## See Also

- (https://pyinstxtractor-web.netlify.app/): pyinstxtractor running in the web browser, powered by Go & GopherJS.

## License

GNU General Public License v3.0

## Download

https://github.com/pyinstxtractor/pyinstxtractor-ng/releases

bohong65 发表于 2024-5-9 12:37

这是攻,那么防呢?先转换成pyd,然后搞一个入口main文件调用pyd和三方库,打包时再加上--key选项:lol破了一层发现还有一层应该会很惊喜

666888tzq 发表于 2024-5-9 12:29

沙发,感谢屁屁大神分享。:lol

zhenze 发表于 2024-5-9 12:30

感谢分享

三滑稽甲苯 发表于 2024-5-9 12:38

人话:可以反编译 PyInstaller 生成的可执行文件

Txily 发表于 2024-5-9 15:28

三滑稽甲苯 发表于 2024-5-9 12:38
人话:可以反编译 PyInstaller 生成的可执行文件

那么这样说,辛辛苦苦用GPT写的软件:lol被小白轻松破了?

loading818 发表于 2024-5-9 19:01

感谢分享。

就是这么帅 发表于 2024-5-10 00:29

:lol这个解包,再用pycdc反编译岂不是绝配

xiawan 发表于 2024-5-10 08:57

太谢谢老大的分享了。
页: [1] 2
查看完整版本: pyinstxtractor -- PyInstaller Extractor