Day 39: Network Mapping & Port Scanning with Nmap

2025-02-11

Just finished diving into network mapping and port scanning with Nmap—tools every pentester needs in their arsenal. Understanding how networks communicate is foundational to securing them.

Key Takeaways:

  • Network Mapping: Identifies potential entry points in a network.
  • Port Scanning: Detects open ports, running services, and performs OS fingerprinting.
  • Optimization: Experimented with optimizing scan speeds and evading firewalls.

Practical Commands and Codes:

1. Basic Nmap Scan:

nmap -sP 192.168.1.0/24

This command performs a ping scan to identify live hosts on the network.

2. Port Scanning:

nmap -sV 192.168.1.1

This command scans for open ports and identifies the services running on them.

3. OS Fingerprinting:

nmap -O 192.168.1.1

This command attempts to determine the operating system of the target host.

4. Aggressive Scan:

nmap -A 192.168.1.1

This command enables OS detection, version detection, script scanning, and traceroute.

5. Evading Firewalls:

nmap -f 192.168.1.1

This command fragments the packets, making it harder for firewalls to detect the scan.

6. Timing and Performance:

nmap -T4 192.168.1.1

This command sets the timing template to aggressive for faster scans.

What Undercode Say:

Network mapping and port scanning are essential skills for any cybersecurity professional. By understanding how to use tools like Nmap, you can identify vulnerabilities in your network before attackers do. Here are some additional Linux commands and techniques to enhance your network security skills:

  • tcpdump: A powerful command-line packet analyzer.
    tcpdump -i eth0
    

This command captures packets on the eth0 interface.

  • netstat: Displays network connections, routing tables, and interface statistics.
    netstat -tuln
    

This command lists all listening ports.

  • iptables: A user-space utility program for configuring the IP packet filter rules of the Linux kernel firewall.
    iptables -L -v -n
    

This command lists all active firewall rules.

  • ssh: Secure Shell for remote login and other secure network services.
    ssh [email protected]
    

This command connects to a remote host securely.

  • wireshark: A network protocol analyzer that lets you capture and interactively browse the traffic running on a computer network.
    wireshark
    

This command launches the Wireshark GUI.

  • ncat: A versatile networking utility which reads and writes data across networks from the command line.
    ncat -l 8080
    

This command listens on port 8080.

  • hping3: A network tool able to send custom TCP/IP packets and display target replies.
    hping3 -S -p 80 192.168.1.1
    

    This command sends SYN packets to port 80 of the target.

  • arp-scan: A command-line tool for network discovery and fingerprinting.

    arp-scan --localnet
    

This command scans the local network for devices.

  • dig: A network administration command-line tool for querying DNS name servers.
    dig example.com
    

This command queries DNS information for example.com.

  • nslookup: A network administration command-line tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping.
    nslookup example.com
    

This command queries DNS information for example.com.

By mastering these commands and techniques, you can significantly enhance your ability to secure and analyze networks. Remember, the key to effective cybersecurity is continuous learning and practice. For more advanced techniques and tools, consider exploring resources like the Nmap documentation (https://nmap.org/book/) and the Linux man pages.

Stay curious, keep experimenting, and always prioritize ethical hacking practices. The more you understand your network, the better you can protect it from potential threats. Happy hacking!

References:

Hackers Feeds, Undercode AIFeatured Image

Scroll to Top