in reply to NMAP Parser very slow
For instance a range of 4 addresses takes up to 20 minutes for the script to complete. That's doable but with a /24, this is simply too long. Now I have read that this kind of nmap port scanning takes a long time but is there something wrong with my code that makes it very slow?
No. Nothing particular.
You are calling ->tcp_ports('open') for each of the hosts you are investigating. In order to be able to tell you which ports are open, NMap will have to scan all of the ports for each host.
You say that it is takig 20 for 4 hosts; so 300 seconds per host. Assuming that NMap is limiting itself to the bottom 1024 privileged ports on each host, that means 300 / 1024 = 0.293 seconds per port. Active ports may well respond more quickly than that, but for inactive ports NMap will have to wait a certain amount of time before it times the port out and concludes it is not active. That calculation assumes that NMap scans the ports serially.
It is also possible that NMap scans the ports in parallel; and that the commonly used default timeout of 300 seconds means that every host will always take a minimum of 5 minutes to scan, unless it all 1024 ports are open.
Does NMAP::Parser, or one of its dependents allow you to configure the timeout?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: NMAP Parser very slow
by Anonymous Monk on Nov 02, 2016 at 18:33 UTC | |
|
Re^2: NMAP Parser very slow
by Noosrep (Novice) on Nov 02, 2016 at 15:52 UTC |