Skip to content

Commit d82e4f7

Browse files
committed
Map the network footprint from one address
From the resolved host SentinelDeck now finds the owning autonomous system and every prefix it announces via RIPEstat (free, keyless), so a single domain or IP reveals an organisation's whole routed IP estate: the ASN, operator, announced- prefix count, and IPv4 address space, shown in a new dashboard card.
1 parent f414b17 commit d82e4f7

10 files changed

Lines changed: 168 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project are documented here. The format is loosely
44
based on [Keep a Changelog](https://keepachangelog.com/), and the project aims
55
to follow semantic versioning once it reaches 1.0.
66

7+
## [2.2.0] - 2026-06-29
8+
9+
### Added
10+
11+
- Network footprint mapping. From the resolved host SentinelDeck now finds the
12+
owning autonomous system and every prefix it announces (via RIPEstat, free and
13+
keyless), so one domain or IP reveals the organisation's whole routed IP estate
14+
— the ASN, operator, total announced prefixes, and IPv4 address space — shown in
15+
a new dashboard card.
16+
717
## [2.1.0] - 2026-06-29
818

919
### Added

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ own footprint.
182182
| **IP targets** | Point it at a bare IP (v4/v6) or a URL and it runs an IP-focused scan: geolocation + ASN, network allocation via RDAP (owning org, CIDR, abuse contact), reverse-IP hosted domains, reverse DNS, reputation, TLS, and headers |
183183
| **Threat intel** | Typosquatting / lookalike-domain detection, malware/phishing reputation (URLhaus), DNS blocklist checks (Cloudflare, Quad9, AdGuard…), and Wayback archive history |
184184
| **Exposure & CVEs** | Open ports, service tags, and known CVEs for the host via Shodan InternetDB (passive, keyless), cross-referenced with the CISA Known Exploited Vulnerabilities catalog so actively-exploited CVEs are flagged |
185+
| **Network footprint** | The owning ASN and every announced prefix for the host (via RIPEstat), mapping an organisation's whole routed IP estate from a single domain or IP |
185186
| **SaaS footprint** | The vendors a domain reveals through its TXT, SPF, and MX records, decoded into a readable technology profile (Microsoft 365, Google Workspace, Atlassian, Shopify, Stripe, and more) |
186187

187188
Every issue is scored by severity into a 0 to 100 risk score and an A to F grade.

‎src/sentineldeck/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""SentinelDeck: passive attack-surface visibility for small businesses."""
22

3-
__version__ = "2.1.0"
3+
__version__ = "2.2.0"

‎src/sentineldeck/scanner.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sentineldeck.remediation import attach_remediations
88
from sentineldeck.risk.scoring import build_findings, compute_passes, grade, score_findings
99
from sentineldeck.scanners.archive import archive_history
10+
from sentineldeck.scanners.asn import analyze_asn
1011
from sentineldeck.scanners.blocklists import check_blocklists
1112
from sentineldeck.scanners.cloud_assets import analyze_cloud_assets
1213
from sentineldeck.scanners.dns_hygiene import analyze_dns_hygiene
@@ -65,6 +66,7 @@
6566
"ip_rdap": "Network allocation (RDAP)",
6667
"reverse_ip": "Reverse IP (hosted domains)",
6768
"internetdb": "Exposure & CVEs (Shodan InternetDB)",
69+
"asn": "Network footprint (ASN)",
6870
}
6971

7072

@@ -121,6 +123,8 @@ def _summary(name: str, result) -> str:
121123
if name == "internetdb":
122124
np_, nv = len(result.get("ports") or []), len(result.get("vulns") or [])
123125
return f" :: {np_} port(s), {nv} CVE(s)" if (np_ or nv) else " :: clean"
126+
if name == "asn":
127+
return f" :: AS{result.get('asn')}, {result.get('prefix_count', 0)} prefix(es)" if result.get("asn") else ""
124128
if name == "reputation":
125129
return " :: listed" if (result.get("listed") or result.get("malicious")) else " :: clean"
126130
except Exception: # noqa: BLE001 - a summary must never break a scan
@@ -271,6 +275,12 @@ def _notify(label: str) -> None:
271275
internetdb["kev"] = filter_kev(internetdb["vulns"])
272276
_notify("Exposure & CVEs (Shodan InternetDB)" + _summary("internetdb", internetdb))
273277

278+
if addresses:
279+
asn_footprint = _safe(lambda: analyze_asn(addresses[0], timeout), {"status": "error"})
280+
else:
281+
asn_footprint = {"status": "skipped"}
282+
_notify("Network footprint (ASN)" + _summary("asn", asn_footprint))
283+
274284
spf_record = (results["email"].get("spf") or {}).get("record") or ""
275285
spf_includes = [t.split(":", 1)[1] for t in spf_record.split() if t.lower().startswith("include:")]
276286
saas = _safe(
@@ -283,6 +293,7 @@ def _notify(label: str) -> None:
283293
report.checks = {
284294
"dns": results["dns"],
285295
"internetdb": internetdb,
296+
"asn_footprint": asn_footprint,
286297
"saas_stack": saas,
287298
"http": http,
288299
"missing_security_headers": missing_security_headers(headers),
@@ -358,6 +369,7 @@ def _notify(label: str) -> None:
358369
futures["reverse_ip"] = pool.submit(reverse_ip, ip)
359370
futures["reputation"] = pool.submit(check_reputation, ip)
360371
futures["internetdb"] = pool.submit(analyze_internetdb, ip, timeout)
372+
futures["asn"] = pool.submit(analyze_asn, ip, timeout)
361373
if active:
362374
futures["ports"] = pool.submit(scan_ports, ip)
363375

@@ -407,6 +419,7 @@ def _notify(label: str) -> None:
407419
# this keeps the scoring engine from flagging it as "unresolved".
408420
"dns": {"resolved": True, "addresses": [ip]},
409421
"internetdb": internetdb,
422+
"asn_footprint": results.get("asn", {"status": "skipped"}),
410423
"http": http,
411424
"missing_security_headers": missing_security_headers(headers),
412425
"header_issues": evaluate_headers(headers, cookies),

‎src/sentineldeck/scanners/asn.py‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"""ASN / network footprint via RIPEstat (free, keyless). From a single IP we find
2+
the owning autonomous system and every prefix it announces, mapping an
3+
organisation's whole routed IP estate from one address. The network calls are
4+
injectable for offline tests.
5+
"""
6+
from __future__ import annotations
7+
8+
import ipaddress
9+
import json
10+
import urllib.parse
11+
import urllib.request
12+
13+
USER_AGENT = "SentinelDeck/0.1"
14+
RIPESTAT = "https://stat.ripe.net/data/{call}/data.json?resource={resource}"
15+
MAX_PREFIXES = 256
16+
17+
18+
def _default_fetch(call: str, resource: str, timeout: int = 12) -> dict | None:
19+
url = RIPESTAT.format(call=call, resource=urllib.parse.quote(str(resource)))
20+
request = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
21+
try:
22+
with urllib.request.urlopen(request, timeout=timeout) as response:
23+
data = json.loads(response.read().decode("utf-8", "replace"))
24+
return data.get("data") if isinstance(data, dict) else None
25+
except Exception: # noqa: BLE001 - any failure is reported as inconclusive
26+
return None
27+
28+
29+
def analyze_asn(ip: str, timeout: int = 12, fetcher=_default_fetch) -> dict:
30+
"""Return the ASN and every announced prefix for the network ``ip`` sits in."""
31+
info = fetcher("network-info", ip, timeout)
32+
if not info:
33+
return {"status": "error"}
34+
asns = info.get("asns") or []
35+
if not asns:
36+
return {"status": "ok", "asn": None, "prefixes": [], "prefix_count": 0}
37+
38+
asn = asns[0]
39+
overview = fetcher("as-overview", f"AS{asn}", timeout) or {}
40+
announced = fetcher("announced-prefixes", f"AS{asn}", timeout) or {}
41+
prefixes = sorted({p["prefix"] for p in (announced.get("prefixes") or []) if p.get("prefix")})
42+
43+
ipv4_addresses = ipv4_prefixes = ipv6_prefixes = 0
44+
for prefix in prefixes:
45+
try:
46+
net = ipaddress.ip_network(prefix, strict=False)
47+
except ValueError:
48+
continue
49+
if net.version == 4:
50+
ipv4_addresses += net.num_addresses
51+
ipv4_prefixes += 1
52+
else:
53+
ipv6_prefixes += 1
54+
55+
return {
56+
"status": "ok",
57+
"asn": asn,
58+
"holder": overview.get("holder"),
59+
"prefix": info.get("prefix"),
60+
"prefixes": prefixes[:MAX_PREFIXES],
61+
"prefix_count": len(prefixes),
62+
"ipv4_addresses": ipv4_addresses,
63+
"ipv4_prefixes": ipv4_prefixes,
64+
"ipv6_prefixes": ipv6_prefixes,
65+
"truncated": len(prefixes) > MAX_PREFIXES,
66+
}

‎src/sentineldeck/webui/app.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function render(report) {
123123
cardIP(checks.ip_intel),
124124
cardMap(checks.ip_intel),
125125
cardIpRdap(checks.ip_rdap),
126+
cardAsn(checks.asn_footprint),
126127
cardReverseIp(checks.reverse_ip),
127128
cardServerStatus(checks.http),
128129
cardHostNames(checks.ip_intel),
@@ -571,6 +572,22 @@ function cardSaaS(s) {
571572
return card(`SaaS footprint [${s.count}]`, items);
572573
}
573574

575+
function cardAsn(a) {
576+
if (!a || a.status !== "ok" || !a.asn) return "";
577+
const num = (n) => esc(Number(n || 0).toLocaleString());
578+
const shown = (a.prefixes || []).slice(0, 20);
579+
const tags = shown.map((p) => `<span class="tag">${esc(p)}</span>`).join("");
580+
const prefixCounts = `${esc(a.ipv4_prefixes || 0)} v4 / ${esc(a.ipv6_prefixes || 0)} v6`;
581+
return card("Network footprint // ASN",
582+
row("ASN", "AS" + esc(a.asn)) +
583+
(a.holder ? row("Operator", esc(a.holder)) : "") +
584+
(a.prefix ? row("This prefix", esc(a.prefix)) : "") +
585+
row("Announced prefixes", esc(a.prefix_count) + " (" + prefixCounts + ")") +
586+
(a.ipv4_addresses ? row("IPv4 address space", num(a.ipv4_addresses)) : "") +
587+
(a.prefix_count > shown.length ? row("Showing", esc(shown.length)) : "") +
588+
(tags ? `<div class="tags" style="margin-top:8px">${tags}</div>` : ""));
589+
}
590+
574591
function cardReverseIp(r) {
575592
if (!r || r.status !== "ok" || !r.count) return "";
576593
const shown = (r.domains || []).slice(0, 24);

‎tests/fixtures/dashboard_report.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,18 @@
370370
"tags": ["cdn"],
371371
"hostnames": ["host.example.com"]
372372
},
373+
"asn_footprint": {
374+
"status": "ok",
375+
"asn": "13335",
376+
"holder": "CLOUDFLARENET, US",
377+
"prefix": "104.20.23.0/24",
378+
"prefixes": ["104.16.0.0/13", "104.20.0.0/20", "2606:4700::/32"],
379+
"prefix_count": 3,
380+
"ipv4_addresses": 528384,
381+
"ipv4_prefixes": 2,
382+
"ipv6_prefixes": 1,
383+
"truncated": false
384+
},
373385
"saas_stack": {
374386
"status": "ok",
375387
"count": 3,

‎tests/test_asn.py‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from sentineldeck.scanners.asn import analyze_asn
2+
3+
4+
def _fetcher(call, resource, timeout=12):
5+
if call == "network-info":
6+
return {"asns": ["13335"], "prefix": "1.1.1.0/24"}
7+
if call == "as-overview":
8+
return {"holder": "CLOUDFLARENET, US"}
9+
if call == "announced-prefixes":
10+
return {"prefixes": [
11+
{"prefix": "1.1.1.0/24"},
12+
{"prefix": "104.16.0.0/13"},
13+
{"prefix": "2606:4700::/32"},
14+
]}
15+
return None
16+
17+
18+
def test_analyze_asn_maps_footprint():
19+
out = analyze_asn("1.1.1.1", fetcher=_fetcher)
20+
assert out["status"] == "ok"
21+
assert out["asn"] == "13335"
22+
assert out["holder"] == "CLOUDFLARENET, US"
23+
assert out["prefix"] == "1.1.1.0/24"
24+
assert "104.16.0.0/13" in out["prefixes"]
25+
assert out["prefix_count"] == 3
26+
assert out["ipv4_prefixes"] == 2
27+
assert out["ipv6_prefixes"] == 1
28+
assert out["ipv4_addresses"] == 256 + 524288 # /24 + /13
29+
30+
31+
def test_analyze_asn_no_asn():
32+
def fetch(call, resource, timeout=12):
33+
return {"asns": [], "prefix": None} if call == "network-info" else {}
34+
35+
out = analyze_asn("192.0.2.1", fetcher=fetch)
36+
assert out["status"] == "ok"
37+
assert out["asn"] is None
38+
assert out["prefix_count"] == 0
39+
40+
41+
def test_analyze_asn_error():
42+
out = analyze_asn("1.1.1.1", fetcher=lambda call, resource, timeout=12: None)
43+
assert out["status"] == "error"

‎tests/test_scan_ip.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def _stub_ip_probes(monkeypatch):
3333
p + "analyze_internetdb",
3434
lambda ip, timeout=10: {"status": "ok", "ports": [443], "vulns": ["CVE-2021-44228"]},
3535
)
36+
monkeypatch.setattr(
37+
p + "analyze_asn",
38+
lambda ip, timeout=12: {"status": "ok", "asn": "13335", "prefixes": ["1.1.1.0/24"], "prefix_count": 1},
39+
)
3640

3741

3842
def test_scan_ip_builds_ip_report(monkeypatch):

‎tests/test_scanner.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def _stub_all_probes(monkeypatch):
139139
monkeypatch.setattr(p + "analyze_web_content", lambda domain, page: {"status": "ok"})
140140
monkeypatch.setattr(p + "analyze_ip_intel", lambda ip, timeout=10: {"status": "error"})
141141
monkeypatch.setattr(p + "analyze_internetdb", lambda ip, timeout=10: {"status": "ok", "ports": [], "vulns": []})
142+
monkeypatch.setattr(p + "analyze_asn", lambda ip, timeout=12: {"status": "ok", "asn": None, "prefix_count": 0})
142143

143144

144145
def test_scan_survives_a_probe_that_raises(monkeypatch):

0 commit comments

Comments
 (0)