Skip to content
zeknox edited this page Oct 23, 2012 · 1 revision

livehosts.rb

Summary

livehosts.rb is a ruby script that is used to show all of the live ip addresses from any nmap scan. The script imports any nmap xml outfile to determine which ip addresses are up and alive.

Script Execution

root@bt:~# nmap -sP 192.168.0.0/24 -oA 192.168.0.0_sweep

Starting Nmap 6.02 ( http://nmap.org ) at 2012-10-03 11:47 EDT
Nmap scan report for 192.168.0.1
Host is up (0.0092s latency).
MAC Address: 00:18:39:41:26:88 (Cisco-Linksys)
Nmap scan report for 192.168.0.100
Host is up (0.096s latency).
MAC Address: 10:40:F3:E4:0E:C7 (Apple)
Nmap scan report for 192.168.0.107
Host is up (0.000077s latency).
MAC Address: 00:1E:E5:E3:CF:E9 (Cisco-Linksys)
Nmap scan report for 192.168.0.117
Host is up.
Nmap scan report for 192.168.0.123
Host is up (0.0082s latency).
MAC Address: 00:1C:C4:39:D7:BA (Hewlett-Packard Company)
Nmap done: 256 IP addresses (5 hosts up) scanned in 4.41 seconds

Now that we have run an nmap scan lets parse the xml file to show all the ip addresses of hosts that are alive on this network.

root@bt:~# ruby livehosts.rb 192.168.0.0_sweep.xml 
192.168.0.1
192.168.0.100
192.168.0.107
192.168.0.117
192.168.0.123

File output

root@bt:~# ruby livehosts.rb 192.168.0.0_sweep.xml > 192.168.0.0_hosts.txt
Clone this wiki locally