How vkerob/ft_nmap works
ft_nmap is a raw-packet port scanner with TCP SYN, ACK, NULL, FIN and XMAS scans, UDP probes, multi-target input, and optional traceroute. The main workflow parses arguments and targets, selects interfaces, runs concurrent probe-sending and packet-capture workers, classifies replies and timeouts, then prints combined port states and reasons. UDP payload selection and traceroute are distinct capabilities. The README documents the scan modes; source excerpts show key send, capture, response, and trace behavior, but not every orchestration call, so uncertain links are omitted.
Main entry points: send_routine.c Probe sender · main.c CLI orchestrator · threads.c Scan coordinator · capture_routine.c Packet capture
Components 22
Input and setup
- CLI orchestrator
src/main.c - Argument parsing
src/parsing/args.c - Target resolution
src/parsing/targets.c - Interface selection
src/scan/interface.c
Probe engine
- Scan coordinator
src/threads/threads.c - Shared queues
src/threads/shared_data.c - Probe requests
src/scan/request.c - Probe sender
src/threads/send_routine.c - Packet capture
src/threads/capture_routine.c - Pending probes
src/scan/update_pending_probe_request_list.c
Packet protocols
- UDP payload lookup
src/payloads/payloads.c - TCP packet construction
src/protocols/tcp_build_header.c - UDP packet construction
src/protocols/udp_build_header.c - IP packet construction
src/protocols/ip_build_header.c - TCP state classification
src/protocols/tcp_response.c - UDP state classification
src/protocols/udp_response.c
Results and tracing
- Scan report
src/scan/print_scan_results.c - Traceroute
src/traceroute/traceroute.c - Trace probe I/O
src/traceroute/trace_probe.c - Trace display
src/traceroute/print_traceroute.c
Other components
- Operator
- Scanned hosts
Connections 25
- Operator → CLI orchestrator: provides options
- CLI orchestrator → Argument parsing: parses arguments
- CLI orchestrator → Target resolution: resolves targets
- CLI orchestrator → Interface selection: selects interfaces
- CLI orchestrator → Scan coordinator: starts scan
- Scan coordinator → Shared queues: initializes queues
- Scan coordinator → Probe requests: creates probes
- Scan coordinator → Probe sender: starts sender
- Scan coordinator → Packet capture: starts capture
- Probe sender → Shared queues: dequeues probes
- Probe sender → UDP payload lookup: looks up payloads
- Probe sender → TCP packet construction: builds TCP probes
- Probe sender → UDP packet construction: builds UDP probes
- Probe sender → IP packet construction: builds IP packets
- Probe sender → Scanned hosts: transmits probes
- Scanned hosts → Packet capture: returns packets
- Packet capture → TCP state classification: dispatches TCP replies
- Packet capture → UDP state classification: dispatches UDP replies
- Packet capture → Pending probes: expires or requeues probes
- TCP state classification → Shared queues: updates probe state
- UDP state classification → Shared queues: updates probe state
- CLI orchestrator → Scan report: prints results
- Scan report → Traceroute: runs optional trace
- Traceroute → Trace probe I/O: probes and receives
- Scan report → Trace display: prints trace