nc.traditional -e script.py Not printing anything

183 Views Asked by At

I am starting a basic netcat server with the command nc.traditional -l -e server.py -p 4567

Problem is when I'm connecting to it (telnet 127.0.0.1 4567), the script starts but nothing gets on screen.

I have print instructions on the beginning of the script that are read by the interpreter (I tested that it starts via file manipulation) but nothing is written on my telnet terminal. Moreover, it stays stuck on a raw_input instruction. I can write in the telnet terminal, but nothing seems to be sent to the python script.

I've tried with a bash script replacing the python one and this works, it prints things on screen and read inputs. I've also tried connecting via ftp instead of telnet without results.

1

There are 1 best solutions below

0
On BEST ANSWER

So, I finally found the solution

In the shebang, add the option -u to the interpreter to unbuffer stdin stdout and stderr

Shebang line: #!usr/bin/python -u