-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
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.