0

**** This is for learning purpose. I just like to deep dive into sockets, tcp, packets, etc.

For doing tests and learning, I began to "play" with socat

CONTEXT (tests) :

1- Bind a port to a shell script

socat -u tcp-l:7777,fork system:/path/to/test.sh

2- test from an other terminal

echo "message 1" | netcat 192.168.0.x 7777

THIS simple test works, the .sh gets triggered

QUESTION : to learn further, how would I receive a file and save it ?

1
  • with netcat just use nc -parametershere > file.ending
    – djdomi
    Dec 26, 2021 at 13:09

2 Answers 2

2
socat -u TCP-L:7777,fork OPEN:/tmp/test.out,creat,append
0

If the shell script /path/to/test.sh contains something like

cat >/path/to/target.dat

(i.e. read from stdin, write to a file) then you can "transfer" a file by means of

cat /path/to/source.dat | netcat 192.168.0.x 7777

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.