Nmap Command
Nmap Command
Nmap is short for Network Mapper. It is an open source security tool for network exploration, security scanning and auditing. However, nmap command comes with lots of options that can make the utility more robust and difficult to follow for new users. The purpose of this post is to introduce a user to the nmap command line tool to scan a host and/or network, so to find out the possible vulnerable points in the hosts. You will also learn how to use Nmap for offensive and defensive purposes.
[1]
nmap in action
[4]
#9: Scan a network and find out which servers and devices are up and running
This is known as host discovery or ping scan: nmap -sP 192.168.1.0/24 Sample outputs: Host 192.168.1.1 is up (0.00035s latency). MAC Address: BC:AE:C5:C3:16:93 (Unknown) Host 192.168.1.2 is up (0.0038s latency). MAC Address: 74:44:01:40:57:FB (Unknown) Host 192.168.1.5 is up. Host nas03 (192.168.1.12) is up (0.0091s latency). MAC Address: 00:11:32:11:15:FC (Synology Incorporated) Nmap done: 256 IP addresses (4 hosts up) scanned in 2.80 second
Page 1 of 3
vmnet1 (vmnet1) 192.168.121.1/24 ethernet up 00:50:56:C0:00:01 vmnet8 (vmnet8) 192.168.179.1/24 ethernet up 00:50:56:C0:00:08 ppp0 (ppp0) 10.1.19.69/32 point2point up **************************ROUTES************************** DST/MASK DEV GATEWAY 10.0.31.178/32 ppp0 209.133.67.35/32 eth0 192.168.1.2 192.168.1.0/0 eth0 192.168.121.0/0 vmnet1 192.168.179.0/0 vmnet8 169.254.0.0/0 eth0 10.0.0.0/0 ppp0 0.0.0.0/0 eth0 192.168.1.2
#16: The fastest way to scan all your devices/computers for open ports ever
nmap -T5 192.168.1.0/24
#19: Scan a host using TCP ACK (PA) and TCP Syn (PS) ping
If firewall is blocking standard ICMP pings, try the following host discovery methods: nmap -PS 192.168.1.1 nmap -PS 80,21,443 192.168.1.1 nmap -PA 192.168.1.1 nmap -PA 80,21,200-512 192.168.1.1
#22: Find out the most commonly used TCP ports using TCP SYN Scan
### Stealthy scan ### nmap -sS 192.168.1.1 ### Find out the most commonly used TCP ports using ### OS Fingerprinting ### nmap -sT 192.168.1.1 TCP connect scan ( warning: no stealth scan)
### Find out the most commonly used TCP ports using TCP ACK scan nmap -sA 192.168.1.1 ### Find out the most commonly used TCP ports using TCP Window scan nmap -sW 192.168.1.1 ### Find out the most commonly used TCP ports using TCP Maimon scan nmap -sM 192.168.1.1
Page 2 of 3
### Use a random MAC address ### ### The number 0, means nmap chooses a completely random MAC address ### nmap -v -sT -PN --spoof-mac 0 192.168.1.1
[14]
The official Nmap project guide to network discovery and security Scanning [19]. The official Nmap project [20] home page. The nmap command has many more options, please go through man page or the documentation for more information. What are some of your favorite nmap command-line tricks? Share your favorite tips, tricks, and advice in the comments below.
Important Message from nixCraft: 4000+ howtos and counting! Want to read more Linux / UNIX howtos, tips and tricks? We request you to sign up for the following to ensure that you make the most from our guides / howtos: 1. RSS feed for nixCraft - Get intimated about our new howtos / faqs as soon as it is released. 2. Daily email newsletter or weekly newsletter - Get intimated about our new howtos / faqs as soon as it is released via email.
URL to article: http://www.cyberciti.biz/networking/nmap-command-examples-tutorials/ URLs in this post: [1] Image: http://www.cyberciti.biz/networking/nmap-command-examples-tutorials/attachment/welcome-nmap/ [2] fully patched server with firewall: http://www.cyberciti.biz/tips/linux-iptables-examples.html [3] Debian / Ubuntu Linux: Install nmap Software For Scanning Network: http://www.cyberciti.biz/faq/install-nmap-debianubuntu-server-desktop-system/ [4] CentOS / RHEL: Install nmap Network Security Scanner: http://www.cyberciti.biz/faq/howto-install-nmap-on-centosrhel-redhat-enterprise-linux/ [5] OpenBSD: Install nmap Network Security Scanner: http://www.cyberciti.biz/faq/installing-nmap-network-port-scannerunder-openbsd-using-pkg_add/ [6] ip command: http://www.cyberciti.biz/faq/howto-linux-configuring-default-route-with-ipcommand/ [7] route command: http://www.cyberciti.biz/faq/what-is-a-routing-table/ [8] netstat command: http://www.cyberciti.biz/faq/linux-unix-open-ports/ [9] identify a remote host apps and OS using the -O option: http://www.cyberciti.biz/faq/identify-remote-host-by-unix-linuxcommand/ [10] how to block Xmas packkets, syn-floods and other conman attacks: http://www.cyberciti.biz/tips/linux-iptables-10-howto-block-common-attack.html [11] decoys are scanning the target network too: http://www.cyberciti.biz/tips/nmap-hide-ipaddress-with-decoy-idealscan.html [12] zenmap the official network mapper: http://nmap.org/zenmap/ [13] apt-get command: http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html [14] Image: http://www.cyberciti.biz/networking/nmap-command-examples-tutorials/attachment/nmap-usage-examplesoutput/ [15] How to use psad tool to detect and block port scan attacks in real time: http://www.cyberciti.biz/faq/linux-detect-portscan-attacks/ [16] Debian / Ubuntu Linux: Install and Configure Shoreline Firewall (Shorewall): http://www.cyberciti.biz/faq/debianubuntu-linux-shorewall-firewall-configuration/ [17] CentOS / Redhat Iptables Firewall Configuration Tutorial: http://www.cyberciti.biz/faq/rhel-fedorta-linux-iptablesfirewall-configuration-tutorial/ [18] 20 Linux Server Hardening Security Tips: http://www.cyberciti.biz/tips/linux-security.html [19] The official Nmap project guide to network discovery and security Scanning: http://nmap.org/book/toc.html [20] The official Nmap project: http://nmap.org/
Copyrighted material Copyright 2004-2013 nixCraft. All rights reserved. This print / pdf version is for personal non-commercial use only. Unless otherwise indicated, the documents and graphics stored on this Web server, www.cyberciti.biz, are copyrighted. Links to these documents are permitted and encouraged. No copies may be made without permission. More details - http://www.cyberciti.biz/tips/copyright
Page 3 of 3