rtexit-method 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -5
- package/packaged-assets/.agents/skills/rt-active-recon/SKILL.md +767 -0
- package/packaged-assets/.agents/skills/rt-active-recon/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/customize.toml +76 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/customize.toml +67 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/customize.toml +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/SKILL.md +476 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/SKILL.md +1209 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/template.md +62 -0
- package/packaged-assets/.agents/skills/rt-autodoc/SKILL.md +258 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/SKILL.md +1072 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-compliance-mapper/SKILL.md +773 -0
- package/packaged-assets/.agents/skills/rt-create-sead/SKILL.md +74 -0
- package/packaged-assets/.agents/skills/rt-create-sead/template.md +89 -0
- package/packaged-assets/.agents/skills/rt-create-sead/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-credential-access/SKILL.md +756 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/SKILL.md +856 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/SKILL.md +542 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/cvss4-matrix.csv +20 -0
- package/packaged-assets/.agents/skills/rt-data-exfiltration/SKILL.md +784 -0
- package/packaged-assets/.agents/skills/rt-defense-evasion/SKILL.md +987 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/SKILL.md +712 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/template.md +31 -0
- package/packaged-assets/.agents/skills/rt-executive-report/SKILL.md +718 -0
- package/packaged-assets/.agents/skills/rt-executive-report/template.md +38 -0
- package/packaged-assets/.agents/skills/rt-executive-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/SKILL.md +1078 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/ad-checklist.csv +12 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/SKILL.md +1329 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/masvs-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/SKILL.md +1547 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/SKILL.md +1949 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-bec/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/SKILL.md +865 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-azure/SKILL.md +1258 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-gcp/SKILL.md +981 -0
- package/packaged-assets/.agents/skills/rt-exploit-containers/SKILL.md +55 -0
- package/packaged-assets/.agents/skills/rt-exploit-databases/SKILL.md +1374 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-mac/SKILL.md +834 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/SKILL.md +903 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-dotnet/SKILL.md +945 -0
- package/packaged-assets/.agents/skills/rt-exploit-elasticsearch/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/SKILL.md +1023 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/SKILL.md +1576 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/payloads/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-firebase/SKILL.md +54 -0
- package/packaged-assets/.agents/skills/rt-exploit-frameworks/SKILL.md +967 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/SKILL.md +1693 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/SKILL.md +1860 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/payloads/sqlmap-tampers.txt +22 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/SKILL.md +1214 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/SKILL.md +91 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-java/SKILL.md +1009 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/SKILL.md +1327 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-mongodb/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-mssql/SKILL.md +52 -0
- package/packaged-assets/.agents/skills/rt-exploit-mysql/SKILL.md +53 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/SKILL.md +118 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-nodejs/SKILL.md +852 -0
- package/packaged-assets/.agents/skills/rt-exploit-osticket/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/SKILL.md +173 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/templates/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-php/SKILL.md +1119 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-postgresql/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-python/SKILL.md +986 -0
- package/packaged-assets/.agents/skills/rt-exploit-redis/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ruby/SKILL.md +61 -0
- package/packaged-assets/.agents/skills/rt-exploit-scada/SKILL.md +1091 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/SKILL.md +1528 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/payloads.txt +23 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/SKILL.md +121 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/scripts.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/SKILL.md +1902 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/owasp-checklist.csv +14 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-wireless/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/SKILL.md +1565 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/cves.csv +7 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/SKILL.md +1526 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/payloads.txt +18 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-document/SKILL.md +687 -0
- package/packaged-assets/.agents/skills/rt-finding-document/template.md +71 -0
- package/packaged-assets/.agents/skills/rt-finding-document/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/SKILL.md +216 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-help/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-help/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/SKILL.md +639 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/patterns.txt +27 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-kill-chain-map/SKILL.md +393 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/SKILL.md +1032 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/frameworks.csv +10 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/SKILL.md +668 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/tactics.csv +16 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-osint/SKILL.md +775 -0
- package/packaged-assets/.agents/skills/rt-osint/osint-sources.csv +12 -0
- package/packaged-assets/.agents/skills/rt-osint/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-party-mode/SKILL.md +249 -0
- package/packaged-assets/.agents/skills/rt-party-mode/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-persistence/SKILL.md +1146 -0
- package/packaged-assets/.agents/skills/rt-persistence/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-poc-writer/SKILL.md +640 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/SKILL.md +998 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/windows-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/SKILL.md +1027 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/win-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/SKILL.md +665 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/template.md +28 -0
- package/packaged-assets/.agents/skills/rt-risk-matrix/SKILL.md +232 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-scenario-c001/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c002/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-scenario-c003/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c004/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c005/SKILL.md +72 -0
- package/packaged-assets/.agents/skills/rt-scenario-d001/SKILL.md +378 -0
- package/packaged-assets/.agents/skills/rt-scenario-d002/SKILL.md +392 -0
- package/packaged-assets/.agents/skills/rt-scenario-d003/SKILL.md +522 -0
- package/packaged-assets/.agents/skills/rt-scenario-d004/SKILL.md +373 -0
- package/packaged-assets/.agents/skills/rt-scenario-d005/SKILL.md +458 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/scenarios.csv +32 -0
- package/packaged-assets/.agents/skills/rt-scenario-m001/SKILL.md +796 -0
- package/packaged-assets/.agents/skills/rt-scenario-m002/SKILL.md +723 -0
- package/packaged-assets/.agents/skills/rt-scenario-m003/SKILL.md +463 -0
- package/packaged-assets/.agents/skills/rt-scenario-m004/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-m005/SKILL.md +505 -0
- package/packaged-assets/.agents/skills/rt-scenario-n001/SKILL.md +573 -0
- package/packaged-assets/.agents/skills/rt-scenario-n002/SKILL.md +112 -0
- package/packaged-assets/.agents/skills/rt-scenario-n003/SKILL.md +100 -0
- package/packaged-assets/.agents/skills/rt-scenario-n004/SKILL.md +90 -0
- package/packaged-assets/.agents/skills/rt-scenario-n005/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-w001/SKILL.md +635 -0
- package/packaged-assets/.agents/skills/rt-scenario-w002/SKILL.md +612 -0
- package/packaged-assets/.agents/skills/rt-scenario-w003/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-w004/SKILL.md +648 -0
- package/packaged-assets/.agents/skills/rt-scenario-w005/SKILL.md +479 -0
- package/packaged-assets/.agents/skills/rt-scenario-w006/SKILL.md +443 -0
- package/packaged-assets/.agents/skills/rt-scenario-w007/SKILL.md +494 -0
- package/packaged-assets/.agents/skills/rt-scenario-w008/SKILL.md +576 -0
- package/packaged-assets/.agents/skills/rt-scenario-w009/SKILL.md +518 -0
- package/packaged-assets/.agents/skills/rt-scenario-w010/SKILL.md +574 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/SKILL.md +79 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-shodan-recon/SKILL.md +880 -0
- package/packaged-assets/.agents/skills/rt-status/SKILL.md +64 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/SKILL.md +906 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-technical-report/SKILL.md +710 -0
- package/packaged-assets/.agents/skills/rt-technical-report/template.md +41 -0
- package/packaged-assets/.agents/skills/rt-technical-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-threat-model/SKILL.md +59 -0
- package/packaged-assets/.agents/skills/rt-threat-model/template.md +32 -0
- package/packaged-assets/.agents/skills/rt-threat-model/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-timeline/SKILL.md +338 -0
- package/packaged-assets/RTEXIT.md +127 -0
- package/tools/installer/lib/asset-manifest.js +10 -5
- package/tools/installer/lib/copy-assets.js +5 -2
- /package/{_rtexit → packaged-assets/_rtexit}/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/config.user.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/custom/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/autodoc_engine.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/finding_tracker.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_config.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_customization.py +0 -0
- /package/{resources → packaged-assets/resources}/certifications.md +0 -0
- /package/{resources → packaged-assets/resources}/payloads.md +0 -0
- /package/{resources → packaged-assets/resources}/tools.md +0 -0
- /package/{resources → packaged-assets/resources}/wordlists.md +0 -0
- /package/{templates → packaged-assets/templates}/attack-chain-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report.md +0 -0
- /package/{templates → packaged-assets/templates}/finding-template.md +0 -0
- /package/{templates → packaged-assets/templates}/remediation-roadmap.md +0 -0
- /package/{templates → packaged-assets/templates}/sead-template.md +0 -0
- /package/{templates → packaged-assets/templates}/technical-report.md +0 -0
|
@@ -0,0 +1,1209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-attack-surface-map
|
|
3
|
+
description: "Build complete attack surface map aggregating all recon data — subdomains, services, technologies, credentials, and CVEs — into a prioritized exploitation plan. The master document bridging Phase 2 (Recon) and Phase 3 (Exploitation). Creates attack-surface-map.md with prioritized target list."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-attack-surface-map
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Attack Surface Map is the **pivot document** of every Red Team engagement. It aggregates all Phase 2 reconnaissance output — subdomains, open ports, running services, detected technologies, leaked credentials, and identified CVEs — and converts that raw intelligence into a **ranked exploitation queue** for Phase 3.
|
|
11
|
+
|
|
12
|
+
Without this step, operators waste time in Phase 3 chasing low-value targets. With it, the first hour of exploitation focuses on the highest-probability, highest-impact vectors.
|
|
13
|
+
|
|
14
|
+
**When to run this skill:**
|
|
15
|
+
- After all passive and active recon is complete (subdomains, ports, web fingerprinting, credential hunting, CVE lookup)
|
|
16
|
+
- Before any exploitation begins
|
|
17
|
+
- When a new recon sweep reveals significant new data mid-engagement
|
|
18
|
+
|
|
19
|
+
**Output:** `_rtexit-output/docs/attack-chains/attack-surface-map.md`
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Skill Levels
|
|
24
|
+
|
|
25
|
+
### BEGINNER
|
|
26
|
+
Basic surface mapping using automated scanners with default settings. Suitable for CTF environments and simple single-domain scopes.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# 1. Run basic subdomain enumeration
|
|
30
|
+
subfinder -d target.com -o /tmp/subdomains.txt
|
|
31
|
+
|
|
32
|
+
# 2. Resolve live hosts
|
|
33
|
+
cat /tmp/subdomains.txt | httpx -o /tmp/live-hosts.txt -status-code -title -tech-detect
|
|
34
|
+
|
|
35
|
+
# 3. Port scan top 1000 ports on live hosts
|
|
36
|
+
nmap -iL /tmp/live-hosts.txt --top-ports 1000 -oN /tmp/nmap-basic.txt
|
|
37
|
+
|
|
38
|
+
# 4. Run nuclei with default templates
|
|
39
|
+
nuclei -l /tmp/live-hosts.txt -o /tmp/nuclei-results.txt
|
|
40
|
+
|
|
41
|
+
# 5. Manually review and create attack-surface-map.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Deliverable:** A basic table of hosts, open ports, and flags from nuclei.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### INTERMEDIATE
|
|
49
|
+
Multi-tool aggregation with technology fingerprinting, credential hunting, and CVE correlation. Standard for professional engagements.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 1. Comprehensive subdomain enumeration (passive + active)
|
|
53
|
+
subfinder -d target.com -silent | anew /tmp/subdomains.txt
|
|
54
|
+
amass enum -passive -d target.com | anew /tmp/subdomains.txt
|
|
55
|
+
assetfinder --subs-only target.com | anew /tmp/subdomains.txt
|
|
56
|
+
cat /tmp/subdomains.txt | sort -u > /tmp/subdomains-unique.txt
|
|
57
|
+
|
|
58
|
+
# 2. DNS resolution + live host probing
|
|
59
|
+
cat /tmp/subdomains-unique.txt | dnsx -silent -a -resp | anew /tmp/resolved.txt
|
|
60
|
+
cat /tmp/subdomains-unique.txt | httpx \
|
|
61
|
+
-status-code -title -tech-detect -content-length \
|
|
62
|
+
-follow-redirects -threads 50 \
|
|
63
|
+
-o /tmp/live-web.txt
|
|
64
|
+
|
|
65
|
+
# 3. Full port scan on resolved IPs
|
|
66
|
+
cat /tmp/resolved.txt | awk '{print $2}' | sort -u > /tmp/ips.txt
|
|
67
|
+
nmap -iL /tmp/ips.txt -p- --min-rate 5000 -T4 -sV \
|
|
68
|
+
--script=banner,http-title,ssl-cert \
|
|
69
|
+
-oA /tmp/nmap-full
|
|
70
|
+
|
|
71
|
+
# 4. Technology fingerprinting
|
|
72
|
+
whatweb -i /tmp/live-web.txt --log-json /tmp/whatweb.json
|
|
73
|
+
|
|
74
|
+
# 5. CVE lookup for detected services
|
|
75
|
+
# Extract service/version from nmap, query NVD
|
|
76
|
+
python3 /tmp/cve_lookup.py --nmap /tmp/nmap-full.xml --output /tmp/cves.json
|
|
77
|
+
|
|
78
|
+
# 6. Credential hunting
|
|
79
|
+
trufflehog git https://github.com/target-org --json | tee /tmp/trufflehog.json
|
|
80
|
+
gitleaks detect --source /tmp/cloned-repos/ --report-path /tmp/gitleaks.json
|
|
81
|
+
|
|
82
|
+
# 7. Aggregate and generate map
|
|
83
|
+
python3 _rtexit/scripts/autodoc_engine.py surface-map \
|
|
84
|
+
--subdomains /tmp/subdomains-unique.txt \
|
|
85
|
+
--live-hosts /tmp/live-web.txt \
|
|
86
|
+
--nmap /tmp/nmap-full.xml \
|
|
87
|
+
--nuclei /tmp/nuclei-results.txt \
|
|
88
|
+
--cves /tmp/cves.json \
|
|
89
|
+
--output _rtexit-output/docs/attack-chains/attack-surface-map.md
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Deliverable:** Structured attack-surface-map.md with prioritized target list and CVE annotations.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### ADVANCED
|
|
97
|
+
Full-spectrum surface mapping including cloud asset discovery, API endpoint enumeration, JavaScript analysis, and historical data mining. Used for complex multi-perimeter engagements.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# === PASSIVE RECON LAYER ===
|
|
101
|
+
|
|
102
|
+
# Certificate transparency — enumerate all issued certs
|
|
103
|
+
curl -s "https://crt.sh/?q=%.target.com&output=json" | \
|
|
104
|
+
jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u | \
|
|
105
|
+
anew /tmp/subdomains.txt
|
|
106
|
+
|
|
107
|
+
# Historical DNS records
|
|
108
|
+
curl -s "https://api.securitytrails.com/v1/domain/target.com/subdomains" \
|
|
109
|
+
-H "APIKEY: $SECURITYTRAILS_KEY" | jq -r '.subdomains[]' | \
|
|
110
|
+
sed 's/$/.target.com/' | anew /tmp/subdomains.txt
|
|
111
|
+
|
|
112
|
+
# Shodan org/IP discovery
|
|
113
|
+
shodan search "org:\"Target Organization\"" --fields ip_str,port,hostnames \
|
|
114
|
+
--separator , > /tmp/shodan-results.csv
|
|
115
|
+
shodan search "ssl.cert.subject.cn:target.com" --fields ip_str,port \
|
|
116
|
+
--separator , >> /tmp/shodan-results.csv
|
|
117
|
+
|
|
118
|
+
# FOFA / Censys (alternative)
|
|
119
|
+
python3 -c "
|
|
120
|
+
import censys.search
|
|
121
|
+
c = censys.search.CensysHosts()
|
|
122
|
+
for host in c.search('(parsed.names: target.com) and services.port: {443,80,8080,8443}'):
|
|
123
|
+
print(host['ip'])
|
|
124
|
+
" | anew /tmp/ips.txt
|
|
125
|
+
|
|
126
|
+
# ASN enumeration
|
|
127
|
+
amass intel -org "Target Corp" | tee /tmp/asn.txt
|
|
128
|
+
for asn in $(cat /tmp/asn.txt | grep -oP 'AS\d+'); do
|
|
129
|
+
whois -h whois.radb.net -- "-i origin $asn" | grep -oP '\d+\.\d+\.\d+\.\d+/\d+' | \
|
|
130
|
+
anew /tmp/cidr-ranges.txt
|
|
131
|
+
done
|
|
132
|
+
|
|
133
|
+
# === ACTIVE RECON LAYER ===
|
|
134
|
+
|
|
135
|
+
# DNS brute-force with targeted wordlists
|
|
136
|
+
puredns bruteforce \
|
|
137
|
+
/usr/share/seclists/Discovery/DNS/dns-Jhaddix.txt \
|
|
138
|
+
target.com \
|
|
139
|
+
--resolvers /usr/share/seclists/Miscellaneous/dns-resolvers.txt \
|
|
140
|
+
-q | anew /tmp/subdomains.txt
|
|
141
|
+
|
|
142
|
+
# VHOST discovery on each IP
|
|
143
|
+
for ip in $(cat /tmp/ips.txt); do
|
|
144
|
+
ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt \
|
|
145
|
+
-u "http://$ip" -H "Host: FUZZ.target.com" \
|
|
146
|
+
-mc 200,301,302,401,403 \
|
|
147
|
+
-o /tmp/vhost-$ip.json -of json
|
|
148
|
+
done
|
|
149
|
+
|
|
150
|
+
# === WEB LAYER ===
|
|
151
|
+
|
|
152
|
+
# JavaScript file discovery and secret extraction
|
|
153
|
+
cat /tmp/live-web.txt | getJS --complete | anew /tmp/js-files.txt
|
|
154
|
+
cat /tmp/js-files.txt | xargs -P 10 -I{} bash -c \
|
|
155
|
+
'curl -sk {} | grep -oP "(api_key|secret|password|token|aws_|slack_)[^\s\"'\'']{8,}" >> /tmp/secrets-js.txt'
|
|
156
|
+
|
|
157
|
+
# API endpoint extraction from JS
|
|
158
|
+
cat /tmp/js-files.txt | xargs -P 5 -I{} \
|
|
159
|
+
python3 /opt/tools/LinkFinder/linkfinder.py -i {} -o cli 2>/dev/null | \
|
|
160
|
+
anew /tmp/api-endpoints.txt
|
|
161
|
+
|
|
162
|
+
# Directory/endpoint brute-force on high-value targets
|
|
163
|
+
for host in $(grep -E "CRITICAL|HIGH" /tmp/live-web.txt | awk '{print $1}'); do
|
|
164
|
+
ffuf -w /usr/share/seclists/Discovery/Web-Content/api/api-endpoints.txt \
|
|
165
|
+
-u "$host/FUZZ" \
|
|
166
|
+
-mc 200,201,204,301,401,403,405 \
|
|
167
|
+
-t 50 -o /tmp/ffuf-$host.json -of json 2>/dev/null
|
|
168
|
+
done
|
|
169
|
+
|
|
170
|
+
# === CLOUD LAYER ===
|
|
171
|
+
|
|
172
|
+
# S3 bucket enumeration
|
|
173
|
+
python3 /opt/tools/cloud_enum/cloud_enum.py \
|
|
174
|
+
-k target -k targetcorp -k target-corp \
|
|
175
|
+
--disable-azure --disable-gcp \
|
|
176
|
+
-l /tmp/s3-buckets.txt
|
|
177
|
+
|
|
178
|
+
# Azure storage
|
|
179
|
+
python3 /opt/tools/cloud_enum/cloud_enum.py \
|
|
180
|
+
-k target -k targetcorp \
|
|
181
|
+
--disable-aws --disable-gcp \
|
|
182
|
+
-l /tmp/azure-storage.txt
|
|
183
|
+
|
|
184
|
+
# Google Cloud buckets
|
|
185
|
+
for keyword in target targetcorp target-corp target-prod target-dev target-backup; do
|
|
186
|
+
gsutil ls gs://$keyword 2>/dev/null && echo "FOUND: gs://$keyword" >> /tmp/gcp-buckets.txt
|
|
187
|
+
done
|
|
188
|
+
|
|
189
|
+
# === CVE CORRELATION ===
|
|
190
|
+
|
|
191
|
+
# Parse nmap XML for service versions
|
|
192
|
+
python3 << 'EOF'
|
|
193
|
+
import xml.etree.ElementTree as ET
|
|
194
|
+
import json, requests
|
|
195
|
+
|
|
196
|
+
tree = ET.parse('/tmp/nmap-full.xml')
|
|
197
|
+
services = []
|
|
198
|
+
for host in tree.findall('host'):
|
|
199
|
+
ip = host.find('address').get('addr')
|
|
200
|
+
for port in host.findall('ports/port'):
|
|
201
|
+
svc = port.find('service')
|
|
202
|
+
if svc is not None and svc.get('version'):
|
|
203
|
+
services.append({
|
|
204
|
+
'ip': ip,
|
|
205
|
+
'port': port.get('portid'),
|
|
206
|
+
'product': svc.get('product', ''),
|
|
207
|
+
'version': svc.get('version', '')
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
with open('/tmp/services.json', 'w') as f:
|
|
211
|
+
json.dump(services, f, indent=2)
|
|
212
|
+
print(f"Extracted {len(services)} service/version pairs")
|
|
213
|
+
EOF
|
|
214
|
+
|
|
215
|
+
# === CREDENTIAL HUNTING ===
|
|
216
|
+
|
|
217
|
+
# GitHub dork for leaked secrets
|
|
218
|
+
python3 /opt/tools/GitDorker/GitDorker.py \
|
|
219
|
+
-tf /opt/tools/GitDorker/Dorks/BHUSA.txt \
|
|
220
|
+
-q target.com \
|
|
221
|
+
-d /opt/tools/GitDorker/Dorks/medium_dorks.txt \
|
|
222
|
+
-o /tmp/github-dorks.txt
|
|
223
|
+
|
|
224
|
+
# Paste sites
|
|
225
|
+
python3 /opt/tools/pwnedOrNot/pwnedornot.py \
|
|
226
|
+
--domain target.com \
|
|
227
|
+
--output /tmp/pwned-accounts.txt
|
|
228
|
+
|
|
229
|
+
# Breach data correlation (if haveibeenpwned API access)
|
|
230
|
+
curl -s "https://haveibeenpwned.com/api/v3/breacheddomain/target.com" \
|
|
231
|
+
-H "hibp-api-key: $HIBP_KEY" | jq '.'
|
|
232
|
+
|
|
233
|
+
# === AGGREGATE AND SCORE ===
|
|
234
|
+
|
|
235
|
+
python3 _rtexit/scripts/autodoc_engine.py surface-map \
|
|
236
|
+
--subdomains /tmp/subdomains.txt \
|
|
237
|
+
--live-hosts /tmp/live-web.txt \
|
|
238
|
+
--nmap /tmp/nmap-full.xml \
|
|
239
|
+
--nuclei /tmp/nuclei-results.txt \
|
|
240
|
+
--cves /tmp/cves.json \
|
|
241
|
+
--js-secrets /tmp/secrets-js.txt \
|
|
242
|
+
--cloud /tmp/s3-buckets.txt \
|
|
243
|
+
--credentials /tmp/pwned-accounts.txt \
|
|
244
|
+
--output _rtexit-output/docs/attack-chains/attack-surface-map.md \
|
|
245
|
+
--format detailed
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Deliverable:** Full attack surface map with cloud assets, leaked credentials, JS secrets, and CVSS-scored CVE list. Prioritized exploitation queue ready for Phase 3.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### EXPERT
|
|
253
|
+
Adversarial simulation-grade mapping. Mimics APT reconnaissance patterns. Includes supply chain analysis, third-party exposure, and automated attack path generation using graph analysis.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# === SUPPLY CHAIN & THIRD-PARTY EXPOSURE ===
|
|
257
|
+
|
|
258
|
+
# DNS CNAME chain analysis — find dangling CNAMEs
|
|
259
|
+
cat /tmp/subdomains-unique.txt | while read sub; do
|
|
260
|
+
cname=$(dig +short CNAME $sub 2>/dev/null | head -1)
|
|
261
|
+
if [ -n "$cname" ]; then
|
|
262
|
+
# Check if CNAME target is unclaimed (dangling)
|
|
263
|
+
dig +short $cname | grep -q "^$" && \
|
|
264
|
+
echo "DANGLING CNAME: $sub -> $cname" >> /tmp/dangling-cnames.txt
|
|
265
|
+
fi
|
|
266
|
+
done
|
|
267
|
+
|
|
268
|
+
# Third-party JS library analysis (supply chain)
|
|
269
|
+
cat /tmp/js-files.txt | grep -E "cdn\.|unpkg\.|jsdelivr\." | \
|
|
270
|
+
while read jsurl; do
|
|
271
|
+
version=$(echo $jsurl | grep -oP '(\d+\.\d+\.\d+)')
|
|
272
|
+
lib=$(echo $jsurl | grep -oP '[a-z-]+\.\d+' | head -1)
|
|
273
|
+
echo "$lib $version $jsurl" >> /tmp/third-party-libs.txt
|
|
274
|
+
done
|
|
275
|
+
|
|
276
|
+
# Retire.js — detect vulnerable JS libraries
|
|
277
|
+
retire --js --outputpath /tmp/retire-results.json \
|
|
278
|
+
--outputformat json /tmp/downloaded-js/
|
|
279
|
+
|
|
280
|
+
# === ATTACK PATH GRAPH ANALYSIS ===
|
|
281
|
+
|
|
282
|
+
# Build relationship graph for attack path calculation
|
|
283
|
+
python3 << 'EOF'
|
|
284
|
+
import json
|
|
285
|
+
import networkx as nx
|
|
286
|
+
from itertools import combinations
|
|
287
|
+
|
|
288
|
+
# Load all recon data
|
|
289
|
+
with open('/tmp/services.json') as f:
|
|
290
|
+
services = json.load(f)
|
|
291
|
+
with open('/tmp/cves.json') as f:
|
|
292
|
+
cves = json.load(f)
|
|
293
|
+
|
|
294
|
+
G = nx.DiGraph()
|
|
295
|
+
|
|
296
|
+
# Add nodes for each discovered asset
|
|
297
|
+
for svc in services:
|
|
298
|
+
node_id = f"{svc['ip']}:{svc['port']}"
|
|
299
|
+
cvss_score = max(
|
|
300
|
+
[c['cvss'] for c in cves if c['ip'] == svc['ip'] and c['port'] == svc['port']],
|
|
301
|
+
default=0
|
|
302
|
+
)
|
|
303
|
+
G.add_node(node_id, type='service', ip=svc['ip'],
|
|
304
|
+
port=svc['port'], product=svc['product'],
|
|
305
|
+
cvss=cvss_score)
|
|
306
|
+
|
|
307
|
+
# Add edges based on network reachability (same subnet = connected)
|
|
308
|
+
nodes = list(G.nodes(data=True))
|
|
309
|
+
for n1, d1 in nodes:
|
|
310
|
+
for n2, d2 in nodes:
|
|
311
|
+
if n1 != n2 and d1['ip'].rsplit('.', 1)[0] == d2['ip'].rsplit('.', 1)[0]:
|
|
312
|
+
G.add_edge(n1, n2, weight=1)
|
|
313
|
+
|
|
314
|
+
# Find highest-value attack paths
|
|
315
|
+
internet_node = 'INTERNET'
|
|
316
|
+
G.add_node(internet_node, type='external')
|
|
317
|
+
|
|
318
|
+
# Connect internet to all public-facing services
|
|
319
|
+
for node, data in nodes:
|
|
320
|
+
if data.get('port') in ['80', '443', '8080', '8443']:
|
|
321
|
+
G.add_edge(internet_node, node, weight=1)
|
|
322
|
+
|
|
323
|
+
# Calculate centrality to find pivot points
|
|
324
|
+
centrality = nx.betweenness_centrality(G)
|
|
325
|
+
top_pivots = sorted(centrality.items(), key=lambda x: x[1], reverse=True)[:10]
|
|
326
|
+
|
|
327
|
+
print("TOP PIVOT POINTS (by betweenness centrality):")
|
|
328
|
+
for node, score in top_pivots:
|
|
329
|
+
print(f" {node}: {score:.4f}")
|
|
330
|
+
|
|
331
|
+
# Export graph for visualization
|
|
332
|
+
nx.write_graphml(G, '/tmp/attack-surface-graph.graphml')
|
|
333
|
+
with open('/tmp/pivot-analysis.json', 'w') as f:
|
|
334
|
+
json.dump({'top_pivots': top_pivots, 'node_count': G.number_of_nodes()}, f, indent=2)
|
|
335
|
+
EOF
|
|
336
|
+
|
|
337
|
+
# === AUTOMATED NUCLEI EXPERT MODE ===
|
|
338
|
+
|
|
339
|
+
# Run nuclei with ALL templates including CVEs, exposed panels, and misconfigs
|
|
340
|
+
nuclei -l /tmp/live-web.txt \
|
|
341
|
+
-t /root/nuclei-templates/cves/ \
|
|
342
|
+
-t /root/nuclei-templates/exposed-panels/ \
|
|
343
|
+
-t /root/nuclei-templates/misconfiguration/ \
|
|
344
|
+
-t /root/nuclei-templates/exposures/ \
|
|
345
|
+
-t /root/nuclei-templates/default-logins/ \
|
|
346
|
+
-severity critical,high,medium \
|
|
347
|
+
-rl 150 -c 50 \
|
|
348
|
+
-j -o /tmp/nuclei-expert.json \
|
|
349
|
+
-stats -si 60
|
|
350
|
+
|
|
351
|
+
# === FINAL AGGREGATION WITH SCORING ===
|
|
352
|
+
|
|
353
|
+
python3 _rtexit/scripts/autodoc_engine.py surface-map \
|
|
354
|
+
--subdomains /tmp/subdomains.txt \
|
|
355
|
+
--live-hosts /tmp/live-web.txt \
|
|
356
|
+
--nmap /tmp/nmap-full.xml \
|
|
357
|
+
--nuclei /tmp/nuclei-expert.json \
|
|
358
|
+
--cves /tmp/cves.json \
|
|
359
|
+
--js-secrets /tmp/secrets-js.txt \
|
|
360
|
+
--cloud /tmp/s3-buckets.txt \
|
|
361
|
+
--credentials /tmp/pwned-accounts.txt \
|
|
362
|
+
--graph /tmp/attack-surface-graph.graphml \
|
|
363
|
+
--dangling-cnames /tmp/dangling-cnames.txt \
|
|
364
|
+
--third-party /tmp/third-party-libs.txt \
|
|
365
|
+
--output _rtexit-output/docs/attack-chains/attack-surface-map.md \
|
|
366
|
+
--format expert \
|
|
367
|
+
--generate-exploitation-queue
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Deliverable:** Expert-grade attack surface map with graph-based attack path analysis, supply chain risk, dangling CNAME takeover candidates, and auto-generated Phase 3 exploitation queue sorted by CVSS score and exploitability.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Step-by-Step Workflow
|
|
375
|
+
|
|
376
|
+
### Step 1 — Collect All Recon Output
|
|
377
|
+
|
|
378
|
+
Verify all Phase 2 artifacts exist before aggregating:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Check for required recon artifacts
|
|
382
|
+
RECON_DIR="_rtexit-output/docs/reconnaissance"
|
|
383
|
+
REQUIRED=(
|
|
384
|
+
"$RECON_DIR/subdomains.txt"
|
|
385
|
+
"$RECON_DIR/live-hosts.txt"
|
|
386
|
+
"$RECON_DIR/nmap-full.xml"
|
|
387
|
+
"$RECON_DIR/technologies.json"
|
|
388
|
+
)
|
|
389
|
+
for f in "${REQUIRED[@]}"; do
|
|
390
|
+
[ -f "$f" ] && echo "[OK] $f" || echo "[MISSING] $f"
|
|
391
|
+
done
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
If artifacts are missing, run the appropriate recon skill first (rt-recon-passive or rt-recon-active).
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### Step 2 — Normalize and Deduplicate Subdomain Data
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
# Merge all subdomain sources
|
|
402
|
+
cat \
|
|
403
|
+
_rtexit-output/docs/reconnaissance/subdomains-passive.txt \
|
|
404
|
+
_rtexit-output/docs/reconnaissance/subdomains-active.txt \
|
|
405
|
+
_rtexit-output/docs/reconnaissance/subdomains-cert.txt \
|
|
406
|
+
2>/dev/null | \
|
|
407
|
+
sed 's/\*\.//g' | \
|
|
408
|
+
tr '[:upper:]' '[:lower:]' | \
|
|
409
|
+
grep -E "^[a-z0-9][a-z0-9\.\-]+[a-z0-9]$" | \
|
|
410
|
+
sort -u > /tmp/subdomains-final.txt
|
|
411
|
+
|
|
412
|
+
TOTAL=$(wc -l < /tmp/subdomains-final.txt)
|
|
413
|
+
echo "[*] Total unique subdomains: $TOTAL"
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
### Step 3 — Probe Live Hosts and Extract Metadata
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
# Probe all subdomains for live web services
|
|
422
|
+
cat /tmp/subdomains-final.txt | httpx \
|
|
423
|
+
-silent \
|
|
424
|
+
-status-code \
|
|
425
|
+
-title \
|
|
426
|
+
-tech-detect \
|
|
427
|
+
-content-length \
|
|
428
|
+
-follow-redirects \
|
|
429
|
+
-threads 100 \
|
|
430
|
+
-timeout 10 \
|
|
431
|
+
-o /tmp/live-web-full.txt
|
|
432
|
+
|
|
433
|
+
# Parse live count
|
|
434
|
+
LIVE=$(wc -l < /tmp/live-web-full.txt)
|
|
435
|
+
echo "[*] Live web endpoints: $LIVE"
|
|
436
|
+
|
|
437
|
+
# Extract IP addresses from resolved subdomains
|
|
438
|
+
cat /tmp/subdomains-final.txt | dnsx -silent -a -resp-only | \
|
|
439
|
+
sort -u > /tmp/resolved-ips.txt
|
|
440
|
+
|
|
441
|
+
echo "[*] Unique IPs: $(wc -l < /tmp/resolved-ips.txt)"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
### Step 4 — Service and Port Enumeration
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
# Fast initial scan — top 1000 ports
|
|
450
|
+
nmap -iL /tmp/resolved-ips.txt \
|
|
451
|
+
--top-ports 1000 \
|
|
452
|
+
-T4 \
|
|
453
|
+
--min-rate 3000 \
|
|
454
|
+
-sV \
|
|
455
|
+
--open \
|
|
456
|
+
-oA /tmp/nmap-top1000
|
|
457
|
+
|
|
458
|
+
# Full port scan on critical IPs (IPs with interesting services from step above)
|
|
459
|
+
CRITICAL_IPS=$(grep -E "21|22|23|25|53|110|143|389|445|1433|3306|3389|5432|5900|6379|27017" \
|
|
460
|
+
/tmp/nmap-top1000.gnmap | awk '{print $2}' | sort -u)
|
|
461
|
+
|
|
462
|
+
if [ -n "$CRITICAL_IPS" ]; then
|
|
463
|
+
echo "$CRITICAL_IPS" > /tmp/critical-ips.txt
|
|
464
|
+
nmap -iL /tmp/critical-ips.txt \
|
|
465
|
+
-p- \
|
|
466
|
+
--min-rate 5000 \
|
|
467
|
+
-T4 \
|
|
468
|
+
-sV \
|
|
469
|
+
--script=banner,http-title,ssl-cert,smtp-commands,ftp-anon,ssh-hostkey \
|
|
470
|
+
-oA /tmp/nmap-critical-full
|
|
471
|
+
fi
|
|
472
|
+
|
|
473
|
+
# UDP scan for key services (DNS, SNMP, NTP)
|
|
474
|
+
nmap -iL /tmp/resolved-ips.txt \
|
|
475
|
+
-sU \
|
|
476
|
+
-p 53,67,68,69,123,161,162,500,1900 \
|
|
477
|
+
--min-rate 1000 \
|
|
478
|
+
-oA /tmp/nmap-udp
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
### Step 5 — Technology Stack Fingerprinting
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
# Whatweb detailed scan
|
|
487
|
+
whatweb \
|
|
488
|
+
--input-file /tmp/live-web-full.txt \
|
|
489
|
+
--log-json /tmp/whatweb-detailed.json \
|
|
490
|
+
--aggression 3 \
|
|
491
|
+
--quiet
|
|
492
|
+
|
|
493
|
+
# Extract unique technologies for CVE correlation
|
|
494
|
+
python3 << 'EOF'
|
|
495
|
+
import json
|
|
496
|
+
|
|
497
|
+
with open('/tmp/whatweb-detailed.json') as f:
|
|
498
|
+
data = json.load(f)
|
|
499
|
+
|
|
500
|
+
tech_versions = {}
|
|
501
|
+
for entry in data:
|
|
502
|
+
target = entry.get('target', '')
|
|
503
|
+
plugins = entry.get('plugins', {})
|
|
504
|
+
for tech, info in plugins.items():
|
|
505
|
+
version = info.get('version', [''])[0] if info.get('version') else ''
|
|
506
|
+
if version:
|
|
507
|
+
if tech not in tech_versions:
|
|
508
|
+
tech_versions[tech] = []
|
|
509
|
+
tech_versions[tech].append({'target': target, 'version': version})
|
|
510
|
+
|
|
511
|
+
with open('/tmp/tech-versions.json', 'w') as f:
|
|
512
|
+
json.dump(tech_versions, f, indent=2)
|
|
513
|
+
|
|
514
|
+
print(f"Found {len(tech_versions)} technologies with version info")
|
|
515
|
+
for tech, instances in sorted(tech_versions.items()):
|
|
516
|
+
print(f" {tech}: {instances[0]['version']} ({len(instances)} hosts)")
|
|
517
|
+
EOF
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
### Step 6 — CVE Correlation
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
# Query NVD API for each detected technology/version
|
|
526
|
+
python3 << 'EOF'
|
|
527
|
+
import json, requests, time
|
|
528
|
+
|
|
529
|
+
with open('/tmp/tech-versions.json') as f:
|
|
530
|
+
tech_versions = json.load(f)
|
|
531
|
+
|
|
532
|
+
NVD_API = "https://services.nvd.nist.gov/rest/json/cves/2.0"
|
|
533
|
+
NVD_KEY = "YOUR_NVD_API_KEY" # Register at https://nvd.nist.gov/developers/request-an-api-key
|
|
534
|
+
|
|
535
|
+
findings = []
|
|
536
|
+
|
|
537
|
+
for tech, instances in tech_versions.items():
|
|
538
|
+
version = instances[0]['version']
|
|
539
|
+
params = {
|
|
540
|
+
'keywordSearch': f"{tech} {version}",
|
|
541
|
+
'resultsPerPage': 10,
|
|
542
|
+
'cvssV3SeverityV2': 'CRITICAL,HIGH'
|
|
543
|
+
}
|
|
544
|
+
headers = {'apiKey': NVD_KEY} if NVD_KEY else {}
|
|
545
|
+
|
|
546
|
+
try:
|
|
547
|
+
r = requests.get(NVD_API, params=params, headers=headers, timeout=10)
|
|
548
|
+
if r.status_code == 200:
|
|
549
|
+
cves = r.json().get('vulnerabilities', [])
|
|
550
|
+
for cve in cves:
|
|
551
|
+
metrics = cve['cve'].get('metrics', {})
|
|
552
|
+
cvss = 0
|
|
553
|
+
if 'cvssMetricV31' in metrics:
|
|
554
|
+
cvss = metrics['cvssMetricV31'][0]['cvssData']['baseScore']
|
|
555
|
+
elif 'cvssMetricV30' in metrics:
|
|
556
|
+
cvss = metrics['cvssMetricV30'][0]['cvssData']['baseScore']
|
|
557
|
+
|
|
558
|
+
findings.append({
|
|
559
|
+
'technology': tech,
|
|
560
|
+
'version': version,
|
|
561
|
+
'cve_id': cve['cve']['id'],
|
|
562
|
+
'cvss': cvss,
|
|
563
|
+
'description': cve['cve']['descriptions'][0]['value'][:200],
|
|
564
|
+
'affected_hosts': [i['target'] for i in instances]
|
|
565
|
+
})
|
|
566
|
+
time.sleep(0.6) # NVD rate limit: 50 requests per 30 seconds with key
|
|
567
|
+
except Exception as e:
|
|
568
|
+
print(f"Error querying {tech}: {e}")
|
|
569
|
+
|
|
570
|
+
# Sort by CVSS score
|
|
571
|
+
findings.sort(key=lambda x: x['cvss'], reverse=True)
|
|
572
|
+
|
|
573
|
+
with open('/tmp/cve-findings.json', 'w') as f:
|
|
574
|
+
json.dump(findings, f, indent=2)
|
|
575
|
+
|
|
576
|
+
print(f"\nFound {len(findings)} CVEs")
|
|
577
|
+
print("\nTop CVEs by CVSS:")
|
|
578
|
+
for f in findings[:10]:
|
|
579
|
+
print(f" [{f['cvss']}] {f['cve_id']} — {f['technology']} {f['version']}")
|
|
580
|
+
EOF
|
|
581
|
+
|
|
582
|
+
# Also run searchsploit for offline CVE/exploit matching
|
|
583
|
+
searchsploit --nmap /tmp/nmap-critical-full.xml -j > /tmp/searchsploit-results.json 2>/dev/null
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
### Step 7 — Credential and Secret Hunting
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
# TruffleHog — scan git repos for secrets
|
|
592
|
+
for repo_url in $(cat _rtexit-output/docs/reconnaissance/github-repos.txt 2>/dev/null); do
|
|
593
|
+
trufflehog git "$repo_url" \
|
|
594
|
+
--json \
|
|
595
|
+
--no-update \
|
|
596
|
+
2>/dev/null >> /tmp/trufflehog-all.json
|
|
597
|
+
done
|
|
598
|
+
|
|
599
|
+
# Gitleaks — scan locally cloned repos
|
|
600
|
+
if [ -d /tmp/cloned-repos ]; then
|
|
601
|
+
gitleaks detect \
|
|
602
|
+
--source /tmp/cloned-repos \
|
|
603
|
+
--report-format json \
|
|
604
|
+
--report-path /tmp/gitleaks-results.json \
|
|
605
|
+
--no-banner
|
|
606
|
+
fi
|
|
607
|
+
|
|
608
|
+
# GitDorker — GitHub search for target-specific secrets
|
|
609
|
+
python3 /opt/tools/GitDorker/GitDorker.py \
|
|
610
|
+
-tf ~/.tokens/github.tok \
|
|
611
|
+
-q "target.com" \
|
|
612
|
+
-d /opt/tools/GitDorker/Dorks/BHUSA.txt \
|
|
613
|
+
| tee /tmp/gitdorker-results.txt
|
|
614
|
+
|
|
615
|
+
# Parse and summarize credential findings
|
|
616
|
+
python3 << 'EOF'
|
|
617
|
+
import json
|
|
618
|
+
|
|
619
|
+
secrets = []
|
|
620
|
+
|
|
621
|
+
# Parse TruffleHog output
|
|
622
|
+
try:
|
|
623
|
+
with open('/tmp/trufflehog-all.json') as f:
|
|
624
|
+
for line in f:
|
|
625
|
+
try:
|
|
626
|
+
entry = json.loads(line.strip())
|
|
627
|
+
if entry.get('SourceMetadata'):
|
|
628
|
+
secrets.append({
|
|
629
|
+
'source': 'TruffleHog',
|
|
630
|
+
'type': entry.get('DetectorName', 'Unknown'),
|
|
631
|
+
'location': str(entry.get('SourceMetadata', {}).get('Data', '')),
|
|
632
|
+
'raw': entry.get('Raw', '')[:50] + '...'
|
|
633
|
+
})
|
|
634
|
+
except:
|
|
635
|
+
pass
|
|
636
|
+
except FileNotFoundError:
|
|
637
|
+
pass
|
|
638
|
+
|
|
639
|
+
# Parse Gitleaks output
|
|
640
|
+
try:
|
|
641
|
+
with open('/tmp/gitleaks-results.json') as f:
|
|
642
|
+
for finding in json.load(f):
|
|
643
|
+
secrets.append({
|
|
644
|
+
'source': 'Gitleaks',
|
|
645
|
+
'type': finding.get('RuleID', 'Unknown'),
|
|
646
|
+
'location': finding.get('File', '') + ':' + str(finding.get('StartLine', '')),
|
|
647
|
+
'raw': finding.get('Secret', '')[:20] + '...'
|
|
648
|
+
})
|
|
649
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
650
|
+
pass
|
|
651
|
+
|
|
652
|
+
with open('/tmp/credentials-summary.json', 'w') as f:
|
|
653
|
+
json.dump(secrets, f, indent=2)
|
|
654
|
+
|
|
655
|
+
print(f"Found {len(secrets)} potential credentials/secrets")
|
|
656
|
+
for s in secrets:
|
|
657
|
+
print(f" [{s['source']}] {s['type']} at {s['location']}")
|
|
658
|
+
EOF
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
### Step 8 — Run Nuclei Vulnerability Scanner
|
|
664
|
+
|
|
665
|
+
```bash
|
|
666
|
+
# Targeted nuclei scan with severity filtering
|
|
667
|
+
nuclei \
|
|
668
|
+
-l /tmp/live-web-full.txt \
|
|
669
|
+
-t /root/nuclei-templates/cves/ \
|
|
670
|
+
-t /root/nuclei-templates/exposed-panels/ \
|
|
671
|
+
-t /root/nuclei-templates/misconfiguration/ \
|
|
672
|
+
-t /root/nuclei-templates/exposures/configs/ \
|
|
673
|
+
-t /root/nuclei-templates/default-logins/ \
|
|
674
|
+
-t /root/nuclei-templates/takeovers/ \
|
|
675
|
+
-severity critical,high,medium \
|
|
676
|
+
-rl 100 \
|
|
677
|
+
-c 25 \
|
|
678
|
+
-timeout 10 \
|
|
679
|
+
-j \
|
|
680
|
+
-o /tmp/nuclei-findings.json \
|
|
681
|
+
-stats \
|
|
682
|
+
-si 30 \
|
|
683
|
+
2>/tmp/nuclei-stderr.txt
|
|
684
|
+
|
|
685
|
+
# Parse nuclei output
|
|
686
|
+
python3 << 'EOF'
|
|
687
|
+
import json
|
|
688
|
+
|
|
689
|
+
findings = []
|
|
690
|
+
try:
|
|
691
|
+
with open('/tmp/nuclei-findings.json') as f:
|
|
692
|
+
for line in f:
|
|
693
|
+
try:
|
|
694
|
+
findings.append(json.loads(line.strip()))
|
|
695
|
+
except:
|
|
696
|
+
pass
|
|
697
|
+
except FileNotFoundError:
|
|
698
|
+
pass
|
|
699
|
+
|
|
700
|
+
severity_order = {'critical': 0, 'high': 1, 'medium': 2, 'low': 3, 'info': 4}
|
|
701
|
+
findings.sort(key=lambda x: severity_order.get(x.get('info', {}).get('severity', 'info'), 99))
|
|
702
|
+
|
|
703
|
+
print(f"Nuclei findings: {len(findings)}")
|
|
704
|
+
severity_counts = {}
|
|
705
|
+
for f in findings:
|
|
706
|
+
sev = f.get('info', {}).get('severity', 'unknown')
|
|
707
|
+
severity_counts[sev] = severity_counts.get(sev, 0) + 1
|
|
708
|
+
|
|
709
|
+
for sev, count in sorted(severity_counts.items(), key=lambda x: severity_order.get(x[0], 99)):
|
|
710
|
+
print(f" {sev.upper()}: {count}")
|
|
711
|
+
EOF
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
### Step 9 — Score and Prioritize All Targets
|
|
717
|
+
|
|
718
|
+
```bash
|
|
719
|
+
# Calculate composite exploitation score for each target
|
|
720
|
+
python3 << 'EOF'
|
|
721
|
+
import json
|
|
722
|
+
from collections import defaultdict
|
|
723
|
+
|
|
724
|
+
# Load all data sources
|
|
725
|
+
def load_json(path, default=None):
|
|
726
|
+
try:
|
|
727
|
+
with open(path) as f:
|
|
728
|
+
return json.load(f)
|
|
729
|
+
except:
|
|
730
|
+
return default or []
|
|
731
|
+
|
|
732
|
+
nuclei_findings = []
|
|
733
|
+
try:
|
|
734
|
+
with open('/tmp/nuclei-findings.json') as f:
|
|
735
|
+
for line in f:
|
|
736
|
+
try:
|
|
737
|
+
nuclei_findings.append(json.loads(line.strip()))
|
|
738
|
+
except:
|
|
739
|
+
pass
|
|
740
|
+
except:
|
|
741
|
+
pass
|
|
742
|
+
|
|
743
|
+
cve_findings = load_json('/tmp/cve-findings.json', [])
|
|
744
|
+
credentials = load_json('/tmp/credentials-summary.json', [])
|
|
745
|
+
|
|
746
|
+
# Score each target
|
|
747
|
+
target_scores = defaultdict(lambda: {
|
|
748
|
+
'score': 0,
|
|
749
|
+
'factors': [],
|
|
750
|
+
'nuclei_findings': [],
|
|
751
|
+
'cves': [],
|
|
752
|
+
'credentials': [],
|
|
753
|
+
'services': []
|
|
754
|
+
})
|
|
755
|
+
|
|
756
|
+
SEVERITY_SCORES = {'critical': 40, 'high': 25, 'medium': 10, 'low': 3, 'info': 0}
|
|
757
|
+
|
|
758
|
+
# Score from nuclei
|
|
759
|
+
for finding in nuclei_findings:
|
|
760
|
+
host = finding.get('host', '').split('//')[1].split('/')[0] if '//' in finding.get('host','') else finding.get('host','')
|
|
761
|
+
sev = finding.get('info', {}).get('severity', 'info')
|
|
762
|
+
score = SEVERITY_SCORES.get(sev, 0)
|
|
763
|
+
target_scores[host]['score'] += score
|
|
764
|
+
target_scores[host]['nuclei_findings'].append({
|
|
765
|
+
'template': finding.get('templateID', ''),
|
|
766
|
+
'severity': sev,
|
|
767
|
+
'name': finding.get('info', {}).get('name', '')
|
|
768
|
+
})
|
|
769
|
+
target_scores[host]['factors'].append(f"Nuclei {sev}: {finding.get('info',{}).get('name','')}")
|
|
770
|
+
|
|
771
|
+
# Score from CVEs
|
|
772
|
+
for cve in cve_findings:
|
|
773
|
+
cvss = cve.get('cvss', 0)
|
|
774
|
+
for host in cve.get('affected_hosts', []):
|
|
775
|
+
h = host.split('//')[1].split('/')[0] if '//' in host else host
|
|
776
|
+
target_scores[h]['score'] += cvss * 2
|
|
777
|
+
target_scores[h]['cves'].append({'id': cve['cve_id'], 'cvss': cvss})
|
|
778
|
+
target_scores[h]['factors'].append(f"CVE {cve['cve_id']} (CVSS {cvss})")
|
|
779
|
+
|
|
780
|
+
# Bonus for credentials
|
|
781
|
+
for cred in credentials:
|
|
782
|
+
# Broad bonus — credentials give access to many targets
|
|
783
|
+
for host in target_scores:
|
|
784
|
+
target_scores[host]['score'] += 5
|
|
785
|
+
target_scores[host]['credentials'].append(cred.get('type', 'Unknown'))
|
|
786
|
+
|
|
787
|
+
# Sort by score
|
|
788
|
+
sorted_targets = sorted(target_scores.items(), key=lambda x: x[1]['score'], reverse=True)
|
|
789
|
+
|
|
790
|
+
# Save prioritized list
|
|
791
|
+
output = [{'host': h, **d} for h, d in sorted_targets]
|
|
792
|
+
with open('/tmp/prioritized-targets.json', 'w') as f:
|
|
793
|
+
json.dump(output, f, indent=2)
|
|
794
|
+
|
|
795
|
+
print("\n=== PRIORITIZED EXPLOITATION QUEUE ===")
|
|
796
|
+
print(f"{'Rank':<5} {'Score':<8} {'Host':<50} {'Top Finding'}")
|
|
797
|
+
print("-" * 100)
|
|
798
|
+
for i, (host, data) in enumerate(sorted_targets[:20], 1):
|
|
799
|
+
top = data['factors'][0] if data['factors'] else 'Service exposure'
|
|
800
|
+
print(f"{i:<5} {data['score']:<8.1f} {host:<50} {top}")
|
|
801
|
+
EOF
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
---
|
|
805
|
+
|
|
806
|
+
### Step 10 — Generate Attack Surface Map Document
|
|
807
|
+
|
|
808
|
+
```bash
|
|
809
|
+
# Generate the final attack-surface-map.md
|
|
810
|
+
python3 << 'PYEOF'
|
|
811
|
+
import json
|
|
812
|
+
from datetime import datetime
|
|
813
|
+
|
|
814
|
+
def load_json(path, default=None):
|
|
815
|
+
try:
|
|
816
|
+
with open(path) as f:
|
|
817
|
+
content = f.read().strip()
|
|
818
|
+
if not content:
|
|
819
|
+
return default or []
|
|
820
|
+
# Handle JSONL format
|
|
821
|
+
if content.startswith('{'):
|
|
822
|
+
return [json.loads(line) for line in content.split('\n') if line.strip()]
|
|
823
|
+
return json.loads(content)
|
|
824
|
+
except:
|
|
825
|
+
return default or []
|
|
826
|
+
|
|
827
|
+
targets = load_json('/tmp/prioritized-targets.json', [])
|
|
828
|
+
cves = load_json('/tmp/cve-findings.json', [])
|
|
829
|
+
credentials = load_json('/tmp/credentials-summary.json', [])
|
|
830
|
+
|
|
831
|
+
now = datetime.now().strftime("%Y-%m-%d %H:%M")
|
|
832
|
+
|
|
833
|
+
subdomains_count = 0
|
|
834
|
+
try:
|
|
835
|
+
with open('/tmp/subdomains-final.txt') as f:
|
|
836
|
+
subdomains_count = sum(1 for _ in f)
|
|
837
|
+
except:
|
|
838
|
+
pass
|
|
839
|
+
|
|
840
|
+
live_count = 0
|
|
841
|
+
try:
|
|
842
|
+
with open('/tmp/live-web-full.txt') as f:
|
|
843
|
+
live_count = sum(1 for _ in f)
|
|
844
|
+
except:
|
|
845
|
+
pass
|
|
846
|
+
|
|
847
|
+
nuclei_findings = load_json('/tmp/nuclei-findings.json', [])
|
|
848
|
+
severity_counts = {}
|
|
849
|
+
SEVERITY_ORDER = ['critical', 'high', 'medium', 'low', 'info']
|
|
850
|
+
for f in nuclei_findings:
|
|
851
|
+
sev = f.get('info', {}).get('severity', 'info')
|
|
852
|
+
severity_counts[sev] = severity_counts.get(sev, 0) + 1
|
|
853
|
+
|
|
854
|
+
doc = f"""# Attack Surface Map
|
|
855
|
+
|
|
856
|
+
**Generated:** {now}
|
|
857
|
+
**Classification:** CONFIDENTIAL — Authorized Red Team Use Only
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
## Executive Summary
|
|
862
|
+
|
|
863
|
+
| Metric | Count |
|
|
864
|
+
|--------|-------|
|
|
865
|
+
| Total Subdomains Discovered | {subdomains_count} |
|
|
866
|
+
| Live Web Endpoints | {live_count} |
|
|
867
|
+
| Prioritized Targets | {len(targets)} |
|
|
868
|
+
| Critical/High Nuclei Findings | {severity_counts.get('critical', 0) + severity_counts.get('high', 0)} |
|
|
869
|
+
| CVEs Identified | {len(cves)} |
|
|
870
|
+
| Credential Leaks | {len(credentials)} |
|
|
871
|
+
|
|
872
|
+
---
|
|
873
|
+
|
|
874
|
+
## Nuclei Finding Summary
|
|
875
|
+
|
|
876
|
+
| Severity | Count |
|
|
877
|
+
|----------|-------|
|
|
878
|
+
"""
|
|
879
|
+
|
|
880
|
+
for sev in SEVERITY_ORDER:
|
|
881
|
+
count = severity_counts.get(sev, 0)
|
|
882
|
+
doc += f"| {sev.upper()} | {count} |\n"
|
|
883
|
+
|
|
884
|
+
doc += """
|
|
885
|
+
---
|
|
886
|
+
|
|
887
|
+
## Prioritized Exploitation Queue
|
|
888
|
+
|
|
889
|
+
> Targets ranked by composite exploitation score (nuclei severity + CVSS + credential exposure)
|
|
890
|
+
|
|
891
|
+
| Rank | Score | Host | Top Vectors | Action |
|
|
892
|
+
|------|-------|------|-------------|--------|
|
|
893
|
+
"""
|
|
894
|
+
|
|
895
|
+
for i, t in enumerate(targets[:30], 1):
|
|
896
|
+
host = t.get('host', '')
|
|
897
|
+
score = t.get('score', 0)
|
|
898
|
+
factors = t.get('factors', [])
|
|
899
|
+
top_vector = factors[0] if factors else 'Service exposure'
|
|
900
|
+
cve_count = len(t.get('cves', []))
|
|
901
|
+
nuclei_count = len(t.get('nuclei_findings', []))
|
|
902
|
+
action = "EXPLOIT IMMEDIATELY" if score >= 80 else "HIGH PRIORITY" if score >= 40 else "STANDARD PRIORITY"
|
|
903
|
+
doc += f"| {i} | {score:.0f} | `{host}` | {top_vector} | **{action}** |\n"
|
|
904
|
+
|
|
905
|
+
doc += """
|
|
906
|
+
---
|
|
907
|
+
|
|
908
|
+
## CVE Inventory
|
|
909
|
+
|
|
910
|
+
| CVE ID | CVSS | Technology | Description | Affected Hosts |
|
|
911
|
+
|--------|------|------------|-------------|----------------|
|
|
912
|
+
"""
|
|
913
|
+
|
|
914
|
+
top_cves = sorted(cves, key=lambda x: x.get('cvss', 0), reverse=True)[:20]
|
|
915
|
+
for cve in top_cves:
|
|
916
|
+
cve_id = cve.get('cve_id', '')
|
|
917
|
+
cvss = cve.get('cvss', 0)
|
|
918
|
+
tech = f"{cve.get('technology','')} {cve.get('version','')}"
|
|
919
|
+
desc = cve.get('description', '')[:80] + '...' if len(cve.get('description','')) > 80 else cve.get('description','')
|
|
920
|
+
hosts = ', '.join(cve.get('affected_hosts', [])[:3])
|
|
921
|
+
if len(cve.get('affected_hosts',[])) > 3:
|
|
922
|
+
hosts += f" +{len(cve.get('affected_hosts',[])) - 3} more"
|
|
923
|
+
doc += f"| [{cve_id}](https://nvd.nist.gov/vuln/detail/{cve_id}) | {cvss} | {tech} | {desc} | {hosts} |\n"
|
|
924
|
+
|
|
925
|
+
doc += """
|
|
926
|
+
---
|
|
927
|
+
|
|
928
|
+
## Credential Exposure
|
|
929
|
+
|
|
930
|
+
| Source | Type | Location |
|
|
931
|
+
|--------|------|----------|
|
|
932
|
+
"""
|
|
933
|
+
|
|
934
|
+
for cred in credentials[:20]:
|
|
935
|
+
doc += f"| {cred.get('source','')} | {cred.get('type','')} | {cred.get('location','')} |\n"
|
|
936
|
+
|
|
937
|
+
doc += """
|
|
938
|
+
---
|
|
939
|
+
|
|
940
|
+
## Recommended Attack Paths
|
|
941
|
+
|
|
942
|
+
### Path A — External Vulnerability Exploitation
|
|
943
|
+
```
|
|
944
|
+
INTERNET
|
|
945
|
+
→ [Rank #1 Target] (highest nuclei/CVE score)
|
|
946
|
+
→ Service exploitation
|
|
947
|
+
→ Initial foothold
|
|
948
|
+
→ Internal pivot
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
### Path B — Credential-Based Access
|
|
952
|
+
```
|
|
953
|
+
INTERNET
|
|
954
|
+
→ Leaked credentials (from breach data / git secrets)
|
|
955
|
+
→ Direct authentication to VPN/Admin/SSH
|
|
956
|
+
→ Authenticated enumeration
|
|
957
|
+
→ Privilege escalation
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
### Path C — Subdomain Takeover / Dangling CNAME
|
|
961
|
+
```
|
|
962
|
+
INTERNET
|
|
963
|
+
→ Dangling CNAME identified (see /tmp/dangling-cnames.txt)
|
|
964
|
+
→ Register unclaimed third-party service
|
|
965
|
+
→ Host malicious content / phishing
|
|
966
|
+
→ Harvest credentials from target users
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
---
|
|
970
|
+
|
|
971
|
+
## Phase 3 Entry Points
|
|
972
|
+
|
|
973
|
+
Based on this attack surface map, Phase 3 (Exploitation) should begin with:
|
|
974
|
+
|
|
975
|
+
1. **Immediate targets** (score ≥ 80): Begin exploitation within first engagement session
|
|
976
|
+
2. **High-priority targets** (score 40-79): Schedule within first 48 hours
|
|
977
|
+
3. **Standard targets** (score < 40): Exploit after higher-value targets
|
|
978
|
+
|
|
979
|
+
---
|
|
980
|
+
|
|
981
|
+
## Evidence & Artifacts
|
|
982
|
+
|
|
983
|
+
All source files for this attack surface map are located at:
|
|
984
|
+
|
|
985
|
+
```
|
|
986
|
+
_rtexit-output/docs/reconnaissance/ # Raw recon data
|
|
987
|
+
/tmp/nuclei-findings.json # Nuclei raw output
|
|
988
|
+
/tmp/cve-findings.json # CVE correlation data
|
|
989
|
+
/tmp/credentials-summary.json # Credential findings
|
|
990
|
+
/tmp/prioritized-targets.json # Scoring data
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
---
|
|
994
|
+
|
|
995
|
+
*Generated by RTExit rt-attack-surface-map skill*
|
|
996
|
+
"""
|
|
997
|
+
|
|
998
|
+
output_path = '_rtexit-output/docs/attack-chains/attack-surface-map.md'
|
|
999
|
+
import os
|
|
1000
|
+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
1001
|
+
with open(output_path, 'w') as f:
|
|
1002
|
+
f.write(doc)
|
|
1003
|
+
|
|
1004
|
+
print(f"[+] Attack surface map written to: {output_path}")
|
|
1005
|
+
print(f"[+] {len(targets)} targets prioritized")
|
|
1006
|
+
print(f"[+] Top target: {targets[0]['host'] if targets else 'N/A'} (score: {targets[0]['score'] if targets else 0:.0f})")
|
|
1007
|
+
PYEOF
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
---
|
|
1011
|
+
|
|
1012
|
+
### Step 11 — Register with RTExit Autodoc Engine
|
|
1013
|
+
|
|
1014
|
+
```bash
|
|
1015
|
+
# Register the attack surface map with the autodoc engine
|
|
1016
|
+
python3 _rtexit/scripts/autodoc_engine.py register-artifact \
|
|
1017
|
+
--type attack-surface-map \
|
|
1018
|
+
--path _rtexit-output/docs/attack-chains/attack-surface-map.md \
|
|
1019
|
+
--phase 2 \
|
|
1020
|
+
--status complete
|
|
1021
|
+
|
|
1022
|
+
# Update engagement status
|
|
1023
|
+
python3 _rtexit/scripts/autodoc_engine.py update-phase \
|
|
1024
|
+
--phase 2 \
|
|
1025
|
+
--status complete \
|
|
1026
|
+
--next-phase 3 \
|
|
1027
|
+
--summary "Attack surface map complete. $(wc -l < /tmp/prioritized-targets.json) targets prioritized."
|
|
1028
|
+
|
|
1029
|
+
echo "[+] RTExit autodoc engine updated"
|
|
1030
|
+
echo "[+] Ready to begin Phase 3: Exploitation"
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
---
|
|
1034
|
+
|
|
1035
|
+
## Tools Referenced
|
|
1036
|
+
|
|
1037
|
+
| Tool | Purpose | URL |
|
|
1038
|
+
|------|---------|-----|
|
|
1039
|
+
| Subfinder | Passive subdomain enumeration | https://github.com/projectdiscovery/subfinder |
|
|
1040
|
+
| Amass | Active/passive subdomain enumeration | https://github.com/owasp-amass/amass |
|
|
1041
|
+
| Assetfinder | Subdomain discovery via multiple sources | https://github.com/tomnomnom/assetfinder |
|
|
1042
|
+
| httpx | HTTP probing with tech detection | https://github.com/projectdiscovery/httpx |
|
|
1043
|
+
| dnsx | Fast DNS resolver and query tool | https://github.com/projectdiscovery/dnsx |
|
|
1044
|
+
| puredns | Bruteforce subdomain resolver | https://github.com/d3mondev/puredns |
|
|
1045
|
+
| anew | Append unique lines to files | https://github.com/tomnomnom/anew |
|
|
1046
|
+
| Nmap | Port scanning and service detection | https://github.com/nmap/nmap |
|
|
1047
|
+
| Nuclei | Vulnerability scanning with templates | https://github.com/projectdiscovery/nuclei |
|
|
1048
|
+
| Nuclei Templates | Community vulnerability templates | https://github.com/projectdiscovery/nuclei-templates |
|
|
1049
|
+
| WhatWeb | Web technology fingerprinting | https://github.com/urbanadventurer/WhatWeb |
|
|
1050
|
+
| TruffleHog | Secret scanning in git repos | https://github.com/trufflesecurity/trufflehog |
|
|
1051
|
+
| Gitleaks | Secret and credential scanner | https://github.com/gitleaks/gitleaks |
|
|
1052
|
+
| GitDorker | GitHub dorking for target secrets | https://github.com/obheda12/GitDorker |
|
|
1053
|
+
| cloud_enum | Multi-cloud asset enumeration | https://github.com/initstring/cloud_enum |
|
|
1054
|
+
| Retire.js | Vulnerable JS library detection | https://github.com/RetireJS/retire.js |
|
|
1055
|
+
| LinkFinder | JavaScript endpoint discovery | https://github.com/GerbenJavado/LinkFinder |
|
|
1056
|
+
| ffuf | Fast web fuzzer for content/vhost | https://github.com/ffuf/ffuf |
|
|
1057
|
+
| Shodan CLI | Internet-wide scan data queries | https://github.com/achillean/shodan-python |
|
|
1058
|
+
| searchsploit | Local exploit database search | https://github.com/offensive-security/exploitdb |
|
|
1059
|
+
| SecLists | Security wordlists collection | https://github.com/danielmiessler/SecLists |
|
|
1060
|
+
| networkx | Python graph analysis library | https://github.com/networkx/networkx |
|
|
1061
|
+
|
|
1062
|
+
---
|
|
1063
|
+
|
|
1064
|
+
## SecLists Wordlists Used
|
|
1065
|
+
|
|
1066
|
+
```bash
|
|
1067
|
+
# DNS brute-force (subdomain discovery)
|
|
1068
|
+
/usr/share/seclists/Discovery/DNS/dns-Jhaddix.txt
|
|
1069
|
+
/usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt
|
|
1070
|
+
/usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
|
|
1071
|
+
|
|
1072
|
+
# Web content discovery
|
|
1073
|
+
/usr/share/seclists/Discovery/Web-Content/api/api-endpoints.txt
|
|
1074
|
+
/usr/share/seclists/Discovery/Web-Content/common.txt
|
|
1075
|
+
/usr/share/seclists/Discovery/Web-Content/big.txt
|
|
1076
|
+
/usr/share/seclists/Discovery/Web-Content/raft-large-directories.txt
|
|
1077
|
+
|
|
1078
|
+
# DNS resolvers (for puredns)
|
|
1079
|
+
/usr/share/seclists/Miscellaneous/dns-resolvers.txt
|
|
1080
|
+
|
|
1081
|
+
# Virtual host brute-force
|
|
1082
|
+
/usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
Install SecLists on Kali:
|
|
1086
|
+
```bash
|
|
1087
|
+
sudo apt install seclists -y
|
|
1088
|
+
# Or manually:
|
|
1089
|
+
git clone https://github.com/danielmiessler/SecLists /usr/share/seclists
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
---
|
|
1093
|
+
|
|
1094
|
+
## Output Instructions
|
|
1095
|
+
|
|
1096
|
+
### Files Created by This Skill
|
|
1097
|
+
|
|
1098
|
+
| File | Location | Description |
|
|
1099
|
+
|------|----------|-------------|
|
|
1100
|
+
| `attack-surface-map.md` | `_rtexit-output/docs/attack-chains/` | **Master output** — prioritized exploitation plan |
|
|
1101
|
+
| `subdomains-final.txt` | `/tmp/` (copy to recon dir) | Deduplicated subdomain list |
|
|
1102
|
+
| `live-web-full.txt` | `/tmp/` (copy to recon dir) | Live web endpoints with metadata |
|
|
1103
|
+
| `nuclei-findings.json` | `/tmp/` (copy to evidence dir) | Raw nuclei results |
|
|
1104
|
+
| `cve-findings.json` | `/tmp/` (copy to evidence dir) | CVE correlation data |
|
|
1105
|
+
| `prioritized-targets.json` | `/tmp/` (copy to attack-chains dir) | Scored target list |
|
|
1106
|
+
| `credentials-summary.json` | `/tmp/` (copy to findings dir) | Credential exposure summary |
|
|
1107
|
+
|
|
1108
|
+
### Copy Artifacts to Permanent Storage
|
|
1109
|
+
|
|
1110
|
+
```bash
|
|
1111
|
+
RECON="_rtexit-output/docs/reconnaissance"
|
|
1112
|
+
EVIDENCE="_rtexit-output/evidence"
|
|
1113
|
+
CHAINS="_rtexit-output/docs/attack-chains"
|
|
1114
|
+
FINDINGS="_rtexit-output/docs/findings"
|
|
1115
|
+
|
|
1116
|
+
mkdir -p "$RECON" "$EVIDENCE" "$CHAINS" "$FINDINGS"
|
|
1117
|
+
|
|
1118
|
+
cp /tmp/subdomains-final.txt "$RECON/subdomains-complete.txt"
|
|
1119
|
+
cp /tmp/live-web-full.txt "$RECON/live-web-endpoints.txt"
|
|
1120
|
+
cp /tmp/resolved-ips.txt "$RECON/resolved-ips.txt"
|
|
1121
|
+
cp /tmp/nuclei-findings.json "$EVIDENCE/nuclei-$(date +%Y%m%d).json"
|
|
1122
|
+
cp /tmp/cve-findings.json "$FINDINGS/cve-inventory.json"
|
|
1123
|
+
cp /tmp/prioritized-targets.json "$CHAINS/target-scores.json"
|
|
1124
|
+
cp /tmp/credentials-summary.json "$FINDINGS/credential-exposure.json"
|
|
1125
|
+
|
|
1126
|
+
# Compress all evidence
|
|
1127
|
+
tar czf "$EVIDENCE/attack-surface-evidence-$(date +%Y%m%d).tar.gz" \
|
|
1128
|
+
/tmp/nmap-*.xml /tmp/nmap-*.gnmap /tmp/whatweb-detailed.json \
|
|
1129
|
+
/tmp/nuclei-findings.json /tmp/trufflehog-all.json 2>/dev/null
|
|
1130
|
+
|
|
1131
|
+
echo "[+] All artifacts saved to permanent storage"
|
|
1132
|
+
ls -lh "$CHAINS/attack-surface-map.md"
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
---
|
|
1136
|
+
|
|
1137
|
+
## Resources
|
|
1138
|
+
|
|
1139
|
+
### Documentation and References
|
|
1140
|
+
- NVD API Documentation: https://nvd.nist.gov/developers/vulnerabilities
|
|
1141
|
+
- Nuclei Template Writing Guide: https://docs.projectdiscovery.io/templates/introduction
|
|
1142
|
+
- Amass User Guide: https://github.com/owasp-amass/amass/blob/master/doc/user_guide.md
|
|
1143
|
+
- Shodan API Reference: https://developer.shodan.io/api
|
|
1144
|
+
- Censys Search Language: https://search.censys.io/search/language
|
|
1145
|
+
|
|
1146
|
+
### Attack Surface Methodology References
|
|
1147
|
+
- OWASP Testing Guide (Recon): https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/01-Information_Gathering
|
|
1148
|
+
- PTES Technical Guidelines: http://www.pentest-standard.org/index.php/Intelligence_Gathering
|
|
1149
|
+
- Bug Bounty Recon Methodology (Jason Haddix): https://github.com/jhaddix/tbhm
|
|
1150
|
+
- Subdomain Enumeration Guide: https://blog.projectdiscovery.io/subdomain-enumeration/
|
|
1151
|
+
|
|
1152
|
+
### Vulnerability Databases
|
|
1153
|
+
- NVD (NIST): https://nvd.nist.gov/vuln/search
|
|
1154
|
+
- CVE Details: https://www.cvedetails.com
|
|
1155
|
+
- ExploitDB: https://www.exploit-db.com
|
|
1156
|
+
- Vulhub (Docker PoC environments): https://github.com/vulhub/vulhub
|
|
1157
|
+
- PacketStorm Security: https://packetstormsecurity.com
|
|
1158
|
+
|
|
1159
|
+
### Credential Exposure Sources
|
|
1160
|
+
- HaveIBeenPwned API: https://haveibeenpwned.com/API/v3
|
|
1161
|
+
- LeakCheck API: https://leakcheck.io/api
|
|
1162
|
+
- DeHashed API: https://www.dehashed.com/docs
|
|
1163
|
+
- IntelligenceX: https://intelx.io/
|
|
1164
|
+
|
|
1165
|
+
### Cloud Attack Surface
|
|
1166
|
+
- AWS S3 Bucket Finder: https://github.com/clarketm/s3finder
|
|
1167
|
+
- CloudSploit Scans: https://github.com/aquasecurity/cloudsploit
|
|
1168
|
+
- ScoutSuite (Multi-cloud): https://github.com/nccgroup/ScoutSuite
|
|
1169
|
+
|
|
1170
|
+
---
|
|
1171
|
+
|
|
1172
|
+
## Troubleshooting
|
|
1173
|
+
|
|
1174
|
+
### Nuclei returns no results
|
|
1175
|
+
```bash
|
|
1176
|
+
# Update templates
|
|
1177
|
+
nuclei -update-templates
|
|
1178
|
+
|
|
1179
|
+
# Test connectivity
|
|
1180
|
+
nuclei -l /tmp/live-web-full.txt -t /root/nuclei-templates/http/technologies/ -debug
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
### NVD API rate limiting (403 errors)
|
|
1184
|
+
```bash
|
|
1185
|
+
# Register for free API key at https://nvd.nist.gov/developers/request-an-api-key
|
|
1186
|
+
# Without key: 5 requests per 30 seconds
|
|
1187
|
+
# With key: 50 requests per 30 seconds
|
|
1188
|
+
|
|
1189
|
+
# Increase sleep between requests in cve_lookup.py
|
|
1190
|
+
time.sleep(6) # Without key — 6 seconds per request
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
### httpx missing technology detections
|
|
1194
|
+
```bash
|
|
1195
|
+
# Ensure wappalyzer data is up to date
|
|
1196
|
+
httpx -update
|
|
1197
|
+
|
|
1198
|
+
# Fallback: use gowitness for screenshot-based fingerprinting
|
|
1199
|
+
gowitness scan file -f /tmp/subdomains-final.txt --write-db
|
|
1200
|
+
gowitness report export --zip /tmp/gowitness-screenshots.zip
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
### Slow nmap scans
|
|
1204
|
+
```bash
|
|
1205
|
+
# Use masscan for initial port discovery, then nmap for service detection
|
|
1206
|
+
masscan -iL /tmp/resolved-ips.txt -p 1-65535 --rate 10000 -oL /tmp/masscan-results.txt
|
|
1207
|
+
grep "open" /tmp/masscan-results.txt | awk '{print $4}' | sort -u > /tmp/masscan-ips.txt
|
|
1208
|
+
nmap -iL /tmp/masscan-ips.txt -sV --version-intensity 5 -oA /tmp/nmap-services
|
|
1209
|
+
```
|