Nmap and Network Scanning

Nmap and network scanning represent a foundational aspect of cybersecurity reconnaissance, involving the process of actively probing a computer network to discover hosts, identify open ports, and enumerate the services and operating systems running on them. Nmap (Network Mapper) is the industry-standard, open-source tool used to perform these scans, offering a powerful and versatile set of techniques for mapping network topologies and gathering intelligence. This information is invaluable for both network administrators conducting security audits and penetration testers identifying vulnerabilities, as well as for malicious attackers who use it as a preliminary step to find potential targets and plan their attacks.

  1. Fundamentals of Network Communication
    1. The OSI Model
      1. Overview and Purpose of the OSI Model
        1. Layer 1: Physical
          1. Physical Media Types
            1. Copper Cables
              1. Fiber Optic Cables
                1. Wireless Media
                2. Network Topologies
                  1. Bus Topology
                    1. Star Topology
                      1. Ring Topology
                        1. Mesh Topology
                        2. Signal Transmission Methods
                          1. Electrical Signals
                            1. Optical Signals
                              1. Radio Frequency Signals
                            2. Layer 3: Network
                              1. IP Addressing
                                1. IPv4 Address Structure
                                  1. IPv6 Address Structure
                                  2. Routing Concepts
                                    1. Static Routing
                                      1. Dynamic Routing
                                        1. Default Gateway
                                        2. Routers and Layer 3 Devices
                                          1. Router Functions
                                            1. Layer 3 Switches
                                            2. Subnetting and Supernetting
                                              1. Subnet Masks
                                                1. VLSM
                                                  1. Route Summarization
                                                2. Layer 4: Transport
                                                  1. TCP vs UDP
                                                    1. Connection-Oriented vs Connectionless
                                                      1. Reliability Mechanisms
                                                      2. Ports and Sockets
                                                        1. Port Number Ranges
                                                          1. Socket Pairs
                                                          2. Flow Control and Congestion Control
                                                            1. TCP Window Size
                                                              1. Congestion Avoidance
                                                            2. Layer 5: Session
                                                              1. Session Establishment and Termination
                                                                1. Session Management Protocols
                                                                  1. NetBIOS
                                                                    1. RPC
                                                                  2. Layer 6: Presentation
                                                                    1. Data Encoding and Encryption
                                                                      1. Character Encoding
                                                                        1. SSL/TLS
                                                                        2. Data Compression
                                                                          1. Lossless Compression
                                                                            1. Lossy Compression
                                                                          2. Layer 7: Application
                                                                            1. Application Protocols
                                                                              1. HTTP/HTTPS
                                                                                1. FTP/SFTP
                                                                                  1. SMTP/POP3/IMAP
                                                                                    1. DNS
                                                                                      1. DHCP
                                                                                      2. Client-Server Model
                                                                                        1. Request-Response Pattern
                                                                                          1. Stateful vs Stateless
                                                                                      3. The TCP/IP Model
                                                                                        1. Comparison with OSI Model
                                                                                          1. Layer Mapping
                                                                                            1. Practical Implementation
                                                                                            2. Network Interface Layer
                                                                                              1. Ethernet and Wi-Fi
                                                                                                1. Ethernet Standards
                                                                                                  1. Wi-Fi Standards
                                                                                                  2. ARP Protocol
                                                                                                    1. ARP Request and Reply
                                                                                                      1. ARP Cache
                                                                                                        1. Gratuitous ARP
                                                                                                      2. Internet Layer
                                                                                                        1. IP Addressing
                                                                                                          1. IPv4 Addressing
                                                                                                            1. IPv6 Addressing
                                                                                                            2. Routing Protocols
                                                                                                              1. RIP
                                                                                                                1. OSPF
                                                                                                                  1. BGP
                                                                                                                    1. EIGRP
                                                                                                                    2. ICMP Protocol
                                                                                                                      1. Error Reporting
                                                                                                                        1. Diagnostic Functions
                                                                                                                      2. Transport Layer
                                                                                                                        1. TCP Functions
                                                                                                                          1. Reliable Delivery
                                                                                                                            1. Sequence Numbers
                                                                                                                              1. Acknowledgments
                                                                                                                              2. UDP Functions
                                                                                                                                1. Unreliable Delivery
                                                                                                                                  1. Minimal Overhead
                                                                                                                                  2. Port Numbers
                                                                                                                                    1. Well-Known Ports
                                                                                                                                      1. Registered Ports
                                                                                                                                        1. Dynamic Ports
                                                                                                                                      2. Application Layer
                                                                                                                                        1. Common Application Protocols
                                                                                                                                          1. Web Protocols
                                                                                                                                            1. Email Protocols
                                                                                                                                              1. File Transfer Protocols
                                                                                                                                              2. DNS and Name Resolution
                                                                                                                                                1. DNS Hierarchy
                                                                                                                                                  1. DNS Record Types
                                                                                                                                                    1. Name Resolution Process
                                                                                                                                                2. Core Protocols
                                                                                                                                                  1. Internet Protocol (IP)
                                                                                                                                                    1. IPv4 Addressing and Subnetting
                                                                                                                                                      1. Address Classes
                                                                                                                                                        1. Class A
                                                                                                                                                          1. Class B
                                                                                                                                                            1. Class C
                                                                                                                                                              1. Class D
                                                                                                                                                                1. Class E
                                                                                                                                                                2. Subnet Masks
                                                                                                                                                                  1. Default Subnet Masks
                                                                                                                                                                    1. Custom Subnet Masks
                                                                                                                                                                    2. CIDR Notation
                                                                                                                                                                      1. Prefix Length
                                                                                                                                                                        1. Network and Host Portions
                                                                                                                                                                        2. Private vs Public Addresses
                                                                                                                                                                          1. RFC 1918 Private Ranges
                                                                                                                                                                            1. NAT and PAT
                                                                                                                                                                          2. IPv6 Addressing
                                                                                                                                                                            1. Address Structure
                                                                                                                                                                              1. 128-bit Address Space
                                                                                                                                                                                1. Hexadecimal Notation
                                                                                                                                                                                2. Prefixes and Notation
                                                                                                                                                                                  1. Global Unicast
                                                                                                                                                                                    1. Multicast
                                                                                                                                                                                    2. Transition Mechanisms
                                                                                                                                                                                      1. Dual Stack
                                                                                                                                                                                        1. Tunneling
                                                                                                                                                                                          1. Translation
                                                                                                                                                                                      2. Transmission Control Protocol (TCP)
                                                                                                                                                                                        1. The Three-Way Handshake
                                                                                                                                                                                          1. SYN Packet
                                                                                                                                                                                            1. SYN-ACK Packet
                                                                                                                                                                                              1. ACK Packet
                                                                                                                                                                                                1. Initial Sequence Numbers
                                                                                                                                                                                                2. TCP Flags
                                                                                                                                                                                                  1. SYN Flag
                                                                                                                                                                                                    1. ACK Flag
                                                                                                                                                                                                      1. FIN Flag
                                                                                                                                                                                                        1. RST Flag
                                                                                                                                                                                                          1. PSH Flag
                                                                                                                                                                                                            1. URG Flag
                                                                                                                                                                                                              1. ECE Flag
                                                                                                                                                                                                                1. CWR Flag
                                                                                                                                                                                                                2. Connection Termination
                                                                                                                                                                                                                  1. Four-Way Handshake
                                                                                                                                                                                                                    1. FIN-ACK Sequence
                                                                                                                                                                                                                      1. TIME_WAIT State
                                                                                                                                                                                                                        1. Connection Reset
                                                                                                                                                                                                                        2. TCP State Machine
                                                                                                                                                                                                                          1. LISTEN
                                                                                                                                                                                                                            1. SYN_SENT
                                                                                                                                                                                                                              1. SYN_RECEIVED
                                                                                                                                                                                                                                1. ESTABLISHED
                                                                                                                                                                                                                                  1. FIN_WAIT_1
                                                                                                                                                                                                                                    1. FIN_WAIT_2
                                                                                                                                                                                                                                      1. CLOSE_WAIT
                                                                                                                                                                                                                                        1. CLOSING
                                                                                                                                                                                                                                          1. LAST_ACK
                                                                                                                                                                                                                                            1. TIME_WAIT
                                                                                                                                                                                                                                              1. CLOSED
                                                                                                                                                                                                                                            2. User Datagram Protocol (UDP)
                                                                                                                                                                                                                                              1. Connectionless Communication
                                                                                                                                                                                                                                                1. No Connection Setup
                                                                                                                                                                                                                                                  1. No Connection State
                                                                                                                                                                                                                                                  2. UDP Header Structure
                                                                                                                                                                                                                                                    1. Source Port
                                                                                                                                                                                                                                                      1. Destination Port
                                                                                                                                                                                                                                                        1. Length
                                                                                                                                                                                                                                                          1. Checksum
                                                                                                                                                                                                                                                          2. Use Cases and Limitations
                                                                                                                                                                                                                                                            1. Real-Time Applications
                                                                                                                                                                                                                                                              1. DNS Queries
                                                                                                                                                                                                                                                                1. DHCP
                                                                                                                                                                                                                                                                  1. Streaming Media
                                                                                                                                                                                                                                                                2. Internet Control Message Protocol (ICMP)
                                                                                                                                                                                                                                                                  1. Echo Request and Reply
                                                                                                                                                                                                                                                                    1. Ping Functionality
                                                                                                                                                                                                                                                                      1. Payload Structure
                                                                                                                                                                                                                                                                      2. Destination Unreachable Messages
                                                                                                                                                                                                                                                                        1. Network Unreachable
                                                                                                                                                                                                                                                                          1. Host Unreachable
                                                                                                                                                                                                                                                                            1. Port Unreachable
                                                                                                                                                                                                                                                                              1. Protocol Unreachable
                                                                                                                                                                                                                                                                              2. Time Exceeded Messages
                                                                                                                                                                                                                                                                                1. TTL Exceeded
                                                                                                                                                                                                                                                                                  1. Fragment Reassembly Timeout
                                                                                                                                                                                                                                                                                  2. Redirect Messages
                                                                                                                                                                                                                                                                                    1. Host Redirect
                                                                                                                                                                                                                                                                                      1. Network Redirect
                                                                                                                                                                                                                                                                                      2. Parameter Problem Messages
                                                                                                                                                                                                                                                                                        1. Source Quench Messages
                                                                                                                                                                                                                                                                                      3. Ports and Services
                                                                                                                                                                                                                                                                                        1. Well-Known Ports (0-1023)
                                                                                                                                                                                                                                                                                          1. System Ports
                                                                                                                                                                                                                                                                                            1. Common Services
                                                                                                                                                                                                                                                                                              1. HTTP (80)
                                                                                                                                                                                                                                                                                                1. HTTPS (443)
                                                                                                                                                                                                                                                                                                  1. FTP (21)
                                                                                                                                                                                                                                                                                                    1. SSH (22)
                                                                                                                                                                                                                                                                                                      1. Telnet (23)
                                                                                                                                                                                                                                                                                                        1. SMTP (25)
                                                                                                                                                                                                                                                                                                          1. DNS (53)
                                                                                                                                                                                                                                                                                                            1. DHCP (67/68)
                                                                                                                                                                                                                                                                                                              1. TFTP (69)
                                                                                                                                                                                                                                                                                                                1. POP3 (110)
                                                                                                                                                                                                                                                                                                                  1. IMAP (143)
                                                                                                                                                                                                                                                                                                                    1. SNMP (161)
                                                                                                                                                                                                                                                                                                                  2. Registered Ports (1024-49151)
                                                                                                                                                                                                                                                                                                                    1. Application-Specific Services
                                                                                                                                                                                                                                                                                                                      1. Vendor-Specific Ports
                                                                                                                                                                                                                                                                                                                        1. Database Ports
                                                                                                                                                                                                                                                                                                                          1. MySQL (3306)
                                                                                                                                                                                                                                                                                                                            1. PostgreSQL (5432)
                                                                                                                                                                                                                                                                                                                              1. Oracle (1521)
                                                                                                                                                                                                                                                                                                                            2. Dynamic/Private Ports (49152-65535)
                                                                                                                                                                                                                                                                                                                              1. Ephemeral Ports
                                                                                                                                                                                                                                                                                                                                1. Client-Side Connections
                                                                                                                                                                                                                                                                                                                                  1. Operating System Allocation
                                                                                                                                                                                                                                                                                                                                  2. Port States
                                                                                                                                                                                                                                                                                                                                    1. Open
                                                                                                                                                                                                                                                                                                                                      1. Service Listening
                                                                                                                                                                                                                                                                                                                                        1. Accepting Connections
                                                                                                                                                                                                                                                                                                                                        2. Closed
                                                                                                                                                                                                                                                                                                                                          1. No Service Listening
                                                                                                                                                                                                                                                                                                                                            1. Port Accessible
                                                                                                                                                                                                                                                                                                                                            2. Filtered
                                                                                                                                                                                                                                                                                                                                              1. Firewall Blocking
                                                                                                                                                                                                                                                                                                                                                1. No Response Received
                                                                                                                                                                                                                                                                                                                                                2. Unfiltered
                                                                                                                                                                                                                                                                                                                                                  1. Port Accessible
                                                                                                                                                                                                                                                                                                                                                    1. State Undetermined
                                                                                                                                                                                                                                                                                                                                                    2. Open|Filtered
                                                                                                                                                                                                                                                                                                                                                      1. Ambiguous Response
                                                                                                                                                                                                                                                                                                                                                        1. UDP Scan Results
                                                                                                                                                                                                                                                                                                                                                        2. Closed|Filtered
                                                                                                                                                                                                                                                                                                                                                          1. ICMP Unreachable
                                                                                                                                                                                                                                                                                                                                                            1. Filtered Response
                                                                                                                                                                                                                                                                                                                                                          2. Port Scanning Concepts
                                                                                                                                                                                                                                                                                                                                                            1. TCP vs UDP Ports
                                                                                                                                                                                                                                                                                                                                                              1. Connection-Based vs Connectionless
                                                                                                                                                                                                                                                                                                                                                                1. Response Patterns
                                                                                                                                                                                                                                                                                                                                                                2. Service Identification
                                                                                                                                                                                                                                                                                                                                                                  1. Service Fingerprinting
                                                                                                                                                                                                                                                                                                                                                                    1. Version Detection