Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing and Using nmap for Port Scanning

Tech 1

Installation

Visit nmap.org for the official download page.

During installation, ensure all options are selected. This includes installing the packet capture driver (npcap) and setting up enviroment variables automatically.

To verify installation:

Open Command Prompt and run nmap. If successful, the tool is ready for use.

Common Scan Types

TCP Connect Scan (-sT)

This method establishes a full TCP connection to determine port status.

nmap -sT target_host

It's less stealthy and slower compared to other methods.

Multiple hosts can be scanned simultaneously by listing them:

nmap host1.com host2.com
nmap 192.168.0.1 192.168.0.2
nmap 192.168.0.1,2
nmap -sL list.txt

Scanning an entire subnet like 192.168.0.* is also possible but takes considerable time.

SYN Scan (-sS)

This scan sends a SYN packet and waits for a response. It avoids completing the TCP handshake, making it faster and more discreet.

nmap -sS target_host

It requires root privileges and is generally preferred due to its efficiency and reduced detection risk.

UDP Scan (-sU)

Used to identify open UDP ports on a target system.

nmap -sU target_host

UDP scan are typically slower and may reveal running services.

IP Protocol Scan (-sO)

Determines wich IP protocols are supported by the target.

nmap -sO target_host

OS Detection (-O)

Identifies the operating system of the target machine.

nmap -O target_host

Firewall Evasion Techniques

These options help bypass firewalls or IDS systems:

-f: Fragment packets
--mtu <value>: Set maximum transmission unit
-D <decoy1,decoy2,...>: Use decoys to obscure scan origin
-S <IP>: Spoof source IP address
-e <interface>: Specify network interface
-g <port>: Set source port for scanning
--data-string <string>: Append custom ASCII string
--data-length <num>: Append random data

Advanced Usage

nmap -Pn target_host          # Skip ping checks
nmap -sl zombie_ip target_ip  # Zombie scan using a zombie host
nmap -sA target_host          # ACK scan to detect filtered ports
nmap target_host -p 80        # Scan specific port
nmap 192.168.78.1/24          # Scan entire subnet
nmap target_host -oX result.xml # Save output in XML format
nmap -T1-6 target_host        # Adjust scan speed (T4 is default)

nmap -sV target_host          # Service version detection
nmap -sC script_file target_host # Run NSE scripts
nmap -A target_host           # Aggressive scan mode
nmap -6 ipv6_address          # IPv6 scanning
nmap -f target_host           # Fragment packets
nmap --mtu 128 target_host    # Set MTU size
nmap -D rand,target_host      # Use decoys
nmap --source-port 53 target_host # Use specific source port
nmap --data-length 100 target_host # Modify packet length
nmap -v target_host           # Verbose output
nmap -sn target_host          # Ping scan only
nmap -sP target_host          # Host discovery only
nmap -n -p 80 target_host     # No DNS resolution, scan port 80
nmap --system-dns target_host # Use system DNS
nmap --traceroute target_host # Trace route to target
nmap -PE target_host          # ICMP echo scan
nmap -PP target_host          # ICMP timestamp scan
nmap -PM target_host          # ICMP netmask scan
nmap -iR 10                   # Randomly scan 10 hosts
Tags: nmap

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.