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 a terminate method to the process object that invokes a sigterm, or alternitive. #2515

Open
JeremyGDiamond opened this issue Jan 13, 2025 · 0 comments
Labels

Comments

@JeremyGDiamond
Copy link

Problem statement

The pwntools process object is the best wrapper for subprocess.popen in the python language that I know of. For this reason, I use it to automate process control in projects that have nothing to do with exploitation. The pwn.process.kill() method is the only way to end a running process without accessing the underlying subprocess.popen object. However, this sends a sigkill and there is no option for a sigterm. In some environments, sigkill'ed processes don't clean up resources, leaking memory, storage, etc. There are likely exploitations that would prefer not to leak these resources.

Proposed feature

Add a terminate method to the pwn.process class, which sends a sigterm instead. Alternatively, add an input arg to the existing pwn.process.kill() to allow the programmer to specify the signal type. At minimum, add a line in the docks about this.

Tests

Unit tests which spawn processes known to leak resources when sigkill'ed and not when sigterm'ed.

I'm open to doing this myself and sending a pull request but would like some direction on if the feature would be rejected. If it was accepted, which approach would be preferred.

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

No branches or pull requests

1 participant