Skip to content

Aliu2211/Nmap-Scapy-Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Nmap & Scapy Lab Documentation

Nmap Scapy Status License

Practical lab documentation covering network reconnaissance with Nmap and packet analysis with Scapy, completed as part of ParoCyber Ethical Hacking Training.


πŸ“‹ Table of Contents


🎯 Objectives

The objectives of this lab are to:

  1. Understand network reconnaissance using Nmap for host discovery, port scanning, and service enumeration
  2. Learn OS fingerprinting techniques to identify target operating systems
  3. Explore SMB enumeration and understand common Windows network vulnerabilities
  4. Capture network traffic using tcpdump and analyze with Wireshark
  5. Master Scapy for packet sniffing, crafting, and protocol analysis

πŸ–₯️ Lab Environment

Component Details
Attacker Machine Kali Linux
Target Network 10.6.6.0/24
Target Host 10.6.6.23
Network Interface eth0, br-internal
Tools Used Nmap, Scapy, Tcpdump, Wireshark, SMBClient

πŸ”Ž Part 1: Nmap Reconnaissance

1. Host Discovery

Command:

nmap -sn 10.6.6.0/24

Explanation:

  • -sn β€” Ping scan (disables port scan)
  • 10.6.6.0/24 β€” Target subnet (256 hosts)
  • Discovers live hosts on the network without scanning ports
  • Useful for initial reconnaissance to identify active targets

Screenshot:

Host Discovery


2. OS Detection

Command:

sudo nmap -O 10.6.6.23

Explanation:

  • -O β€” Enable OS detection
  • sudo β€” Required for raw socket access
  • Uses TCP/IP stack fingerprinting to identify the target's operating system
  • Compares responses against Nmap's database of known OS signatures

Screenshot:

OS Detection


3. Service Version Detection

Command:

nmap -p21 -sV -A -T4 10.6.6.23

Explanation:

  • -p21 β€” Scan port 21 (FTP)
  • -sV β€” Probe open ports to determine service/version info
  • -A β€” Aggressive scan (OS detection, version detection, script scanning, traceroute)
  • -T4 β€” Timing template (faster execution)

Screenshot:

Service Detection


4. SMB Enumeration

Commands:

nmap -A -p139,445 10.6.6.23
nmap --script smb-enum-shares.nse -p445 10.6.6.23

Explanation:

  • -p139,445 β€” Target SMB ports (NetBIOS and SMB direct)
  • --script smb-enum-shares.nse β€” Nmap script to enumerate SMB shares
  • SMB (Server Message Block) is commonly used for file sharing on Windows networks
  • Enumeration reveals available shares, permissions, and potential attack vectors

Screenshot:

SMB Enumeration-1

SMB Enumeration-2


5. SMB Client Connection

Command:

smbclient //10.6.6.23/print$ -N

Explanation:

  • smbclient β€” Command-line SMB client
  • //10.6.6.23/print$ β€” Target share (print$ is a default Windows printer share)
  • -N β€” No password (null session)
  • Type exit to close the shell

Screenshot:

SMB Client


🌐 Part 2: Network Configuration

These commands help understand the network environment:

Command 1: View Network Interfaces

ifconfig
  • Displays IP addresses, MAC addresses, and interface statistics

Command 2: View Routing Table

ip route
  • Shows the routing table and default gateway

Command 3: View DNS Configuration

cat /etc/resolv.conf
  • Displays configured DNS servers

Screenshot:

Network Config-1

Network Config-2

Network Config-3

πŸ“‘ Part 3: Packet Capture with Tcpdump

Command:

sudo tcpdump -i eth0 -s 0 -w ladies.pcap

Explanation:

  • -i eth0 β€” Capture on eth0 interface
  • -s 0 β€” Capture full packets (no truncation)
  • -w ladies.pcap β€” Write output to pcap file
  • Press Ctrl + C to stop capture

Verify Capture:

ls ladies.pcap

Open in Wireshark:

wireshark ladies.pcap

Screenshot:

Tcpdump Capture-1 Tcpdump Capture-2

🐍 Part 4: Scapy Packet Analysis

Starting Scapy

sudo su
scapy

Scapy requires root privileges for raw socket access.


1. Basic Sniffing

Commands:

# Start sniffing (captures all traffic)
sniff()

# In another terminal, generate traffic:
# ping google.com

# Stop sniffing with Ctrl + C

# Store captured packets
paro = _

# View summary
paro.summary()

Explanation:

  • sniff() β€” Captures packets on the default interface
  • _ β€” Stores the last result in Scapy
  • .summary() β€” Displays a summary of captured packets

Screenshot:

Scapy Basic


2. Interface-Specific Sniffing

Commands:

# Sniff on specific interface
sniff(iface="br-internal")

# Generate traffic:
# ping 10.6.6.1
# Open browser: http://10.6.6.23

# Stop with Ctrl + C

# Store and analyze
paro2 = _
paro2.summary()

Explanation:

  • iface="br-internal" β€” Specifies the network interface to sniff on
  • Captures traffic only on the internal bridge network

Screenshot:

Scapy Interface


3. Filtered Packet Capture

Commands:

# Capture only ICMP packets, limit to 5
sniff(iface="br-internal", filter="icmp", count=5)

# In another terminal:
# ping 10.6.6.23

# Stop when 5 packets captured

# Store and analyze
paro3 = _
paro3.summary()

# View specific packet (4th packet)
paro3[3]

Explanation:

  • filter="icmp" β€” BPF filter to capture only ICMP (ping) packets
  • count=5 β€” Stop after capturing 5 packets
  • paro3[3] β€” Access individual packets by index (0-based)

Screenshot:

Scapy Filtered


πŸ’‘ Key Learnings

Nmap Insights

  • Host discovery is the first step in any penetration test
  • Service enumeration reveals potential attack vectors
  • NSE scripts extend Nmap's capabilities for specific tasks
  • SMB enumeration is critical for Windows network assessments

Scapy Insights

  • Powerful Python-based tool for packet manipulation
  • Can sniff, craft, send, and analyze packets
  • BPF filters allow targeted packet capture
  • Essential for understanding network protocols at a low level

Real-World Applications

  • Network security assessments β€” Identify vulnerabilities before attackers do
  • Incident response β€” Analyze captured traffic during security incidents
  • Penetration testing β€” Reconnaissance phase of ethical hacking engagements
  • Network troubleshooting β€” Diagnose connectivity and protocol issues

πŸ“š References


πŸ‘€ Author

Aliu Tijani
Ethical Hacking Student | ParoCyber Training Program

LinkedIn GitHub


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Created as part of ParoCyber Ethical Hacking Training β€” December 2025

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors