Skip to content

Add a terminate method to the process object that invokes a sigterm, or alternitive. #2515

@JeremyGDiamond

Description

@JeremyGDiamond

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featuregood first issueGood if you want to help but you do not know the project well

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions