# Reverse Shell to fully interactive

![](https://3412915462-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LkvnWByFHssLOYr3_77%2F-M45IhtHiYTtsofFLzOl%2F-M45LFvyKBumRqF-LhFw%2Fimage.png?alt=media\&token=965314ba-7db7-439d-b34a-99f17cf689a1)

```
echo os.system('/bin/bash')
/bin/sh -i


# Enter while in reverse shell
$ python -c 'import pty; pty.spawn("/bin/bash")'

Ctrl-Z

# In Kali
$ stty raw -echo
$ fg

# In reverse shell
$ reset
$ export SHELL=bash
$ export TERM=xterm-256color
$ stty rows <num> columns <cols>
```

```
python -c "import pty; pty.spawn('/bin/bash')"
```



```
stty raw -echo
fg
```



```
stty size
```



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.

```
stty -rows 48 -columns 120
```

```
$ export SHELL=bash
$ export TERM=xterm-256color
$ stty rows <num> columns <cols>
```
