Skip to main content

Stabilize a Shell

As soon you was able to get a shell on the target you can spawn a stabilized bash shell

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

It would look like that:

┌──(togo㉿hackinglab)-[~/Hacking/THM/ignite]
└─$ nc -lvnp 4444                                                                                                                                       1 ⨯
listening on [any] 4444 ...
connect to [10.9.1.187] from (UNKNOWN) [10.10.103.145] 33602
Linux ubuntu 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
 03:53:52 up 57 min,  0 users,  load average: 1.00, 0.97, 1.32
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
uid=33(www-data) gid=33(www-data) groups=33(www-data)
/bin/sh: 0: can't access tty; job control turned off
$
$
$
$
$ python -c 'import pty;pty.spawn("/bin/bash")'
www-data@ubuntu:/$

www-data@ubuntu:/$

www-data@ubuntu:/$