I am trying to make
netcat to listen to connect to a remote machine, run bash for every text that comes from the remote machine and send the result of the command back to the remote machine.
Yep. Totally hacky.
I kinda got it working like this:
On my local machine, I run
netcat -l -p 8765
On the remote, firewalled machine, I run
netcat <ipofmylocalmachine> 8765 | bash -
I can see the result of my commands when I do a
tail -f /tmp/output on the remote machine, and enter a
echo "test" > /tmp/output
But how can I see the result of the bash command on my local machine?
I can do it with Python and Perl, but how can it be done using only bash?
Just as a note, I am aware of reverse shell explanations, like http://blog.safebuff.com/2016/06/19/Reverse-shell-Cheat-Sheet/, but note that what I am looking for is a little different. Instead of opening a port of the server, the port being open is on the client, which is not firewalled.