Skip to content

Fix reverse shell hang on blocking commands #3

Description

@anujbolewar

We pass commands to subprocess.Popen and immediately call .read() on stdout. This blocks forever until the process exits. If you run a command that hangs (like ping without limits), the reverse shell completely bricks itself.

The Fix:

Swap Popen for subprocess.run and pass a strict timeout arg.
Catch subprocess.TimeoutExpired.
If it times out, kill the hanging process tree and return a timeout string so the shell stays responsive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions