When an organization has more public infrastructure than expected, the hard part is rarely finding one open port. The hard part is turning hundreds of exposed services into a short, defensible list of things to fix first.
This tutorial shows a practical workflow: use ScanSearch to discover internet-facing devices, services, and vulnerability signals, then use a small Python script to normalize results, prioritize risk, and produce a reviewable report.
Only scan assets you own or have explicit permission to assess.
1. Start with discovery, not assumptions
Create a list of domains, IP ranges, cloud addresses, and network devices that belong to your organization. Include assets managed by other teams. Forgotten VPN gateways, staging servers, and old test environments are common sources of surprises.
Use ScanSearch to search the public internet for exposed network devices, services, and vulnerabilities associated with your authorized assets. The goal at this stage is inventory:
- Which hosts are visible from the internet?
- Which ports and services are reachable?
- Are software versions or vulnerability identifiers visible?
- Do any results belong to an asset that nobody recognizes?
Do not treat a search result as proof of compromise. It is an exposure signal that needs validation.
2. Put the results into a small, predictable format
The following JSON structure is intentionally simple. Copy the relevant fields from your authorized search results into scan.json, or adapt the names to match the export or report format available to you.
[
{
"host": "198.51.100.24",
"asset": "vpn.example.com",
"port": 443,
"service": "https",
"product": "Example Gateway",
"version": "4.2.1",
"cves": ["CVE-2024-12345"],
"owner": "networking"
},
{
"host": "198.51.100.31",
"asset": "staging.example.com",
"port": 6379,
"service": "redis",
"product": "Redis",
"version": "7.0.8",
"cves": [],
"owner": "unknown"
}
]
Keep the original results separately. The normalized file is for analysis, while the original evidence is useful when opening tickets or confirming a change later.
3. Rank exposures with explainable rules
A useful first pass does not need a machine-learning model. A few transparent rules are easier to audit and explain to an infrastructure team.
This script gives higher priority to known CVEs, administrative services, databases, and assets without an owner:
# prioritize.py
import json
HIGH_RISK_SERVICES = {
"redis", "mongodb", "mysql", "postgresql", "rdp",
"telnet", "docker", "elasticsearch", "vnc"
}
ADMIN_PORTS = {22, 23, 3389, 5900}
def priority(item):
score = 0
reasons = []
if item.get("cves"):
score += 50
reasons.append("known CVE match")
service = item.get("service", "").lower()
if service in HIGH_RISK_SERVICES:
score += 30
reasons.append("high-risk service")
if item.get("port") in ADMIN_PORTS:
score += 20
reasons.append("administrative port")
if not item.get("owner") or item["owner"].lower() == "unknown":
score += 15
reasons.append("unassigned owner")
return score, reasons
with open("scan.json", encoding="utf-8") as file:
records = json.load(file)
ranked = []
for record in records:
score, reasons = priority(record)
ranked.append({**record, "score": score, "reasons": reasons})
ranked.sort(key=lambda item: item["score"], reverse=True)
for item in ranked:
cves = ", ".join(item.get("cves", [])) or "none listed"
print(
f"{item['score']:>3} | {item['host']}:{item['port']} "
f"| {item.get('service', 'unknown')} "
f"| CVEs: {cves} "
f"| {'; '.join(item['reasons']) or 'manual review'}"
)
Run it with:
python3 prioritize.py
The score is not a replacement for CVSS, asset criticality, or an authenticated vulnerability scan. It is a queue-building mechanism: something that helps a human decide what to verify first.
4. Validate before creating a ticket
For every high-priority result, confirm four things:
- The IP or hostname still belongs to your organization.
- The service is intentionally exposed.
- The detected product and version are accurate.
- The vulnerability applies to the deployed configuration.
A service fingerprint can be stale or ambiguous. Validate ownership through DNS, cloud inventory, firewall rules, or the responsible team. Then use an approved internal scanner or vendor advisory to confirm the finding.
5. Generate a ticket-friendly report
Once results are validated, produce a compact Markdown report that preserves the evidence and the next action:
from pathlib import Path
lines = ["# External Exposure Review", ""]
for item in ranked:
if item["score"] < 30:
continue
lines.append(f"## {item['asset']} ({item['host']}:{item['port']})")
lines.append(f"- Service: {item.get('service', 'unknown')}")
lines.append(f"- Product: {item.get('product', 'unknown')} {item.get('version', '')}")
lines.append(f"- CVEs: {', '.join(item.get('cves', [])) or 'none listed'}")
lines.append(f"- Owner: {item.get('owner') or 'unknown'}")
lines.append(f"- Priority reasons: {', '.join(item['reasons'])}")
lines.append("- Next action: validate ownership and exposure, then remediate or document exception.")
lines.append("")
Path("exposure-review.md").write_text("\n".join(lines), encoding="utf-8")
This workflow keeps ScanSearch in the discovery role where it is most useful: showing what your organization exposes to the public internet. Python then turns that raw visibility into a repeatable review process your security and platform teams can actually work through.
Top comments (0)