How erdogancayir/ft_nmap works
Project type and purpose
• This is a command-line, open-source network port scanner implemented in C (ft_nmap), inspired by nmap.
• Its purpose is to perform multiple TCP/UDP scan types, capture and analyze packets in real time using libpcap, and report port and service information.
File structure
• Top-level files:
• Makefile – build rules
• README.md – usage, features, architecture
• ip_targets.txt – sample target list
• inc/ – public headers defining data structures (job_queue, scan_config, scan_result, scan_type, tcp, udp)
• src/cli/ – command-line parsing and config freeing
• src/debug_files/ – helpers to dump internal config, jobs, results, packets
• src/main.c – program entry point
• src/network/ – raw-socket actions and banner grabbing (address resolution, source IP selection, OS guess, send TCP/UDP)
• src/pcap/ – packet capture/sniffer thread and packet handlers (ICMP/TCP/UDP), result aggregation
• src/worker_thread_pool/ – thread-pool implementation (job queue, worker threads, thread pool startup)
README’s architecture section
• Core components: Job Queue, Packet Capture, Scanning Engine
• Threading model: Main thread (producer), Worker threads (consumers), Sniffer thread
Key elements to capture in detail
• Separation of concerns: CLI vs. Engine vs. Capture vs. Results
• Threading boundaries: which code runs in main, workers, sniffer
• Producer-consumer interactions and synchronization (mutexes/conds implied)
• Where packet crafting occurs vs. where packet parsing occurs