01. Mapping a Network
Purpose¶
Mapping a network involves discovering and documenting all devices, their connections, and the associated services on a network.
- Purpose:
- Identify active hosts and devices.
- Detect vulnerabilities and misconfigurations.
- Aid in troubleshooting and planning for network security.
Scope¶
- Define the boundaries of the network to be mapped (e.g., IP range, specific subnets).
- Ensure legal and authorized access before performing network mapping.
Discovery¶
Network discovery involves identifying all devices, services, and connections within the defined scope.
Process¶
1. Physical Access¶
- Gaining access to the physical infrastructure of the network.
- Methods:
- Physical Security: Access routers, switches, or access points.
- OSINT (Open Source Intelligence): Gather public information about the target organization.
- Social Engineering: Trick personnel to gain access or gather information.
2. Sniffing¶
- Monitoring network traffic to collect data about connected devices and services.
- Types:
- Passive Reconnaissance: Collect data without interacting with the network.
- Watch Network Traffic: Use tools like Wireshark to monitor data packets.
Tool:
Wireshark
- Graphical tool to capture and analyze network traffic.
-
Command to Start:
3. ARP (Address Resolution Protocol)¶
- Arp-Scan maps IP addresses to MAC addresses on a local network.
-
Command:
Explanation: -
-l: Scans the local network.
Example:
-I eth0: Specifies the network interface.-g 192.168.0.1/24: Specifies the subnet.
Output:
Lists all devices on the subnet with their IP and MAC addresses.
4. ICMP (Internet Control Message Protocol)¶
- Used to check connectivity and trace paths between devices.
Commands:
-
Ping:
Sends ICMP echo requests to check if a device is active.Output:
- Replies from the target indicate it's reachable.
- Trace Route:
Tracks the path packets take to reach a target.
-
Fping:
Efficiently scans multiple IPs in a subnet.Explanation:
-g: Scans the subnet range.-a: Displays only reachable hosts.
Example (Silent Output):
Redirects errors to /dev/null to suppress unnecessary output.
Tools and Commands¶
1. Nmap for Discovery¶
Command:
Explanation:
-sn: Ping scan to discover active hosts without scanning ports.
Example:
Output:
Lists all reachable devices in the specified subnet.
Practical Workflow Example¶
-
Identify Active Hosts:
Result: Lists IPs of live devices.
-
Map IP to MAC Addresses:
Result: Displays MAC addresses of devices on the network.
-
Verify Device Connectivity:
Result: Identifies reachable devices silently.
-
Capture Network Traffic:
Start Wireshark to analyze network packets: -
Monitor Specific Device Traffic:
Use a filter in Wireshark (e.g.,ip.addr == 192.168.0.5).
Key Points¶
- ARP: Resolves IP to MAC, crucial for local network mapping.
- ICMP: Detects active hosts and provides route information.
- Tools: Combine tools like Wireshark, Nmap, ARP-Scan, and Fping for efficient discovery.
- Ethical Usage: Always perform network mapping with proper authorization.
These steps and tools ensure efficient network mapping for security analysis, troubleshooting, and documentation.