Bash Terminal Redirect to another terminal

I have a netcat port listening on port 1501, and I want to transfer the received input to this port in a new terminal window. I know that this is a bad idea, because in principle someone from this port can control the machine, but I want to find out if this is possible. Does anyone know how. I have tried this so far.

nc -l 1500 | Xterm or nc -l 1500 | xterm -e "NAMEOFWINDOW"

also tried redirecting to gnome-terminal in a simplified way. I can do

nc -l 1500 | grep "SOMEKEYWORD" successfully.

Any ideas? -TJ

+5
source share
3 answers

. -, xterm gnome-terminal , , - , ( /bin/bash). , bash netcat.

-, , , |. :

nc -l -p 1500 | /bin/bash

bash - , . , :

/bin/bash | nc -l -p 1500

- bash. bash, .

, netcat (, ) :

nc -l -p 1500 -e /bin/bash

, - , bash , "".

, - , .

+2

, xterm stdin, .

:

  • bash xterm: nc -l 1500 | bash xterm
  • xterm -S, netcat - , xterm
+1

tee , tail --follow=name --retry .

nc -l 1500 | tee /tmp/file.txt

, :

tail --follow=name --retry /tmp/file.txt

rm -f /tmp/file.txt cron tail.

0
source

All Articles