본문으로 건너뛰기

kirin@pwnlab:~/projects$cat pcap-tcp-sniffer.md

PCAP TCP Sniffer

Projects

date
2026-07-11
tags
network, c

A network security exercise focused on computing in C what Wireshark shows automatically.

Ethernet Header -> IPv4 Header -> TCP Header -> Payload
  • Live capture filtered to TCP with a BPF tcp expression
  • Prints source/destination MAC, IP and port
  • Handles variable-length headers using IPv4 IHL and TCP Data Offset
  • Shows up to 1024 bytes of plaintext payload
  • Defensive parsing that skips truncated packets and invalid header lengths

Code and report are in the repository.