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

read .pyc #123

Closed
Majingnan36 opened this issue Aug 10, 2023 · 3 comments
Closed

read .pyc #123

Majingnan36 opened this issue Aug 10, 2023 · 3 comments

Comments

@Majingnan36
Copy link

Does it support reading .pyc files? Get all bytecode instructions in .pyc by similar to Bytecode.from_code(code_obj)

@MatthieuDartiailh
Copy link
Owner

No currently bytecode only operate on code objects.

I never tried to open a pyc and unmarshall it, but you could try that and grab the module code object to use with bytecode.

@P403n1x87
Copy link
Contributor

Would something like this work for you?

from pkgutil import read_code

with open("path/to.pyc", "rb") as f
    bc = Bytecode.from_code(read_code(f))

@Majingnan36
Copy link
Author

Thanks for your answers, it's very helpful for me

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