svcscan-0.1.5 is not a library.
svcscan 🔎
Simple, fast, reliable async TCP port scanner + banner/HTTP grabber in pure Rust.
- Reads a
.txtof hosts/URLs/domains (one per line), resolves DNS, de-duplicates IPs (bad/unresolvable entries are skipped with a warning, never crash the scan) - Scans all 65,535 TCP ports per host (async
connect, no external scanner binaries) - Grabs TCP banners and HTTP(S) info (status, server, headers, capped body excerpt)
- TLS certs ignored and TLS/HTTP errors never fail the scan (best-effort fingerprinting)
- Navigable, append-safe results (check the file while it runs) + speed stats (per-host
⏱️,ports/s) - Desktop notification on finish via OSC 99 (kitty protocol; works in kitty/foot/noctalia and other supporting terminals) — harmless where unsupported
- Auto-tuned: detects/raises
ulimit -n(nofile) for concurrency; retries on connect timeout for reliability - Modular, tested, commented codebase (
src/{cli,config,input,scan,probe,output}.rs)
Authorized security testing / inventory only. Scan hosts you own or have permission to assess.
Install
Or build from source:
&&
Usage
INPUT.txt— hosts/URLs/IPs/domains (one per line).#comments/blanks and unresolvable/bad hosts are skipped (scan continues).http://203.0.113.10:7777/·https://example.com/·example.com·198.51.100.5:8080
OUTPUT— optional; defaultresult_<unix_timestamp>.txt(cwd)--verbose, -v— debug logs to stderr (resolution, progress details)--concurrency— max concurrent probes (default: auto fromulimit -n, raised when possible)--timeout-ms— connect/read timeout ms (default:800)--retries— retries per port on connect timeout only (default:1; refused/RST never retried)
Example
Output & speed stats
- Per-host blocks appended live: open ports,
banner,httpstatus/server/headers/body excerpt, per-host⏱️andports/s. - Final
📊 SUMMARYwith total duration, open ports, and effective⚡ ~ports/s(65535 × hosts / duration). - Progress + emoji status on stderr.
How it works (and why defaults are reliable)
- TCP connect scan (full handshake): accurate and needs no root/caps. One connect per attempt; banner read reuses that stream.
- Refused (RST) is definitive → no retry (fast). Timeout is uncertain (filtered/drop or slow under load) → retried (default 1x, with backoff). This avoids the false-negative miss caused by an overly tight timeout while keeping speed reasonable.
- ulimit/nofile limits open sockets;
svcscanreadsRLIMIT_NOFILE, raises the soft limit toward the hard limit when possible, and caps concurrency with headroom (prevents FD exhaustion/missed ports). (Same class of tuning emphasized by RustScan.) - TLS: cert validation disabled; probe errors swallowed.
Performance tuning advice
| Symptom / goal | Knob | Guidance |
|---|---|---|
| Missed open ports / lossy or high-latency paths | --timeout-ms, --retries |
Increase timeout (e.g. 1200–2000) and/or retries (2). Improves reliability at a speed cost. |
| Filtered/drop-heavy hosts feel slow | (expected) | Timeouts dominate connect scans (inherent vs raw SYN like masscan). Keep defaults or lower timeout only if you accept risk. |
EMFILE / too many open files / erratic misses |
--concurrency, system ulimit -n |
Let auto-tuning work, or lower --concurrency. Raise ulimit -n if very low. |
| Faster on mostly-closed (RST) hosts | defaults | Refused ports return instantly; concurrency + short timeouts help. |
| Accuracy vs speed | balance | Defaults target reliability+speed (800ms, 1 retry, auto concurrency). Tighten for speed, loosen for certainty. |
Repo layout
src/main.rsorchestration/stats ·cli.rsargs ·config.rsulimit+config ·input.rsparse/resolve ·scan.rsconnect+retry ·probe.rsbanner/HTTP(TLS ignored) ·output.rsappend/format ·AGENTS.mdmaintainer notes · tests viacargo test.
License
MIT