Friday, January 16, 2009

Scanning IP Address with nmap

Nmap or network mapper is linux utility based on command line. For me, this network tool is very usefull to explore my network status. Nmap usually is used by network admin, network security tester (Pen-test) and others. Please do not use to do something bad.

To know the number of alive computers in your Local Area Network :

Code :
# nmap -sP 192.168.1.0/24
or
# nmap -sP 192.168.1.*

Example :
[root@msmunir1 ~]# nmap -sP 192.168.1.*

Starting Nmap 4.53 ( http://insecure.org ) at 2009-01-16 04:38 WIT
Host 192.168.1.1 appears to be up.
MAC Address: 00:1E:40:B3:55:E9 (Shanghai DareGlobal Technologies Co.)
Host 192.168.1.2 appears to be up.
MAC Address: 00:02:6F:4A:14:06 (Senao International Co.)
Host 192.168.1.86 appears to be up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 11.256 seconds
[root@msmunir1 ~]#

You see above, the number of host alive = 3 hosts up

To know the TCP ports status (open, closed or filtered) use in a computer :

Code :
# nmap -sS 192.168.1.1

Example :
[root@msmunir1 ~]# nmap -sS 192.168.1.1

Starting Nmap 4.53 ( http://insecure.org ) at 2009-01-16 04:40 WIT
Interesting ports on 192.168.1.1:
Not shown: 1711 closed ports
PORT STATE SERVICE
21/tcp open ftp
23/tcp open telnet
80/tcp open http
MAC Address: 00:1E:40:B3:55:E9 (Shanghai DareGlobal Technologies Co.)

Nmap done: 1 IP address (1 host up) scanned in 6.594 seconds
[root@msmunir1 ~]#

To know the UDP ports status (open, closed or filtered) use in a computer :

Code :
# nmap -sU 192.168.1.1

Example :
[root@msmunir1 ~]# nmap -sU 192.168.1.2

Starting Nmap 4.53 ( http://insecure.org ) at 2009-01-16 04:43 WIT
Interesting ports on 192.168.1.2:
Not shown: 1487 closed ports
PORT STATE SERVICE
69/udp open|filtered tftp
MAC Address: 00:02:6F:4A:14:06 (Senao International Co.)

Nmap done: 1 IP address (1 host up) scanned in 6.637 seconds
[root@msmunir1 ~]#

Other command :
# nmap -v -sS -sV -O -v
or
# nmap -v -sS -sV -O -v

Options :
-O = guess remote operating system
-sV = version scan = probes open ports determining service & app names/versions
-sS = TCP SYN stealth port scan (default if privileged (root))
-sU = UDP port scan
-v = verbose, use twice for greater effect
by.msmunir@batan.go.id

No comments:

Post a Comment