Nmap
@jeremy/nmapv2026.07.23.2
01README
Network scanning with nmap, stored as structured data for change tracking over time. Produces host and port resources keyed by IP and port number, so consecutive scans naturally version and diff via the swamp data model.
Two methods: discover runs a ping sweep to find live hosts on a subnet; scan performs TCP port and service detection on one or more targets. Both use nmap's XML output (-oX) for reliable parsing.
Privileged mode is opt-in: with privileged=true, uses SYN scan, ARP discovery, and requires nmap to have CAP_NET_RAW or be run as root. The default is unprivileged TCP-connect scanning that works anywhere nmap runs.
02Models
@jeremy/nmapv2026.07.23.2mod.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| privileged | boolean | Run nmap in privileged mode (SYN scan, ARP discovery, OS detection). |
| nmapPath | string | Path to the nmap binary. Default resolves 'nmap' via PATH. |
| timing | enum | Nmap timing template. T0=paranoid (slowest), T3=normal (nmap default), |
fn discover(subnet: string, probePorts?: string, arp?: boolean)
Discover live hosts on a subnet using ping + TCP SYN probes (nmap -sn).
| Argument | Type | Description |
|---|---|---|
| subnet | string | Target subnet in CIDR notation (e.g. '192.0.2.0/24') or a |
| probePorts? | string | Comma-separated TCP ports to include in host-discovery SYN |
| arp? | boolean | Use ARP discovery (-PR). Only works on the local L2 segment. |
fn scan(target: string, ports?: string, services?: boolean, includeClosed?: boolean, includeFiltered?: boolean)
TCP scan of one or more targets with service detection. Produces
| Argument | Type | Description |
|---|---|---|
| target | string | Host, subnet, or range that nmap accepts (e.g. '192.0.2.5', |
| ports? | string | Port specification (e.g. '80,443', '1-1000', 'T:80,U:53'). |
| services? | boolean | Enable service/version detection (-sV). Default true. |
| includeClosed? | boolean | Emit port resources for closed ports too. Default false |
| includeFiltered? | boolean | Emit port resources for filtered ports. Default true |
Resources
scan(infinite)— Metadata for a single scan invocation
host(infinite)— A discovered host, keyed by IP address
port(infinite)— An open (or filtered) port on a host, keyed by ip-proto-port
03Previous Versions
2026.07.23.1
04Stats
A
100 / 100
Downloads
0
Archive size
50.3 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned
05Platforms
06Labels