0

Suppose i have two shells (A and B). And i execute command below for first shell:

nc -lvp 7777 -e /usr/bin/bash

And in the second shell i execute :

nc localhost 7777

After that, i type 'something' in the first second shell but the stderr is in the first shell below:

bash: line 1: something: command not found

I want to put stderr in the second shell not the first shell. What should i do?

2 Answers 2

0

The idea is applicable. I just did some tests but couldn't make it work because of quotes. Maybe someone can make this work?

Listener:

nc -lvp 7777 -e '/usr/bin/bash -c "bash 2>&1"'

But you can do it manually. From the already open shell you start another shell with stderr redirection. So after you establish a connection and have a shell you run the following.

bash 2>&1

It opens another shell but this time stderr redirected to stdout.

-1

This works on windows. Based on this example you should find a way to make it work on linux. It runs two cmd.exe but it gets the job done.

ncat 127.0.0.1 4444 -e "cmd /c (cmd 2>&1)"
1
  • How is this applicable on Ubuntu? Mar 16, 2021 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .