ether-core 0.1.0__py3-none-any.whl
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.
- ether/__init__.py +32 -0
- ether/assets/wordlists/common_dirs.txt.gz +0 -0
- ether/assets/wordlists/common_params.txt.gz +0 -0
- ether/assets/wordlists/common_passwords.txt.gz +0 -0
- ether/assets/wordlists/common_usernames.txt.gz +0 -0
- ether/assets/wordlists/subdomains_500.txt.gz +0 -0
- ether/cli/__init__.py +5 -0
- ether/cli/__main__.py +8 -0
- ether/cli/commands/__init__.py +1 -0
- ether/cli/commands/doctor.py +21 -0
- ether/cli/commands/graph.py +311 -0
- ether/cli/commands/logs.py +45 -0
- ether/cli/commands/mcp.py +49 -0
- ether/cli/commands/run.py +146 -0
- ether/cli/commands/session.py +61 -0
- ether/cli/commands/telemetry.py +51 -0
- ether/cli/commands/tool.py +131 -0
- ether/cli/context.py +71 -0
- ether/cli/formatters.py +39 -0
- ether/cli/router.py +368 -0
- ether/common/__init__.py +201 -0
- ether/common/algorithms.py +407 -0
- ether/common/canonicalize.py +93 -0
- ether/common/context.py +25 -0
- ether/common/crypto.py +183 -0
- ether/common/embeddings.py +93 -0
- ether/common/exceptions.py +13 -0
- ether/common/logging.py +386 -0
- ether/common/secure_memory.py +159 -0
- ether/common/ssrf.py +93 -0
- ether/core/__init__.py +25 -0
- ether/core/diagnostics.py +368 -0
- ether/core/executor.py +296 -0
- ether/core/sandbox.py +118 -0
- ether/core/session.py +956 -0
- ether/gateway/__init__.py +21 -0
- ether/gateway/gate.py +392 -0
- ether/gateway/network.py +98 -0
- ether/gateway/preflight.py +802 -0
- ether/graph/__init__.py +13 -0
- ether/graph/analytics.py +334 -0
- ether/graph/store.py +1615 -0
- ether/graph/telemetry.py +334 -0
- ether/graph/timeline.py +185 -0
- ether/mcp/__init__.py +5 -0
- ether/mcp/server.py +382 -0
- ether/paths.py +176 -0
- ether/py.typed +0 -0
- ether/registry/__init__.py +7 -0
- ether/registry/adapter.py +194 -0
- ether/registry/manifest.py +53 -0
- ether/registry/registry.py +150 -0
- ether/registry/wordlists.py +156 -0
- ether/schemas/__init__.py +50 -0
- ether/schemas/base.py +122 -0
- ether/schemas/credential.py +50 -0
- ether/schemas/dns.py +116 -0
- ether/schemas/host_internal.py +58 -0
- ether/schemas/network.py +142 -0
- ether/schemas/power.py +68 -0
- ether/schemas/vulnerability.py +221 -0
- ether/schemas/web.py +172 -0
- ether_core-0.1.0.dist-info/METADATA +440 -0
- ether_core-0.1.0.dist-info/RECORD +104 -0
- ether_core-0.1.0.dist-info/WHEEL +4 -0
- ether_core-0.1.0.dist-info/entry_points.txt +2 -0
- ether_core-0.1.0.dist-info/licenses/LICENSE +21 -0
- tools/__init__.py +0 -0
- tools/dnspython/__init__.py +1 -0
- tools/dnspython/adapter.py +302 -0
- tools/dnspython/cli.py +202 -0
- tools/dnspython/manifest.toml +138 -0
- tools/ffuf/__init__.py +1 -0
- tools/ffuf/adapter.py +183 -0
- tools/ffuf/manifest.toml +121 -0
- tools/gobuster/__init__.py +0 -0
- tools/gobuster/adapter.py +90 -0
- tools/gobuster/manifest.toml +104 -0
- tools/http_probe/adapter.py +256 -0
- tools/http_probe/manifest.toml +40 -0
- tools/netexec/__init__.py +1 -0
- tools/netexec/adapter.py +163 -0
- tools/netexec/manifest.toml +83 -0
- tools/nikto/__init__.py +0 -0
- tools/nikto/adapter.py +145 -0
- tools/nikto/manifest.toml +108 -0
- tools/nmap/__init__.py +0 -0
- tools/nmap/adapter.py +97 -0
- tools/nmap/manifest.toml +159 -0
- tools/nuclei/__init__.py +1 -0
- tools/nuclei/adapter.py +171 -0
- tools/nuclei/manifest.toml +117 -0
- tools/searchsploit/__init__.py +1 -0
- tools/searchsploit/adapter.py +139 -0
- tools/searchsploit/manifest.toml +103 -0
- tools/sqlmap/__init__.py +1 -0
- tools/sqlmap/adapter.py +214 -0
- tools/sqlmap/manifest.toml +89 -0
- tools/subfinder/__init__.py +0 -0
- tools/subfinder/adapter.py +71 -0
- tools/subfinder/manifest.toml +104 -0
- tools/whois/__init__.py +0 -0
- tools/whois/adapter.py +80 -0
- tools/whois/manifest.toml +95 -0
tools/ffuf/adapter.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""FFUF tool adapter."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import re
|
|
5
|
+
import shlex
|
|
6
|
+
from typing import Any, AsyncIterator, Dict, List, Optional
|
|
7
|
+
|
|
8
|
+
from ether.registry.adapter import ToolAdapter
|
|
9
|
+
from ether.registry.wordlists import resolve_wordlist, substitute_wordlist_macros
|
|
10
|
+
from ether.schemas.base import BaseFinding
|
|
11
|
+
from ether.schemas.vulnerability import AuditMisconfig
|
|
12
|
+
from ether.schemas.web import WebEndpoint
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FfufAdapter(ToolAdapter):
|
|
16
|
+
"""Adapter for the ffuf fast web fuzzer."""
|
|
17
|
+
|
|
18
|
+
SENSITIVE_PATTERN = re.compile(
|
|
19
|
+
r"(?:\.(?:env|git|bak|old|config|conf|json|yml|yaml|sql|db|sqlite|tar|gz|zip)|\b(?:admin|backup|secrets?|credentials?))\b",
|
|
20
|
+
re.IGNORECASE,
|
|
21
|
+
)
|
|
22
|
+
LINE_PATTERN = re.compile(
|
|
23
|
+
r"^(\S+)\s+\[Status:\s*(\d+),\s*Size:\s*(\d+),\s*Words:\s*(\d+),\s*Lines:\s*(\d+)",
|
|
24
|
+
re.MULTILINE,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def validate_install(self) -> bool:
|
|
28
|
+
"""Check if ffuf binary is available in PATH."""
|
|
29
|
+
return self.is_binary_available("ffuf")
|
|
30
|
+
|
|
31
|
+
def sanitize_output(self, raw_stdout: str) -> str:
|
|
32
|
+
"""Strip ffuf ASCII art, progress lines, and metadata blocks."""
|
|
33
|
+
lines = []
|
|
34
|
+
for line in raw_stdout.splitlines():
|
|
35
|
+
s = line.strip()
|
|
36
|
+
if s.startswith("::") or "Progress: [" in s or s.startswith("____"):
|
|
37
|
+
continue
|
|
38
|
+
lines.append(line)
|
|
39
|
+
return "\n".join(lines)
|
|
40
|
+
|
|
41
|
+
def build_command(self, target: BaseFinding, params: Dict[str, Any]) -> List[str]:
|
|
42
|
+
"""Construct the ffuf command line execution."""
|
|
43
|
+
# 1. Resolve target URL
|
|
44
|
+
url = self.extract_url(target)
|
|
45
|
+
|
|
46
|
+
# 2. Process flags and substitute macros
|
|
47
|
+
raw_flags = params.get("raw_flags", "").strip()
|
|
48
|
+
raw_flags, _ = substitute_wordlist_macros(raw_flags)
|
|
49
|
+
flag_args = shlex.split(raw_flags) if raw_flags else []
|
|
50
|
+
|
|
51
|
+
args = ["ffuf"]
|
|
52
|
+
|
|
53
|
+
# Ensure -u flag is present
|
|
54
|
+
has_u = any(flag_args[i] == "-u" for i in range(len(flag_args)))
|
|
55
|
+
if not has_u:
|
|
56
|
+
if not url:
|
|
57
|
+
raise ValueError(
|
|
58
|
+
f"Target finding {target.schema_type} has no URL or host identifier, and no -u flag provided."
|
|
59
|
+
)
|
|
60
|
+
base_url = url.rstrip("/")
|
|
61
|
+
# If FUZZ keyword is not in URL, append /FUZZ
|
|
62
|
+
fuzz_url = base_url if "FUZZ" in base_url else f"{base_url}/FUZZ"
|
|
63
|
+
args.extend(["-u", fuzz_url])
|
|
64
|
+
|
|
65
|
+
# Ensure -w wordlist flag is present
|
|
66
|
+
has_w = any(flag_args[i] == "-w" for i in range(len(flag_args)))
|
|
67
|
+
if not has_w:
|
|
68
|
+
default_wl = resolve_wordlist("common_dirs")
|
|
69
|
+
args.extend(["-w", str(default_wl)])
|
|
70
|
+
|
|
71
|
+
# Ensure JSON output is captured
|
|
72
|
+
has_of = any(flag_args[i] == "-of" for i in range(len(flag_args)))
|
|
73
|
+
if not has_of:
|
|
74
|
+
args.extend(["-of", "json", "-o", "-"])
|
|
75
|
+
|
|
76
|
+
# Add user-provided flags (ignoring duplicates of handled flags)
|
|
77
|
+
args.extend(flag_args)
|
|
78
|
+
return args
|
|
79
|
+
|
|
80
|
+
def _extract_url(self, target: BaseFinding) -> Optional[str]:
|
|
81
|
+
return self.extract_url(target)
|
|
82
|
+
|
|
83
|
+
async def parse_output(
|
|
84
|
+
self, raw_stdout: str, target: BaseFinding, context: Dict[str, Any] = None
|
|
85
|
+
) -> AsyncIterator[BaseFinding]:
|
|
86
|
+
"""Parse structured JSON results or stdout lines from ffuf."""
|
|
87
|
+
cleaned = raw_stdout.strip()
|
|
88
|
+
if not cleaned:
|
|
89
|
+
return
|
|
90
|
+
|
|
91
|
+
host_ip = target.pik.get("host_ip") or target.pik.get("ip") or target.data.get("host_ip")
|
|
92
|
+
|
|
93
|
+
# 1. Try parsing JSON payload
|
|
94
|
+
json_obj = self._parse_json(cleaned)
|
|
95
|
+
if json_obj and "results" in json_obj:
|
|
96
|
+
results = json_obj.get("results", [])
|
|
97
|
+
for item in results:
|
|
98
|
+
if not isinstance(item, dict):
|
|
99
|
+
continue
|
|
100
|
+
|
|
101
|
+
endpoint_url = item.get("url", "").strip()
|
|
102
|
+
if not endpoint_url:
|
|
103
|
+
continue
|
|
104
|
+
|
|
105
|
+
status_code = int(item.get("status", 200))
|
|
106
|
+
length = int(item.get("length", 0))
|
|
107
|
+
words = int(item.get("words", 0))
|
|
108
|
+
lines = int(item.get("lines", 0))
|
|
109
|
+
fuzz_word = str(item.get("input", {}).get("FUZZ", ""))
|
|
110
|
+
|
|
111
|
+
# Yield endpoint finding
|
|
112
|
+
yield WebEndpoint.create(
|
|
113
|
+
url=endpoint_url,
|
|
114
|
+
host_ip=host_ip,
|
|
115
|
+
status_code=status_code,
|
|
116
|
+
content_length=length,
|
|
117
|
+
words=words,
|
|
118
|
+
lines=lines,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Check for sensitive misconfiguration exposure
|
|
122
|
+
if status_code in (200, 301, 302, 307) and self.SENSITIVE_PATTERN.search(fuzz_word):
|
|
123
|
+
yield AuditMisconfig.create(
|
|
124
|
+
target=endpoint_url,
|
|
125
|
+
check_id="exposed-sensitive-file",
|
|
126
|
+
title=f"Exposed Sensitive Resource ({fuzz_word})",
|
|
127
|
+
severity="high" if status_code == 200 else "medium",
|
|
128
|
+
host_ip=host_ip,
|
|
129
|
+
remediation="Restrict access to sensitive configuration, backup, or administrative paths.",
|
|
130
|
+
)
|
|
131
|
+
return
|
|
132
|
+
|
|
133
|
+
# 2. Fallback: Parse line-by-line CLI output
|
|
134
|
+
base_url = self.extract_url(target) or ""
|
|
135
|
+
for match in self.LINE_PATTERN.finditer(cleaned):
|
|
136
|
+
word, status_str, size_str, words_str, lines_str = match.groups()
|
|
137
|
+
endpoint_url = f"{base_url.rstrip('/')}/{word.lstrip('/')}"
|
|
138
|
+
status_code = int(status_str)
|
|
139
|
+
|
|
140
|
+
yield WebEndpoint.create(
|
|
141
|
+
url=endpoint_url,
|
|
142
|
+
host_ip=host_ip,
|
|
143
|
+
status_code=status_code,
|
|
144
|
+
content_length=int(size_str),
|
|
145
|
+
words=int(words_str),
|
|
146
|
+
lines=int(lines_str),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
if status_code in (200, 301, 302, 307) and self.SENSITIVE_PATTERN.search(word):
|
|
150
|
+
yield AuditMisconfig.create(
|
|
151
|
+
target=endpoint_url,
|
|
152
|
+
check_id="exposed-sensitive-file",
|
|
153
|
+
title=f"Exposed Sensitive Resource ({word})",
|
|
154
|
+
severity="high" if status_code == 200 else "medium",
|
|
155
|
+
host_ip=host_ip,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
def _parse_json(self, text: str) -> Optional[Dict[str, Any]]:
|
|
159
|
+
try:
|
|
160
|
+
return json.loads(text)
|
|
161
|
+
except json.JSONDecodeError:
|
|
162
|
+
start = text.find("{")
|
|
163
|
+
end = text.rfind("}")
|
|
164
|
+
if start != -1 and end != -1 and end > start:
|
|
165
|
+
try:
|
|
166
|
+
return json.loads(text[start : end + 1])
|
|
167
|
+
except json.JSONDecodeError:
|
|
168
|
+
return None
|
|
169
|
+
return None
|
|
170
|
+
|
|
171
|
+
def sanitize_output(self, raw_stdout: str) -> str:
|
|
172
|
+
"""Strip ASCII banner and noisy progress lines from ffuf output."""
|
|
173
|
+
lines = []
|
|
174
|
+
for line in raw_stdout.splitlines():
|
|
175
|
+
s = line.strip()
|
|
176
|
+
if not s:
|
|
177
|
+
continue
|
|
178
|
+
if s.startswith("::") or s.startswith("Progress: [") or "Progress: [" in s:
|
|
179
|
+
continue
|
|
180
|
+
if any(banner_fragment in line for banner_fragment in ("/'___\\", "'___/ \\ \\ \\__/")):
|
|
181
|
+
continue
|
|
182
|
+
lines.append(line)
|
|
183
|
+
return "\n".join(lines)
|
tools/ffuf/manifest.toml
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
[meta]
|
|
2
|
+
name = "ffuf"
|
|
3
|
+
description = "Fast, high-performance web fuzzer written in Go for discovering directories, virtual hosts, parameters, and sensitive file disclosures."
|
|
4
|
+
one_line_summary = "high-speed HTTP directory and virtual host fuzzer"
|
|
5
|
+
category = "Web Enumeration"
|
|
6
|
+
categories = ["web", "fuzzing", "recon"]
|
|
7
|
+
binary = "ffuf"
|
|
8
|
+
theory = """
|
|
9
|
+
### Protocol Theory & Request Injection Vectors
|
|
10
|
+
Fuzzing injects dictionary payloads into candidate protocol fields denoted by the `FUZZ` anchor across HTTP requests.
|
|
11
|
+
|
|
12
|
+
### Multi-Vector Enumeration Mechanics
|
|
13
|
+
* **Virtual Host Enumeration (`Host: FUZZ.domain`)**: Enumerates unannounced internal web apps behind shared reverse proxies.
|
|
14
|
+
* **Parameter Fuzzing (`?FUZZ=1`)**: Discovers undocumented administrative APIs, test keys, and debug toggles.
|
|
15
|
+
* **Heuristic Filtering**: Suppresses noise by matching HTTP status code (`-fc`), response byte length (`-fs`), word count (`-fw`), or regex patterns (`-mr`).
|
|
16
|
+
|
|
17
|
+
### Defensive Hardening & Routing
|
|
18
|
+
* **Strict Reverse Proxy Rules**: Reject unrecognized or missing `Host` headers with HTTP 421 Misdirected Request.
|
|
19
|
+
* **WAF Anomaly Detection**: Enforce anomaly scoring on high-frequency burst patterns from identical IP subnets.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
[modes]
|
|
23
|
+
learning = true
|
|
24
|
+
power = true
|
|
25
|
+
|
|
26
|
+
[input]
|
|
27
|
+
accepts = ["network.host", "web.endpoint", "dns.record"]
|
|
28
|
+
|
|
29
|
+
[output]
|
|
30
|
+
produces = ["web.endpoint", "audit.misconfig"]
|
|
31
|
+
|
|
32
|
+
[learning]
|
|
33
|
+
enabled = true
|
|
34
|
+
|
|
35
|
+
[[learning.recipes]]
|
|
36
|
+
name = "Standard Directory Discovery"
|
|
37
|
+
difficulty = "Beginner"
|
|
38
|
+
description = "Enumerate hidden directories, REST API routes, and web assets using the bundled common directories dictionary."
|
|
39
|
+
flags = ["-u", "{url}/FUZZ", "-w", "{wordlist:common_dirs}", "-mc", "200,301,302,403"]
|
|
40
|
+
|
|
41
|
+
[learning.recipes.theory]
|
|
42
|
+
concept = "HTTP Resource Discovery & Status Code Triage (RFC 7231)"
|
|
43
|
+
explanation = """
|
|
44
|
+
FFUF performs high-concurrency HTTP GET requests replacing the 'FUZZ' keyword with entries from a wordlist.
|
|
45
|
+
Web servers respond with standard status codes indicating accessibility:
|
|
46
|
+
- 200 OK: Accessible resource, potentially containing sensitive data.
|
|
47
|
+
- 301/302 Redirect: Route exists and forwards to an authentication portal or trailing slash.
|
|
48
|
+
- 403 Forbidden: Endpoint exists but requires elevated authorization (e.g. /admin).
|
|
49
|
+
Filtering status codes with '-mc' isolates meaningful endpoints while discarding pervasive 404 Not Found responses.
|
|
50
|
+
"""
|
|
51
|
+
packet_wire_summary = "Client GET /FUZZ HTTP/1.1 -> Host: target -> Server HTTP/1.1 200 OK (Content-Length: N)"
|
|
52
|
+
remediation = "Disable directory browsing, enforce strict authentication across all private routes, and deploy a WAF to detect brute-force fuzzing."
|
|
53
|
+
|
|
54
|
+
[[learning.recipes]]
|
|
55
|
+
name = "Virtual Host & Subdomain Fuzzing"
|
|
56
|
+
difficulty = "Intermediate"
|
|
57
|
+
description = "Discover unannounced internal virtual hosts routed behind a single reverse proxy by fuzzing the HTTP Host header."
|
|
58
|
+
flags = ["-u", "{url}", "-H", "Host: FUZZ.{domain}", "-w", "{wordlist:subdomains_500}"]
|
|
59
|
+
|
|
60
|
+
[learning.recipes.theory]
|
|
61
|
+
concept = "Host-Header Based Virtual Hosting (RFC 7230 / RFC 9112)"
|
|
62
|
+
explanation = """
|
|
63
|
+
Modern web servers (Nginx, Apache, Cloudflare) host hundreds of independent applications on a single public IP address using Name-Based Virtual Hosting.
|
|
64
|
+
When a request arrives, the server checks the 'Host' header to determine which application configuration to route the connection to.
|
|
65
|
+
By keeping the target IP constant and fuzzing the Host header (e.g. dev.example.com, staging.example.com, api.example.com), attackers discover non-public applications that have no public DNS records.
|
|
66
|
+
"""
|
|
67
|
+
packet_wire_summary = "Client GET / HTTP/1.1 -> Host: dev.example.com -> Server routes to internal staging application"
|
|
68
|
+
remediation = "Configure default server blocks (catch-all) to drop or reject unknown Host headers with 421 Misdirected Request or 404."
|
|
69
|
+
|
|
70
|
+
[[learning.recipes]]
|
|
71
|
+
name = "Hidden Parameter Discovery"
|
|
72
|
+
difficulty = "Intermediate"
|
|
73
|
+
description = "Fuzz URL query parameters to uncover hidden administrative, debug, or developer toggles."
|
|
74
|
+
flags = ["-u", "{url}/?FUZZ=1", "-w", "{wordlist:common_params}", "-mc", "200"]
|
|
75
|
+
|
|
76
|
+
[learning.recipes.theory]
|
|
77
|
+
concept = "HTTP Query Parameter Injection & Hidden Endpoint Logic"
|
|
78
|
+
explanation = """
|
|
79
|
+
Developers often embed hidden parameters for testing, administration, or debugging (e.g. ?debug=true, ?admin=1, ?test=1, ?load=secrets).
|
|
80
|
+
Parameter fuzzing tests dictionary words as query keys. When a valid parameter key is evaluated by the backend script, the response typically shifts in length, status code, or response time.
|
|
81
|
+
"""
|
|
82
|
+
packet_wire_summary = "Client GET /index.php?debug=1 -> Backend activates verbose debug output and reveals stack traces"
|
|
83
|
+
remediation = "Remove all testing and debug toggles prior to production deployment; implement strict parameter allowlists."
|
|
84
|
+
|
|
85
|
+
[[learning.recipes]]
|
|
86
|
+
name = "Backup & Configuration File Exposure"
|
|
87
|
+
difficulty = "Intermediate"
|
|
88
|
+
description = "Fuzz common filenames coupled with risky extensions (.bak, .old, .env, .git) to detect configuration leaks."
|
|
89
|
+
flags = ["-u", "{url}/FUZZ", "-w", "{wordlist:common_dirs}", "-e", ".env,.git,.bak,.old,.json,.txt,.php"]
|
|
90
|
+
|
|
91
|
+
[learning.recipes.theory]
|
|
92
|
+
concept = "Sensitive Artifact Disclosure & Backup File Leaks (CWE-530)"
|
|
93
|
+
explanation = """
|
|
94
|
+
Text editors and sysadmins often leave temporary backup copies of production source code or configuration files in the web root (e.g., config.php.bak, index.php.old, .env).
|
|
95
|
+
Unlike executable .php files that are parsed by the server engine before sending output, backup extensions are served as plain text (text/plain), exposing database passwords, API secrets, and encryption keys.
|
|
96
|
+
"""
|
|
97
|
+
packet_wire_summary = "Client GET /.env HTTP/1.1 -> Server 200 OK -> Content-Type: text/plain -> DB_PASSWORD=secret"
|
|
98
|
+
remediation = "Prohibit backup files in the webroot via server configuration rules (e.g. Nginx 'location ~ /\\.(?!well-known).* { deny all; }')."
|
|
99
|
+
|
|
100
|
+
[[learning.recipes]]
|
|
101
|
+
name = "Stealth & Rate-Limited Scanning"
|
|
102
|
+
difficulty = "Advanced"
|
|
103
|
+
description = "Throttle request rate and add jitter to audit targets without triggering rate-limits or exhausting upstream sockets."
|
|
104
|
+
flags = ["-u", "{url}/FUZZ", "-w", "{wordlist:common_dirs}", "-rate", "15", "-p", "0.2"]
|
|
105
|
+
|
|
106
|
+
[learning.recipes.theory]
|
|
107
|
+
concept = "Traffic Shaping, Rate-Limiting & Anti-DDoS Thresholds"
|
|
108
|
+
explanation = """
|
|
109
|
+
Security devices and Web Application Firewalls (WAFs) monitor request volume per client IP using Leaky-Bucket or Token-Bucket algorithms.
|
|
110
|
+
Sending hundreds of requests per second triggers automatic IP banning and socket starvation.
|
|
111
|
+
Configuring '-rate' limits peak requests per second, while '-p' introduces random millisecond pauses (jitter) to blend traffic with human user behavior.
|
|
112
|
+
"""
|
|
113
|
+
packet_wire_summary = "Client limits to 15 req/sec with 200ms randomized jitter -> Evades volume-based IDS tripwires"
|
|
114
|
+
remediation = "Employ behavioral and machine-learning anomaly detection alongside fixed-threshold rate-limiting."
|
|
115
|
+
|
|
116
|
+
[power]
|
|
117
|
+
enabled = true
|
|
118
|
+
suggests = [
|
|
119
|
+
{ target = "web.endpoint", condition = "status_code == 200", tool = "nikto", flags = "-h {target.pik.url}" },
|
|
120
|
+
{ target = "audit.misconfig", condition = "check_id == 'exposed-sensitive-file'", tool = "nuclei", flags = "-u {target.pik.target} -tags exposure" }
|
|
121
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Gobuster tool adapter."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import shlex
|
|
5
|
+
from typing import Any, AsyncIterator, Dict, List
|
|
6
|
+
|
|
7
|
+
from ether.registry.adapter import ToolAdapter
|
|
8
|
+
from ether.registry.wordlists import resolve_wordlist, substitute_wordlist_macros
|
|
9
|
+
from ether.schemas.base import BaseFinding
|
|
10
|
+
from ether.schemas.web import WebEndpoint
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class GobusterAdapter(ToolAdapter):
|
|
14
|
+
"""Adapter for the gobuster directory brute-forcing tool."""
|
|
15
|
+
|
|
16
|
+
URL_FLAG_RE = re.compile(r"-u\s+([^\s]+)")
|
|
17
|
+
STATUS_PATTERN = re.compile(r"(\S+)\s+\(Status:\s+(\d+)\)")
|
|
18
|
+
|
|
19
|
+
def validate_install(self) -> bool:
|
|
20
|
+
return self.is_binary_available("gobuster")
|
|
21
|
+
|
|
22
|
+
def sanitize_output(self, raw_stdout: str) -> str:
|
|
23
|
+
"""Strip Gobuster ASCII banners, progress lines, and separator lines."""
|
|
24
|
+
lines = []
|
|
25
|
+
for line in raw_stdout.splitlines():
|
|
26
|
+
s = line.strip()
|
|
27
|
+
if (
|
|
28
|
+
s.startswith("==")
|
|
29
|
+
or s.startswith("by OJ Reeves")
|
|
30
|
+
or s.startswith("Gobuster v")
|
|
31
|
+
or "[+] " in s
|
|
32
|
+
or s == "Finished"
|
|
33
|
+
):
|
|
34
|
+
continue
|
|
35
|
+
lines.append(line)
|
|
36
|
+
return "\n".join(lines)
|
|
37
|
+
|
|
38
|
+
def build_command(self, target: BaseFinding, params: Dict[str, Any]) -> List[str]:
|
|
39
|
+
args = ["gobuster"]
|
|
40
|
+
|
|
41
|
+
raw_flags = params.get("raw_flags", "")
|
|
42
|
+
if raw_flags:
|
|
43
|
+
url = self.extract_url(target) or ""
|
|
44
|
+
# Substitute centralized wordlist macros
|
|
45
|
+
raw_flags, _ = substitute_wordlist_macros(raw_flags)
|
|
46
|
+
if "{wordlist}" in raw_flags:
|
|
47
|
+
default_wl = resolve_wordlist("common_dirs")
|
|
48
|
+
raw_flags = raw_flags.replace("{wordlist}", str(default_wl))
|
|
49
|
+
|
|
50
|
+
tokens = shlex.split(raw_flags)
|
|
51
|
+
resolved_tokens = []
|
|
52
|
+
for token in tokens:
|
|
53
|
+
if "{url}" in token:
|
|
54
|
+
token = token.replace("{url}", url)
|
|
55
|
+
resolved_tokens.append(token)
|
|
56
|
+
|
|
57
|
+
args.extend(resolved_tokens)
|
|
58
|
+
|
|
59
|
+
return args
|
|
60
|
+
|
|
61
|
+
async def parse_output(
|
|
62
|
+
self, raw_stdout: str, target: BaseFinding, context: Dict[str, Any] = None
|
|
63
|
+
) -> AsyncIterator[BaseFinding]:
|
|
64
|
+
"""Regex parser for gobuster output.
|
|
65
|
+
|
|
66
|
+
Example line: /admin (Status: 200) [Size: 1234]
|
|
67
|
+
"""
|
|
68
|
+
context = context or {}
|
|
69
|
+
|
|
70
|
+
# Base URL to construct full URLs
|
|
71
|
+
base_url = (self.extract_url(target) or "").rstrip("/")
|
|
72
|
+
|
|
73
|
+
# Try to extract base url from command params if not available
|
|
74
|
+
if not base_url:
|
|
75
|
+
raw_flags = context.get("params", {}).get("raw_flags", "")
|
|
76
|
+
url_match = self.URL_FLAG_RE.search(raw_flags)
|
|
77
|
+
if url_match:
|
|
78
|
+
base_url = url_match.group(1).rstrip("/")
|
|
79
|
+
|
|
80
|
+
for line in raw_stdout.splitlines():
|
|
81
|
+
clean_line = self.strip_ansi(line)
|
|
82
|
+
|
|
83
|
+
match = self.STATUS_PATTERN.search(clean_line)
|
|
84
|
+
if match:
|
|
85
|
+
path = match.group(1)
|
|
86
|
+
status_code = int(match.group(2))
|
|
87
|
+
|
|
88
|
+
full_url = f"{base_url}{path}" if base_url else path
|
|
89
|
+
|
|
90
|
+
yield WebEndpoint.create(url=full_url, method="GET", status_code=status_code)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
[meta]
|
|
2
|
+
name = "gobuster"
|
|
3
|
+
description = "High-speed URI directory, file path, and DNS subdomain brute-forcing scanner written in Go."
|
|
4
|
+
one_line_summary = "brute-force hidden directories, files, and endpoints on web servers"
|
|
5
|
+
category = "Web Enumeration"
|
|
6
|
+
categories = ["recon", "web", "brute-force"]
|
|
7
|
+
binary = "gobuster"
|
|
8
|
+
theory = """
|
|
9
|
+
### Protocol Theory & RFC 7230/7231 URI Traversal
|
|
10
|
+
Web servers route incoming HTTP request URIs to disk files or routing handlers. Gobuster executes deterministic dictionary traversal over concurrent worker routines.
|
|
11
|
+
|
|
12
|
+
### Response Classification & Attack Vectors
|
|
13
|
+
* **Status Triage**: Identifies live paths (`200 OK`), redirects (`301/302`), restricted portals (`401/403`), and unhandled application crashes (`500`).
|
|
14
|
+
* **Unlinked Assets**: Discovers administrative consoles (`/admin`), leaked VCS files (`/.git`), and environment configurations (`/.env`).
|
|
15
|
+
* **Extension Permutations**: Appends specific server extensions (`.php`, `.bak`, `.sql`, `.json`) to find exposed backups.
|
|
16
|
+
|
|
17
|
+
### Defensive Hardening & Mitigation
|
|
18
|
+
* **Directory Indexing**: Explicitly disable `Options -Indexes` and default file directory listings.
|
|
19
|
+
* **WAF Rate Limiting**: Deploy IP request rate throttles (e.g. Nginx `limit_req`) to block high-frequency scans.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
[modes]
|
|
23
|
+
learning = true
|
|
24
|
+
power = true
|
|
25
|
+
|
|
26
|
+
[input]
|
|
27
|
+
accepts = ["network.service", "web.endpoint"]
|
|
28
|
+
|
|
29
|
+
[output]
|
|
30
|
+
produces = ["web.endpoint"]
|
|
31
|
+
|
|
32
|
+
[learning]
|
|
33
|
+
enabled = true
|
|
34
|
+
|
|
35
|
+
[[learning.recipes]]
|
|
36
|
+
name = "Standard Directory Discovery"
|
|
37
|
+
difficulty = "Beginner"
|
|
38
|
+
description = "Enumerate common web paths and directories using the bundled wordlist."
|
|
39
|
+
flags = ["dir", "-u", "{url}", "-w", "{wordlist:common_dirs}"]
|
|
40
|
+
|
|
41
|
+
[learning.recipes.theory]
|
|
42
|
+
concept = "HTTP URI Directory Fuzzing & Status Code Triaging (RFC 7231)"
|
|
43
|
+
explanation = """
|
|
44
|
+
Web applications do not expose an index of all valid endpoints unless directory listing is enabled.
|
|
45
|
+
Directory busting systematically requests thousands of common dictionary words (e.g. /admin, /api, /login, /uploads) appended to the target URL.
|
|
46
|
+
Evaluating the HTTP status code (200, 301, 302, 403) reveals hidden administration portals and unprotected REST API resources.
|
|
47
|
+
"""
|
|
48
|
+
packet_wire_summary = "Client GET /word HTTP/1.1 -> Server 200 OK (Resource exists) or 404 Not Found"
|
|
49
|
+
remediation = "Disable directory browsing, enforce authentication on private routes, and log high-frequency 404 status codes."
|
|
50
|
+
|
|
51
|
+
[[learning.recipes]]
|
|
52
|
+
name = "High-Concurrency Accelerated Scan"
|
|
53
|
+
difficulty = "Beginner"
|
|
54
|
+
description = "Accelerate enumeration using a 50-worker thread pool on high-bandwidth networks."
|
|
55
|
+
flags = ["dir", "-u", "{url}", "-w", "{wordlist:common_dirs}", "-t", "50"]
|
|
56
|
+
|
|
57
|
+
[learning.recipes.theory]
|
|
58
|
+
concept = "Thread Pool Concurrency, HTTP Keep-Alive & Socket Reuse"
|
|
59
|
+
explanation = """
|
|
60
|
+
Sequential HTTP requests are constrained by network latency and round-trip times (RTT).
|
|
61
|
+
Configuring '-t 50' spawns 50 concurrent Go routines, establishing persistent HTTP/1.1 connections (Keep-Alive) to reuse TCP sockets and maximize throughput.
|
|
62
|
+
High thread counts must be balanced against server capacity to avoid triggering DDoS protections or crashing fragile web servers.
|
|
63
|
+
"""
|
|
64
|
+
packet_wire_summary = "Client initiates 50 parallel TCP connections reusing HTTP Keep-Alive pipelines"
|
|
65
|
+
remediation = "Implement edge rate limiting and Web Application Firewall (WAF) threshold blocking."
|
|
66
|
+
|
|
67
|
+
[[learning.recipes]]
|
|
68
|
+
name = "File Extension & Script Enumeration"
|
|
69
|
+
difficulty = "Intermediate"
|
|
70
|
+
description = "Discover server-side scripts, database exports, and backup files by appending specific extensions."
|
|
71
|
+
flags = ["dir", "-u", "{url}", "-w", "{wordlist:common_dirs}", "-x", "php,html,json,txt,bak"]
|
|
72
|
+
|
|
73
|
+
[learning.recipes.theory]
|
|
74
|
+
concept = "MIME Type Handling & Script Execution Architectures"
|
|
75
|
+
explanation = """
|
|
76
|
+
Web frameworks handle files differently based on extension:
|
|
77
|
+
- .php/.py/.aspx: Executed by backend interpreters before rendering HTML.
|
|
78
|
+
- .bak/.old/.txt: Served as static raw files, frequently exposing source code or hardcoded credentials.
|
|
79
|
+
The '-x' flag appends each extension to every dictionary word, checking for /index.php, /config.bak, and /database.sql.
|
|
80
|
+
"""
|
|
81
|
+
packet_wire_summary = "Client GET /config.bak HTTP/1.1 -> Server 200 OK text/plain -> Database credentials revealed"
|
|
82
|
+
remediation = "Prohibit backup file creation in webroot; configure web server rules to deny access to .bak, .old, and .env files."
|
|
83
|
+
|
|
84
|
+
[[learning.recipes]]
|
|
85
|
+
name = "Status Code Allowlist & Redirection Filter"
|
|
86
|
+
difficulty = "Intermediate"
|
|
87
|
+
description = "Isolate successful responses and redirects while suppressing permission errors and soft-404 pages."
|
|
88
|
+
flags = ["dir", "-u", "{url}", "-w", "{wordlist:common_dirs}", "-s", "200,204,301,302,307", "-b", ""]
|
|
89
|
+
|
|
90
|
+
[learning.recipes.theory]
|
|
91
|
+
concept = "HTTP Response Semantics & Custom 404 Handling"
|
|
92
|
+
explanation = """
|
|
93
|
+
Some misconfigured web applications return HTTP 200 OK or 302 Redirect for non-existent pages (Soft 404).
|
|
94
|
+
Using '-s' establishes an explicit allowlist of status codes of interest (e.g. 200 OK, 301 Redirect), preventing terminal clutter and false positives.
|
|
95
|
+
"""
|
|
96
|
+
packet_wire_summary = "Client filters incoming responses: Drops 404/500, logs 200/301/302 endpoints"
|
|
97
|
+
remediation = "Ensure web applications return RFC-compliant 404 Not Found or 410 Gone responses for nonexistent resources."
|
|
98
|
+
|
|
99
|
+
[power]
|
|
100
|
+
enabled = true
|
|
101
|
+
suggests = [
|
|
102
|
+
{ target = "web.endpoint", condition = "status_code == 200", tool = "nikto", flags = "-h {target.pik.url}" },
|
|
103
|
+
{ target = "web.endpoint", condition = "status_code == 200", tool = "nuclei", flags = "-u {target.pik.url}" }
|
|
104
|
+
]
|