Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTools #4

Open
DasMoorhuhn opened this issue Jul 24, 2024 · 2 comments
Open

PyTools #4

DasMoorhuhn opened this issue Jul 24, 2024 · 2 comments

Comments

@DasMoorhuhn
Copy link

Ay^^

From where can I get the pytools lib which is linked in the Cargo.toml? pytools = { path = "../pytools" }

@Alexander-Porter
Copy link

I'm currently working on remapping opcodes using a modified version of the xdis library, which I thought may work as an alternative of pytools. I got the opcode mapping from the latest commit. I got pyc files from the last commit of this repo without pytools dependency. I fixed the magic number of the .pyc file and have the opcode remapped as shown below:

(
    filename,
    co,
    version,
    timestamp,
    magic_int,
    is_pypy,
    source_size,
    sip_hash,
) = xdis.disassemble_file(
    str(pyc_file), outstream=open(os.devnull, "w"), alternate_opmap=alternate_opmap #from src/opcode/mapping.rs
)

However, the output pyc file can't be decompiled. I have tried using both uncompyle6 and pycdc, and they both warned about an unsupported opcode. For pycdc, the specific unsupported opcode was MAKE_CELL.

I suspect there might be an issue with how the opcode is being remapped. To debug this further, the access to the pytools dependency should be helpful.

@hax0r31337
Could you please make the pytools public? This will greatly help in locating and fixing the error with decompiling, thanks!

@hax0r31337
Copy link
Owner

I was planning to add decompiler to pytools library, but I having trouble analyzing dominator tree of python bytecode.
That's the reason I didn't made pytools available publicly.

btw both pycdc and uncompyle6 unable to decompile Python 3.11 bytecode, although pycdc claims the capability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants