Not sure if this shouldnt be in the newbie section. Sorry if its in the wrong place but Ive just started out with bash scripting and am trying to figure a way of port scanning through a proxy as part of a project I've been assigned.

I've scripted it so far with a loop to loop through IPs on a subnet and then a second nested loop for the ports. It is using netcat to make the individual connections.

All I need back is the banner for each IPort if there is one. Otherwise I want the script to move on. The problem is when the port is not there as often the case, the script gets stuck so I need a timeout on the connection (2 or 3 seconds is probably enough).

Does this make any sense?

Thanks in advance and apologies if Im rambling a bit