Upgrading Simple Shells to Fully Interactive TTYs

upgrading-simple-shells-to-fully-interactive-ttys

Imagine you’re a hacking pro, right? You pull off this cool move, catching a reverse shell with netcat. The netcat messages start showing off, and the “id” command spills secrets like a chatterbox.

But, oh boy, here comes the buzzkill! You’re typing away, a command misbehaves, you freak out, hit “Ctrl-C,” and suddenly, the whole connection goes poof.

” width=”800″ height=”328″>

Now, these not-so-smart shells have more issues than a cat trying to sneak past a bunch of dogs:

  1. Commands like “su” and “ssh” act like drama queens, demanding a fancy terminal.

  2. STDERR stays hidden, like it’s playing hide and seek.

  3. Using text editors like Vim becomes a slapstick comedy — imagine trying to teach a robot to tango.

  4. Tab completion? It takes a vacation, and it’s not sending a postcard.

  5. Going back in command history with the up arrow? Nope, too old-school.

  6. Job control? It’s like a part-time job — doesn’t work full hours.

And the comedy show goes on…

To keep it simple, catching those shells is okay, but I really prefer working with a fully interactive TTY. It just makes things smoother.

First you need to upgrade your shell using one of those commands :

$ python -c “import pty; pty.spawn(‘/bin/bash’)”

or

$ ruby -e “exec ‘/bin/bash'”

or

$ perl -e “exec ‘/bin/bash’;”

for me i will use python

spawn a pty shell

Next , Press CTRL + Z to background process and get back to your host machine

Then , Use stty command to set terminal line settings and foreground back the target terminal:

$ stty raw -echo; fg

Finally, Set the terminal environment to something more appealing (e.g. xterm, xterm-256, etc):

$ export TERM=xterm-256-color

You should now have a stabilized bash shell that can tab complete, clear the screen, and use  raw `CTRL + C` endraw !

You should now have a stabilized bash shell that can tab complete, clear the screen, and use CTRL + C!

Here’s another trick in the bag to secure a stable terminal window, you can turn to the socat command-line tool. The only catch is that the target machine might not have this tool ready to roll out of the box. So, you’ll have to take a few extra steps to get it installed.

For more details, check out the reference on

Upgrading Simple Shells to Fully Interactive TTYs

Thanks for reading < 3

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
screenwriting-techniques-for-marketers:-defining-your-customer’s-problem

Screenwriting Techniques for Marketers: Defining Your Customer’s Problem

Next Post
how-to-get-the-most-out-of-mentorships

How to get the most out of mentorships

Related Posts