Ports, Protocols & Deep Packet Inspection Engine
From the application socket and 5-tuple down to Layer 2 Ethernet frames, transport state machines, Wireshark conversation forensics, and role-aligned operations across SOC, VAPT, Threat Hunting, Firewall Engineering, and Compliance.
What actually happens when an application communicates? An application does not speak raw electrical pulses or direct fibers. It opens a socketโthe communication doorway managed by the operating system kernel.
1. Communication Stack & Kernel Abstraction
โ (POSIX socket() syscall / WinSock2 WSAStartup)
โผ
Socket File Descriptor (Kernel OS data structure)
โโโ Local Endpoint: 192.168.1.10:51542 (Ephemeral allocation)
โโโ Remote Endpoint: 93.184.216.34:443 (Target port & IP)
โโโ Protocol Family: AF_INET / AF_INET6, SOCK_STREAM / SOCK_DGRAM
โ
โผ
Kernel TCP/IP Network Stack (Ring Buffers, TCP Congestion Engine, Routing Table)
โ
โผ
Network Interface Controller (NIC) Driver โ DMA โ PHY Transceiver โ Wire
2. Interactive Socket Creation Simulator
Trigger an application request to inspect the live socket creation in kernel space:
Every IP session across the internet is uniquely identified by the 5-Tuple. Firewalls, NetFlow, SIEMs, Wireshark, and IDSs rely on this exact construct to track state and enforce security policy.
Interactive 5-Tuple Inspector
Socket Direction, State & Flow Tracking
When the server replies, the Source and Destination reverse: Server 142.250.72.14:443 becomes Source, and Client 10.10.20.15:51542 becomes Destination. The OS matches the incoming segment against its active socket table.
A junior tester assumes port 443 is always HTTPS and port 53 is always DNS. A senior analyst knows a port is merely a numeric index. Any protocol can run on any port, and any application can bind to any unreserved port.
Port Range Breakdown
- 0 โ 1023: Well-Known / System Ports (Root/Admin privilege required on Unix)
- 1024 โ 49151: Registered User Ports (IANA designated services)
- 49152 โ 65535: Dynamic / Ephemeral Ports (Client-side temporary allocation)
Multi-Use Port Demystifier
โข HTTP/3 (QUIC / UDP 443)
โข OpenVPN / Shadowsocks / Tor Bridges
โข C2 Reverse Shells (bypassing egress filters)
Interactive Port Lookup & Deception
TCP provides reliability, connection state, sequencing, flow control, and retransmissions. UDP provides raw, stateless, low-latency datagram transmission with zero overhead.
1. TCP 3-Way Handshake & State Simulation
CLIENT
10.10.20.15
SERVER
10.10.20.10
2. TCP Header Flags & Flow Control Matrix
When data leaves an application, each layer prepends its control header (Encapsulation). When the NIC receives raw bits, it strips headers layer-by-layer up to the application (Decapsulation).
Interactive Encapsulation Pipeline
Ethernet II frames encapsulate network packets across physical LAN segments. Inspect the exact byte structure:
IPv4 headers contain 14 distinct fields; IPv6 streamlines this with a fixed 40-byte base header:
Ident=0x41f2 | Flags=0x02 (DF - Don't Fragment) | TTL=64
Protocol=6 (TCP) | Header Checksum=0x83e1 | Src=10.10.20.15 | Dst=10.10.20.10
IPv6 Header: Version=6 | Traffic Class=0 | Flow Label=0x12a9
Payload Len=20B | Next Header=6 (TCP) | Hop Limit=64
How does an IP find its MAC address on the local wire? ARP Request ("Who has 10.10.20.1?") broadcasts to FF:FF:FF:FF:FF:FF; ARP Reply answers unicast.
DNS is not just port 53. It is a hierarchical record query system (A, AAAA, TXT, MX, CNAME, PTR, NS) prone to tunneling and amplification.
Dissect HTTP requests, status codes (200, 302, 401, 403, 500), headers, cookies, and cleartext credential exposures:
Encryption does not make traffic invisible. Even in TLS 1.3, network analysts inspect ClientHello, SNI (Server Name Indication), cipher suites, certs, packet sizes, and flow timing.
Discover โ Offer โ Request โ Ack (UDP 67/68). Rogue DHCP servers can inject malicious default gateways to execute Man-In-The-Middle attacks.
Type 8 (Echo Request), Type 0 (Echo Reply), Type 3 (Unreachable), Type 11 (TTL Exceeded). Attackers leverage ICMP data payloads for stealth exfiltration.
TCP 445: Session Setup โ Tree Connect โ Admin$ / C$. Correlating unexpected internal SMB connections is the primary indicator of ransomware spreading.
Experience the real 3-pane Wireshark workflow: Packet List, Packet Details Tree, and Raw Packet Hex/ASCII Bytes with live display filter evaluation.
| No. | Time | Source | Destination | Protocol | Length | Info |
|---|
A packet is isolated; Follow TCP Stream reassembles the full bidirectional conversation payload as the client and server saw it.
Distinguish between normal connection state, packet loss, duplicate ACKs, out-of-order delivery, and RST resets:
1. Protocol Hierarchy
โพ Ethernet II (100%)
โพ IPv4 (94.2% / 1,396 pkts)
โโโ TCP (82.1% / 1,217 pkts)
โ โโโ TLS (68.4%)
โ โโโ HTTP (13.7%)
โโโ UDP (12.1% / 179 pkts)
โโโ DNS (12.1%)
2. Expert Information Flags
[WARN] TCP Spurious Retransmission
[WARN] Suspected Duplicate ACK (x3)
[NOTE] TLS Handshake SNI: login.finbank.training
[CHAT] HTTP 200 OK Response
3. Protocol Abuse Detector
Identifies high-entropy DNS queries, C2 periodic beacons, and bulk SMB exfiltration:
Every packet decision drives real security outcomes. Select a cybersecurity role below to execute specialized workflows:
SIEM Alert Log & Triage (SLA: 15 Minutes)
Host 10.10.20.15 accepted inbound TCP connection on non-standard port 4444 from external IP 185.44.21.8 followed by interactive shell traffic.
Triage Log
Nmap Port Scanner & Banner Grabbing
Vulnerability & CVE Mapping
Stateful ACL Rule Generator
Active Firewall Rulebase
Rule 2: DENY ANY ANY (Default Egress)
MITRE ATT&CK Mapping & Sigma Rule Generator
โข T1071.004: DNS Exfiltration (High query volume)
โข T1571: Non-Standard Port Communication (TCP/8443, 4444)
โข T1046: Network Service Discovery (SYN Sweeps)
Sigma Detection Rule
Regulatory & Framework Compliance Auditor
โข NIST SP 800-53 CM-7: Least Functionality โ Disable all unapproved ports, protocols, and services.
โข ISO/IEC 27001:2022 A.8.20: Network Security controls.
Compliance Gap Report
RangeForce-style timed incident response. Analyze the active packet stream, identify the attacking port/protocol, and enforce containment before SLA expiration.
MISSION 01: Critical Ransomware SMB Propagation
Host 10.10.20.15 is scanning the entire 10.10.20.0/24 subnet on TCP 445 (SMB) with high packet velocity. What is the immediate containment action?
Analyze the entire capture file enterprise_breach.pcap and produce the root-cause incident report answering all 10 core triage questions: