Skip to main content

◈ Security / Automation · 2026

ASTrack — Attack Surface Change Tracker

A Bash-first CLI that snapshots an authorized domain's subdomains, ports and web fingerprints — then reports exactly what appeared since the last scan

BashjqNmapsubfinder
Project overview
8 bash modulesPipeline stages
4 config filesRisk rule sets
6 offline checksTests
v0.1.0Release

ASTrack is a Bash-first external attack-surface tracker. It merges subfinder and assetfinder discovery, probes a configurable TCP port list with Nmap, and fingerprints web services with ProjectDiscovery httpx, then stores every run as an isolated JSON snapshot per target. Each later scan is diffed against the previous baseline to surface new or removed subdomains, newly opened ports, new web hosts and changes in title, HTTP status, server or technology. Pipe-delimited rule files classify risky ports, exposed admin panels, missing security headers and weak TLS, and the result ships as machine-readable JSON plus a self-contained XSS-safe HTML report. A scan that discovers nothing aborts instead of overwriting a valid baseline with a false diff.

// tech stack

BashjqNmapsubfinderassetfinderProjectDiscovery httpxShellCheckGitHub ActionsJSON

// the challenge

Attack surface changes quietly: a forgotten subdomain starts answering, a database port opens to the internet, a panel title changes from 'Welcome' to 'Jenkins'. Point-in-time scanners produce raw text dumps that a human has to compare by hand, and a failed discovery run easily looks like 'everything disappeared', which creates false diffs and destroys trust in the report.

// the solution

ASTrack orchestrates existing tools behind a single Bash entrypoint with strict mode (set -Eeuo pipefail), per-stage timeouts and a trap-based temp-file cleanup. Discovery output is filtered to the requested domain, every stage writes into an isolated run directory, and snapshot.sh commits the merged JSON atomically, so a failed or empty discovery aborts before the baseline is replaced. diff.sh compares snapshots with jq and comm, and risk.sh evaluates four pipe-delimited rule files — ports, titles, security headers and TLS — against both the diff and the current snapshot so new hosts are assessed, not only changed ones.

// measurable impact

One command now answers the only question that matters for monitoring: what changed since yesterday. New subdomains, newly exposed ports, new web hosts and metadata drift arrive as JSON for tooling and as a single self-contained HTML report for humans, with risky ports and exposed admin panels already classified by severity. It also runs fully offline in tests: the suite validates Bash syntax, diffing, critical-risk classification and HTML escaping against local fixtures, and CI adds ShellCheck on every push.

Timeline
Jun 2026 – Aug 2026
Team
Solo
Role
Architecture, Bash implementation, jq diff engine, risk rules, tests, CI and v0.1.0 release

// key highlights

  • ◆Eight Bash modules (discovery, ports, web, snapshot, diff, risk, report, dependencies) behind one `astrack.sh scan <domain>` entrypoint
  • ◆Failed discovery aborts the run and never replaces a valid baseline snapshot
  • ◆jq-driven diff of subdomains, ports, web hosts, titles, status codes, servers and technologies
  • ◆Pipe-delimited risk rules for ports, titles, security headers and TLS — extensible without touching code
  • ◆Self-contained HTML report with escaping verified by a fixture that tries to inject a script tag
  • ◆ShellCheck plus offline integration tests in GitHub Actions on every push and pull request

// implementation sample

run_with_timeout() {
    local seconds="$1"; shift
    require_command timeout
    timeout --preserve-status --signal=TERM --kill-after=5s "${seconds}s" "$@"
}

resolve_httpx() {
    local candidate output
    for candidate in "$ASTRACK_ROOT/go/bin/httpx" "$(command -v httpx 2>/dev/null || true)"; do
        [[ -x "$candidate" ]] || continue
        output="$("$candidate" -version 2>&1 || true)"
        # The Python client shares the name; only ProjectDiscovery httpx is accepted.
        if [[ "$output" == *"Current Version:"* || "$output" == *"projectdiscovery"* ]]; then
            printf '%s\n' "$candidate"
            return 0
        fi
    done
    return 1
}