OSCP
Search…
Reverse Shell to fully interactive
1
echo os.system('/bin/bash')
2
/bin/sh -i
3
4
5
# Enter while in reverse shell
6
$ python -c 'import pty; pty.spawn("/bin/bash")'
7
8
Ctrl-Z
9
10
# In Kali
11
$ stty raw -echo
12
$ fg
13
14
# In reverse shell
15
$ reset
16
$ export SHELL=bash
17
$ export TERM=xterm-256color
18
$ stty rows <num> columns <cols>
Copied!
1
python -c "import pty; pty.spawn('/bin/bash')"
Copied!
1
stty raw -echo
2
fg
Copied!
1
stty size
Copied!
This should return two numbers, which are the number of rows and columns in your terminal. For example’s sake let’s say this command returned 48 120 Head on back to your victim box’s shell and run the following.
1
stty -rows 48 -columns 120
Copied!
1
$ export SHELL=bash
2
$ export TERM=xterm-256color
3
$ stty rows <num> columns <cols>
Copied!
Last modified 1yr ago
Copy link