In working with EVE-NG I often find that I need specific ports open on a test server. Instead of always installing an application (eg NGINX) I hacked together a python that will open a port.
#!/usr/bin/python import socket import subprocess print "---------------------------------------------------------" print "This script will open any TCP port that is not currently" print "in use. Below are the ports in use. Any port < 1024 will" print "require sudo." print "---------------------------------------------------------" print " " subprocess.check_output(['netstat', '-tulpn', '| grep tcp$']) PORT = int(raw_input("What port do you want the server to run on? ")) if 1 <= PORT <= 65535: pass else: print " " print " That is not a valid TCP port. " quit() HOST = '127.0.0.1' # Hostname to bind s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) print "Port", PORT,"is open ... " s.listen(1) conn, addr = s.accept() print 'Connected by', addr while 1: data = conn.recv(1024) if not data: break conn.send(data) conn.close()