-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Dissasembling failing in xasm format #93
Comments
In order for me to work on, I'd need a complete short example with the pyc you started out with, the disassembly of that, the change to the assembly, and finally the resulting pyc. The shortest example that shows this is desirable. |
I never got to the point of successfully disassembling the .pyc so its not newly assembled but here is one of the failing files. |
Ah - I see what's up. If I or someone else doesn't answer this in a week or so, remind me. |
alright, thank you! |
any updates? @rocky |
Here is my understanding of the situation. Some background first. For each list comprehension that appears in Python code, a code object is created for the "body" of the code. For example if you write:
Parts of the disassembly will look like:
The function or method named If there is another list comprehension , another code object with the same method named The way the disassembler disambiguates the different Apparently there are two listcomp methods with the same name including the hex address. I understand how that is possible, but apparently it is. I believe a simple workaround is to run the disassembler with a Python interpreter that matches the bytecode inside the bytecode. When that is done, instead of xdis' structure for a code object, the "native" structure of the code object is used, I think no name mapping is needed. I could be wrong here though. |
Hi,
I'm currently trying to extract the bytecode, edit a few strings and assemble it back to a .pyc file.
Pydisasm without any flags work just fine but as soon as I try to dissamble the file with
Pydisasm -F xasm ./file.pyc
it fails with the following traceback:I also printed out the vars from the assert:
The text was updated successfully, but these errors were encountered: