Not sure if this belongs on here, StackOverflow, or SuperUser.
I have a device running a reverse telnet server that I need to be able to send/receive data to. I'm able to play with it if I run socat like so and telnet into port 8002:
sudo socat TCP-LISTEN:8001 TCP-LISTEN:8002
However, it sends information it shouldn't, and I'm trying to use sed to filter this data out. I'd like this communication to remain bi-directional (that is, anything I type into telnet on localhost:8002 gets sent out through localhost:8001 and vise versa).
I've tried using a bash script containing:
#!/bin/bash sed (my regex here) | socat - TCP-LISTEN:8002
and then running:
sudo socat TCP-LISTEN:8001 SYSTEM:./replace.sh
But that outputs nothing in the telnet console. I've also tried
EXEC: to the same nothing happening.
I've even tried:
sudo socat TCP-LISTEN:8001 "SYSTEM:'sed (my regex here)' || TCP-LISTEN:8002"
to no effect.