I need to test my nmap script, which crashes when many ports are open. So I need a script (python/bash) that opens n ports on a server.

How could I do that?

Thank you

  • listen and accept. Mar 21, 2020 at 22:22
  • Please show your code and explain the error clearly: how is it crashing ?
    – Kate
    Mar 22, 2020 at 17:28

1 Answer 1


Perhaps use netcat(1) (command is nc) to listen on the ports of interest (it isn't called the swiss army knife of networking for nothing). If any ports are below 1024, you'd need to run it as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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