On Fri, Jun 30, 2006 at 10:31:14AM +0100, George B. wrote: > > This is a minor/wishlist bug. > > I am using nmap in a script to check if a remote router (which > unfortunately blocks pings) is alive. > > The problem is that nmap will exit with 0 even if the host is down. E.g: > > --- > nmap -sS -p 500 -P0 10.1.75.139 && echo -e "\nReturns code $?" > > Starting Nmap 4.10 ( http://www.insecure.org/nmap/ ) at 2006-06-30 10:25 > BST > Nmap finished: 1 IP address (0 hosts up) scanned in 0.235 seconds > > Returns code 0 > --- > > Any chance nmap could be made to distinguish between successful and > failed tests? > > For now I have to use the "grep '0 hosts up'" bodge to get around this.
I can kind-of see your point. On the other hand, Nmap completed successfully and returned the results (the host was down). Nmap returns nonzero when there is an error and Nmap cannot complete. If Nmap was to return nonzero in your case, what should it do if you scan two machines and one machine is up and another is down? What if you scan two and they are both down? If the RC is nonzero based on whether hosts scanned are up or down, how do we inform the script that Nmap encountered an error and failed to complete? Cheers, -F -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]