Tuesday, August 28, 2012

Hacking Tool NMAP

Introduction

  Hi, Here I'm introducing a powerful network analysis tool called 'NMAP'. If you are familiar with network analysis and the terms related to it, then you can skip to the next paragraph, else, continue reading. :)
For the clarity, I'll give you a brief introduction for the keywords used in this article
*IP address: IP address is internet protocol address, assigned for every network devices to identify it in a network.

* Network Mapping: The term 'Network Mapping' means explore or describe a network, or a network host with it's details like IP address,Host name, Ports, State of ports ( whether they are open or close )

*Port:  The port is an application-specific or process-specific software construct serving as a communications endpoint in host Operating system.


* Open Port: 'Open Port' output of nmap is a positive sign for the hackers. Open port is a port that always listen for accepting connections.  We can make use of it for grabbing the host.


*Filtered Port:  Filtered port is a port with some security features. They may/may not be open ports. It may use a firewall to filter the connectivity. But, a talented hacker can communicate with the port even it is blocked with a firewall.

The Tool NMAP


                 NMAP  is  a great network exploration tool and security or port scanner. The name NMAP stands for Network MAPper. It is an open source tool for network exploration and security auditing. It can rapidly scan larger networks as well as single hosts. Nmap uses raw IP packets to determine the type of hosts, OS running on the hosts, ports in the hosts, port numbers,state of scanned ports and also the state of ports in the host,etc...


       The NMAP tool produces a scanned output that describes the state of target systems or networks. It can give some supplemental information  on each depending on the options used.
A typical example of NMAP scanning is shown below

here, option -A is used for OS and version detection,trace route and script scanning  and -T4 is used for faster scanning execution.



The target can be host names, ip address, or networks..


Scanning Techniques

Scanning techniques includes the way of scanning the target. The output may vary according to the technique used for the scanning. The core scanning techniques are..

HOST DISCOVERY:
1.  -sL: List Scan - simply list targets to scan

2.  -sn: Ping Scan - disable port scan

3.  -Pn: Treat all hosts as online -- skip host discovery

4.  -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports

5.  -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes

6. -PO[protocol list]: IP Protocol Ping

7. -n/-R: Never do DNS resolution/Always resolve [default: sometimes]

8. --dns-servers <serv1[,serv2],...>: Specify custom DNS servers

9. --system-dns: Use OS's DNS resolver

10. --traceroute: Trace hop path to. each host









SCAN TECHNIQUES:

1.  -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans

2.  -sU: UDP Scan

3.  -sN/sF/sX: TCP Null, FIN, and Xmas scans

4. --scanflags <flags>: Customize TCP scan flags

 5. -sI <zombie host[:probeport]>: Idle scan

6. -sY/sZ: SCTP INIT/COOKIE-ECHO scans

7. -sO: IP protocol scan

8. -b <FTP relay host>: FTP bounce scan

PORT SPECIFICATION AND SCAN ORDER:




 1.  -p <port ranges>: Only scan specified ports
  
                 Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
2. -F: Fast mode - Scan fewer ports than the default scan

3. -r: Scan ports consecutively - don't randomize

4.  --top-ports <number>: Scan <number> most common ports

5.  --port-ratio <ratio>: Scan ports more common than <ratio>




SERVICE/VERSION DETECTION:


 1.  -sV: Probe open ports to determine service/version info

 2.  --version-intensity <level>: Set from 0 (light) to 9 (try all probes)

 3.  --version-light: Limit to most likely probes (intensity 2)

 4. --version-all: Try every single probe (intensity 9)

 5.  --version-trace: Show detailed version scan activity (for debugging)



SCRIPT SCAN:


1.  -sC: equivalent to --script=default

2.  --script=<Lua scripts>: <Lua scripts> is a comma separated list of
           directories, script-files or script-categories

3.  --script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts

4.  --script-args-file=filename: provide NSE script args in a file

5.  --script-trace: Show all data sent and received

6.  --script-updatedb: Update the script database.

7.  --script-help=<Lua scripts>: Show help about scripts.
           <Lua scripts> is a comma separted list of script-files or
           script-categories.



OS DETECTION:


1.  -O: Enable OS detection

2.  --osscan-limit: Limit OS detection to promising targets

3.  --osscan-guess: Guess OS more aggressively


TIMING AND PERFORMANCE:


  Options which take <time> are in seconds, or append 'ms' (milliseconds),
  's' (seconds), 'm' (minutes), or 'h' (hours) to the value.
1.   -T<0-5>: Set timing template (higher is faster)

2.--min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes

3.  --min-parallelism/max-parallelism <numprobes>: Probe parallelization

4  --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies
      probe round trip time.

5  --max-retries <tries>: Caps number of port scan probe retransmissions.

6.  --host-timeout <time>: Give up on target after this long

7.  --scan-delay/--max-scan-delay <time>: Adjust delay between probes

8.  --min-rate <number>: Send packets no slower than <number> per second

9.  --max-rate <number>: Send packets no faster than <number> per second



FIREWALL/IDS EVASION AND SPOOFING:



1.  -f; --mtu <val>: fragment packets (optionally w/given MTU)

2.  -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys

3.  -S <IP_Address>: Spoof source address

4.  -e <iface>: Use specified interface

5.  -g/--source-port <portnum>: Use given port number

6.  --data-length <num>: Append random data to sent packets

7.  --ip-options <options>: Send packets with specified ip options

8.  --ttl <val>: Set IP time-to-live field

9.  --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address

10  --badsum: Send packets with a bogus TCP/UDP/SCTP checksum











OUTPUT:



1.  -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
     and Grepable format, respectively, to the given filename.
2. -oA <basename>: Output in the three major formats at once

3.  -v: Increase verbosity level (use -vv or more for greater effect)

4.  -d: Increase debugging level (use -dd or more for greater effect)

5.  --reason: Display the reason a port is in a particular state

6.  --open: Only show open (or possibly open) ports

7.  --packet-trace: Show all packets sent and received

8.  --iflist: Print host interfaces and routes (for debugging)

9.  --log-errors: Log errors/warnings to the normal-format output file

10.  --append-output: Append to rather than clobber specified output files

11.  --resume <filename>: Resume an aborted scan

12.  --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML

13  --webxml: Reference stylesheet from Nmap.Org for more portable XML

14  --no-stylesheet: Prevent associating of XSL stylesheet w/XML output


MISC:



1.  -6: Enable IPv6 scanning

2.  -A: Enable OS detection, version detection, script scanning, and traceroute

3.  --datadir <dirname>: Specify custom Nmap data file location

4.  --send-eth/--send-ip: Send using raw ethernet frames or IP packets

5.  --privileged: Assume that the user is fully privileged

6.  --unprivileged: Assume the user lacks raw socket privileges

7.  -V: Print version number

8.  -h: Print this help summary page.

           That's all about the cool NMAP  and thanks for reading :)

No comments:

Post a Comment