initial version

This commit is contained in:
Emil Lerch 2023-04-22 09:32:44 -07:00
parent d32cdf0779
commit 2717fbc2f3
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
6 changed files with 3082 additions and 0 deletions

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM python:3.7-alpine
# pycdc in this directory is a statically linked executable based on version
# 2e76e56420493bfc0807da06a87dfdda5217a5aa
COPY pycdc /usr/bin
# unpyc37 in this directory is copied from https://github.com/andrew-tavera/unpyc37/blob/d7dc609e8c63086dc58fc749835f7aed2482543f/unpyc3.py
# I have added #!/usr/bin/env python3 to the top and renamed it so we can use
# it like a regular command
COPY unpyc3 /usr/bin
# According to uncompyle6 docs, we should generally use decompyle3 for
# python versions 3.7 or 3.8
RUN true && \
pip3 install uncompyle6 && \
pip3 install decompyle3 && \
true
COPY entrypoint /entrypoint
ENTRYPOINT [ "/entrypoint" ]
CMD []
WORKDIR /work

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Emil Lerch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

33
README.md Normal file
View File

@ -0,0 +1,33 @@
Python 3.7 Decompiler Docker Image
==================================
This repo contains specific versions of [pycdc](https://github.com/zrax/pycdc/tree/2e76e56420493bfc0807da06a87dfdda5217a5aa)
and [unpyc3](https://github.com/andrew-tavera/unpyc37/blob/d7dc609e8c63086dc58fc749835f7aed2482543f/unpyc3.py).
On docker build, [uncompyle6](https://pypi.org/project/uncompyle6/) and
[decompyle3](https://pypi.org/project/decompyle3/) will also be installed from pip.
The entrypoint is a shell command that will decompile command line arguments
to output 3 files:
* <file>.pycdc.py
* <file>.unpyc3.py
* <file>.decompyle3.py
We install uncompyle6 in case it is needed, but decompyle3 should be a strictly
superior choice, so it is not included in the output.
Building
--------
`docker build . -t python3-decompile`
Usage
-----
This is intended to be used from the command line. Example:
`docker run --rm -v $(pwd):/work python37-decompile *.pyc`
The entrypoint is a shell script that will run all three decompilers on the
passed in arguments

8
entrypoint Executable file
View File

@ -0,0 +1,8 @@
#!/bin/busybox sh
# shellcheck disable=SC3060
for f in "$@"; do
decompyle3 "$f" > "${f//.pyc}.decompyle3.py"
pycdc "$f" > "${f//.pyc}.pycdc.py"
unpyc3 "$f" > "${f//.pyc}.unpyc3.py"
done

BIN
pycdc Executable file

Binary file not shown.

2996
unpyc3 Executable file

File diff suppressed because it is too large Load Diff