[ale] Nmap host up/down status
Chris Fowler
cfowler at outpostsentinel.com
Fri Oct 10 16:34:27 EDT 2014
Nmap is not providing an exit code on failure. The doc confirm this. I'll just need to capture the output and parse that. No problem.
[root at test]# time nmap -sn -PE -PP -PM -PO -n 10.139.128.170 2>&1 >/dev/null; echo $?
real 0m 3.05s
user 0m 0.01s
sys 0m 0.02s
0
[root at test]# time nmap -sn -PE -PP -PM -PO -n 127.0.0.1 2>&1 >/dev/null; echo $?
real 0m 0.02s
user 0m 0.00s
sys 0m 0.01s
0
Chris
----- Original Message -----
> From: "dev null zero two" <dev.null.02 at gmail.com>
> To: "Atlanta Linux Enthusiasts" <ale at ale.org>
> Sent: Friday, October 10, 2014 4:04:47 PM
> Subject: Re: [ale] Nmap host up/down status
> "nmap -sn host"
> if that is unreliable, you could try "nmap -sn -PE -PP -PM -PO host"
> if you know certain ports that will be open, you could use -PS80 for a SYN
> ping to port 80 or -PU13337 for a UDP ping to port 13337 (you want to use a
> closed port).
> On Fri, Oct 10, 2014 at 3:53 PM, Chris Fowler < cfowler at outpostsentinel.com >
> wrote:
> > I have a script I use in Perl that tests a list of hosts via the exit code
> > of
> > ping. Some hosts, like Winders, will ignore ICMP ECHO and this creates
>
> > false alerts.
>
> > The idea popped in my head today to use the exit code of nmap and allow it
> > to
> > test for me.
>
> > Can someone clue me in on the best command like options to nmap that will
> > allow it to make a decent determination of a host is up?
>
> > I did think about running an initial port scan and then doing an accept()
> > test on a TCP socket, but then I decided maybe I'd just let nmap make
>
> > the up/down decision.
>
> > Chris
>
> > _______________________________________________
>
> > Ale mailing list
>
> > Ale at ale.org
>
> > http://mail.ale.org/mailman/listinfo/ale
>
> > See JOBS, ANNOUNCE and SCHOOLS lists at
>
> > http://mail.ale.org/mailman/listinfo
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20141010/55f45c24/attachment.html>
More information about the Ale
mailing list