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

Add pyinstaller hook #2215

Closed
wants to merge 6 commits into from
Closed

Conversation

peace-maker
Copy link
Member

This allows to create single-file exploits without the need to have python installed. You still need to have external binutils for asm/disasm.

https://pyinstaller.org/en/stable/index.html

Closes #2086

This allows to create single-file exploits without the need to have
python installed. You still need to have external binutils for asm/disasm.

Closes Gallopsled#2086
This is experimental/optional support without guarantees.
@peace-maker
Copy link
Member Author

PyInstaller allows easy integration into pytest to test bundling, but since we don't use pytest and this is more of a gimmick right now, I don't think adding tests and installing pyinstaller in CI is worth it.

@Arusekk
Copy link
Member

Arusekk commented Jul 9, 2023

Could this be done with importlib.resources and its backport importlib_resources? This would also close #1366 and all similar issues could be avoided.

Note: I did not read into the thing yet, sorry if it is unrelated.

@peace-maker
Copy link
Member Author

This is unrelated, since pyinstaller uses static analysis to find which modules and files to include in a bundle and needs help if a project uses dynamic imports.

https://pyinstaller.org/en/stable/hooks.html#providing-pyinstaller-hooks-with-your-package

I've followed their docs about this and it's just about our dynamic importing of shellcraft templates and constants. I didn't see references to resources or the problem pyoxidizer mentions.

I didn't investigate why the hidden imports are needed. Probably using pwnlib directly vs. pwn.

@Arusekk
Copy link
Member

Arusekk commented Jul 9, 2023

Okay so if it is unrelated, I would prefer to wait with merging these pyinstaller hooks, as they are not strictly necessary for us (and pyinstaller looks very Windows-first). I suspect this might need to be made a bit different if we use importlib resources, and I would like to use that soon.

@peace-maker
Copy link
Member Author

We could just revisit this when someone complains after migrating to importlib.resources. I've only tested this on linux, so I don't see the windows focus. I'm trying to get the numbers of open PRs down and get the feedback on pace, so it's more fun to contribute without having to wait years for a decision. So leaving this PR open on the premise of maybe breaking it in the future isn't really something I'd like to be doing :/

@peace-maker
Copy link
Member Author

I guess there isn't really high demand for this and not worth the maintenance at the moment. Please comment if you have a use case for packing pwntools exploits into an executable and reopen!

@peace-maker peace-maker closed this Jan 3, 2024
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

Successfully merging this pull request may close these issues.

Do not store files in /tmp or pyinstaller can not work
2 participants