# recon — find the ports, name the services Two-stage doctrine: **rustscan** sprays all 65535 ports in seconds, hands the open ones to **nmap** for the slow deep scan. Set `t ` once and most wrappers default to it. Full rs* list: **`rshelp`**. Underlying tools: `cheat overview` for the stack. ## Set the target first - **`t `** — export `$TARGET`/`$RHOST` · **`t`** — show current · nearly every wrapper below defaults `$1` to `$TARGET`. - Scans from the nmap wrappers land in **`$HTB_BOXES/scans/`** (`quick-`, `allports-`, `detail-`, `vuln-`, `udp-` prefixes, `-oA` triple output). ## Sweep & knock - **`pingsweep 10.10.10`** — ICMP the whole `.0/24` in parallel, print live hosts (pass the first 3 octets, no `/24`). - **`port `** — single-port check via `/dev/tcp`, no nmap, instant · **`port `** uses `$TARGET`. - **`knock …`** — send a port-knock sequence (`nmap -Pn --max-retries 0`), then auto `nmap -Pn -sV --open`. ## Scan fast — rustscan (native system binary) `rustscan` resolves to the system package at **`/usr/bin/rustscan`**. Everything after `--` is handed to nmap. | flag | meaning | |---|---| | `-a ` | address / CIDR / comma-list (the rs* funcs fill this from `$1`) | | `-b ` | batch size — open sockets at once. Higher = faster + louder | | `-t ` | per-port timeout. Raise it on laggy VPN/WAN | | `--range 1-65535` / `--top` | explicit port range / nmap top-1000 | | `--udp` | UDP mode · `-g` greppable (ports only, skips nmap) | | `-- ` | everything past `--` runs as nmap on the found ports | ## The rs* family — grouped by intent All take `` as the first arg. This is a taste of each lane; run **`rshelp`** for the full ~60. ``` quick/full rsquick top-1000 default rs100/rstop100 top 100 (-F) rs1000 nmap --top rsall/rsfull all 65535, -b 65535 -t 3000 service rsversion -sV rsservice -sV -sC rsaggro -A rsos -O vuln rsvuln -sV --script vuln rsvulners CVE via vulners rssafevuln (vuln and safe) rsdefault -sC web rsweb 80,443,8000,8080,8443,8888 -sV -sC rshttp http-enum rshttps ssl-enum-ciphers win/smb rswin 135,139,445,3389,5985 -sV -sC rssmb 139,445 smb-enum-shares rsrdp 3389 db rsdb 1433,3306,5432,5984,6379,9200,27017 -sV rsmysql/rsmssql/rsmongo/rsredis udp rsudp --udp rsudp100 / rsudp1000 rsudpall (very slow) stealth rsstealth Random+-sS rssyn -sS rsfin/rsnull/rsxmas firewall-evasion probes save rssave [name] -oA rspentest [name] -A -sV -sC + safe/vuln scripts, -oA grep/quiet rsgrep -g rssilent --no-banner -g rsquiet --no-banner tuning rsfast -b 20000 (LAN) rsslow -b 1000 -t 5000 (VPN) rsaccurate low-false-neg custom rsports rscustom rsnmap ``` - **`rspentest`** and the `rssave*` funcs write `-oA` output into the **current directory**, not `$HTB_BOXES` — cd somewhere sensible first. - The stealth `-sS`/`-sF`/`-sN`/`-sX` scans need **root inside the container** (loud on IDS regardless). ## Native nmap wrappers (no Docker) - **`qscan [ip]`** — `nmap -sC -sV` default scripts + versions. The everyday first look. - **`fscan [ip]`** — all ports `-p- -T4 --min-rate=1000` (loud), then a targeted `-sC -sV` on just the open ones. The two-stage scan without rustscan. - **`vscan [ip]`** — `-sV --script vuln` (loud, slow, noisy false positives — read, don't trust). - **`uscan [ip]`** — `sudo nmap -sU --top-ports 20`, UDP top 20 (needs sudo, UDP is always slow). - **`auto-enum [ip]`** — quick `-sC -sV -T4`, then prints **suggested next steps** per open port (web→`webenum`, 445→smb, 88→AD, 161→snmp…). Best single command to orient on a fresh box. ## Enumerate a named service - **`ssl-enum [443]`** — pull CN, **SANs**, issuer, validity, TLS version off the cert, and emit an `/etc/hosts` one-liner for every SAN (vhosts hide here). - **`ftp-enum [host]`** — banner grab, **anonymous login** test, `ftp-anon`/`ftp-bounce`/`ftp-syst` NSE. - **`smtp-enum [host]`** — banner + `VRFY root/admin/postmaster`, `smtp-enum-users`/`smtp-commands` NSE, plus a `smtp-user-enum` tip. - **`snmp-enum [host]`** — brute community strings (public/private/manager/community/secret), `onesixtyone`, then dumps useful **OIDs** (processes, users, packages, TCP conns) once one hits. ## Raw fallbacks - **`nmap -sC -sV -p- `** — when you want full control and no wrapper. - **`naabu -host -p -`** — fast SYN port discovery · **`masscan -p1-65535 --rate 1000`** — mass SYN sweep (very loud, tune the rate). > Workflow: `t ` → `rsall $TARGET` (or `fscan`) to find ports → `qscan`/`auto-enum` to name services → per-service `*-enum`. rustscan finds, nmap fingerprints, `auto-enum` tells you where to dig next.