Spawning Interactive Reverse Shell

first using this command and check which languge installed on system

if you have python or python3 so continue with python or python3 if you have install perl so continue with perl

this example for python

$ which python

1. python and python3 pty shell……………..

now select command according to installed languge i am continue with python

python -c 'import pty; pty.spawn("/bin/sh")'python -c 'import pty; pty.spawn("/bin/bash")'python3 -c 'import pty; pty.spawn("/bin/bash")'perl -e 'exec "/bin/sh";'

2. put the shell into background

using ctrl+z put shell on background


3. current terminal and STTY info

echo $TERM
stty -a

4. Set the current STTY to type raw and tell it to echo the input characters

stty raw -echo

5. Foreground the shell with fg and re-open the shell with reset

$ fgreset

6. stty size to match our current window

$ export SHELL=bash$ export TERM=xterm256-color$ stty rows 37 columns 146$ bash -i

7. Set PATH TERM and SHELL if missing

$ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin$ export TERM=xterm$ export SHELL=bash$ cat /etc/profile; cat /etc/bashrc; cat ~/.bash_profile; cat ~/.bashrc; cat ~/.bash_logout; env; set$ export PS1='[\u@\h \W]\$ '

enjoy now you have fully interactive shell


Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Automate Sending Emails from a Google Sheet using Python

The practical value of an SRE team

Hubble’s xp Leaderboard Snapshot: October

How to enable IdentityServer 4 in your ASP.NET

Login failed for login <Login Name> due to trigger execution.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

Cara Install VSFTPD pada Ubuntu 20.04 / Debian 11 / Linux Mint

Cara Install VSFTPD pada Ubuntu 20.04 / Debian 11 / Linux Mint

Local eCommerce Project

Elastic APM Server Installation and Configuration