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.
Files changed (104) hide show
  1. ether/__init__.py +32 -0
  2. ether/assets/wordlists/common_dirs.txt.gz +0 -0
  3. ether/assets/wordlists/common_params.txt.gz +0 -0
  4. ether/assets/wordlists/common_passwords.txt.gz +0 -0
  5. ether/assets/wordlists/common_usernames.txt.gz +0 -0
  6. ether/assets/wordlists/subdomains_500.txt.gz +0 -0
  7. ether/cli/__init__.py +5 -0
  8. ether/cli/__main__.py +8 -0
  9. ether/cli/commands/__init__.py +1 -0
  10. ether/cli/commands/doctor.py +21 -0
  11. ether/cli/commands/graph.py +311 -0
  12. ether/cli/commands/logs.py +45 -0
  13. ether/cli/commands/mcp.py +49 -0
  14. ether/cli/commands/run.py +146 -0
  15. ether/cli/commands/session.py +61 -0
  16. ether/cli/commands/telemetry.py +51 -0
  17. ether/cli/commands/tool.py +131 -0
  18. ether/cli/context.py +71 -0
  19. ether/cli/formatters.py +39 -0
  20. ether/cli/router.py +368 -0
  21. ether/common/__init__.py +201 -0
  22. ether/common/algorithms.py +407 -0
  23. ether/common/canonicalize.py +93 -0
  24. ether/common/context.py +25 -0
  25. ether/common/crypto.py +183 -0
  26. ether/common/embeddings.py +93 -0
  27. ether/common/exceptions.py +13 -0
  28. ether/common/logging.py +386 -0
  29. ether/common/secure_memory.py +159 -0
  30. ether/common/ssrf.py +93 -0
  31. ether/core/__init__.py +25 -0
  32. ether/core/diagnostics.py +368 -0
  33. ether/core/executor.py +296 -0
  34. ether/core/sandbox.py +118 -0
  35. ether/core/session.py +956 -0
  36. ether/gateway/__init__.py +21 -0
  37. ether/gateway/gate.py +392 -0
  38. ether/gateway/network.py +98 -0
  39. ether/gateway/preflight.py +802 -0
  40. ether/graph/__init__.py +13 -0
  41. ether/graph/analytics.py +334 -0
  42. ether/graph/store.py +1615 -0
  43. ether/graph/telemetry.py +334 -0
  44. ether/graph/timeline.py +185 -0
  45. ether/mcp/__init__.py +5 -0
  46. ether/mcp/server.py +382 -0
  47. ether/paths.py +176 -0
  48. ether/py.typed +0 -0
  49. ether/registry/__init__.py +7 -0
  50. ether/registry/adapter.py +194 -0
  51. ether/registry/manifest.py +53 -0
  52. ether/registry/registry.py +150 -0
  53. ether/registry/wordlists.py +156 -0
  54. ether/schemas/__init__.py +50 -0
  55. ether/schemas/base.py +122 -0
  56. ether/schemas/credential.py +50 -0
  57. ether/schemas/dns.py +116 -0
  58. ether/schemas/host_internal.py +58 -0
  59. ether/schemas/network.py +142 -0
  60. ether/schemas/power.py +68 -0
  61. ether/schemas/vulnerability.py +221 -0
  62. ether/schemas/web.py +172 -0
  63. ether_core-0.1.0.dist-info/METADATA +440 -0
  64. ether_core-0.1.0.dist-info/RECORD +104 -0
  65. ether_core-0.1.0.dist-info/WHEEL +4 -0
  66. ether_core-0.1.0.dist-info/entry_points.txt +2 -0
  67. ether_core-0.1.0.dist-info/licenses/LICENSE +21 -0
  68. tools/__init__.py +0 -0
  69. tools/dnspython/__init__.py +1 -0
  70. tools/dnspython/adapter.py +302 -0
  71. tools/dnspython/cli.py +202 -0
  72. tools/dnspython/manifest.toml +138 -0
  73. tools/ffuf/__init__.py +1 -0
  74. tools/ffuf/adapter.py +183 -0
  75. tools/ffuf/manifest.toml +121 -0
  76. tools/gobuster/__init__.py +0 -0
  77. tools/gobuster/adapter.py +90 -0
  78. tools/gobuster/manifest.toml +104 -0
  79. tools/http_probe/adapter.py +256 -0
  80. tools/http_probe/manifest.toml +40 -0
  81. tools/netexec/__init__.py +1 -0
  82. tools/netexec/adapter.py +163 -0
  83. tools/netexec/manifest.toml +83 -0
  84. tools/nikto/__init__.py +0 -0
  85. tools/nikto/adapter.py +145 -0
  86. tools/nikto/manifest.toml +108 -0
  87. tools/nmap/__init__.py +0 -0
  88. tools/nmap/adapter.py +97 -0
  89. tools/nmap/manifest.toml +159 -0
  90. tools/nuclei/__init__.py +1 -0
  91. tools/nuclei/adapter.py +171 -0
  92. tools/nuclei/manifest.toml +117 -0
  93. tools/searchsploit/__init__.py +1 -0
  94. tools/searchsploit/adapter.py +139 -0
  95. tools/searchsploit/manifest.toml +103 -0
  96. tools/sqlmap/__init__.py +1 -0
  97. tools/sqlmap/adapter.py +214 -0
  98. tools/sqlmap/manifest.toml +89 -0
  99. tools/subfinder/__init__.py +0 -0
  100. tools/subfinder/adapter.py +71 -0
  101. tools/subfinder/manifest.toml +104 -0
  102. tools/whois/__init__.py +0 -0
  103. tools/whois/adapter.py +80 -0
  104. tools/whois/manifest.toml +95 -0
@@ -0,0 +1,256 @@
1
+ """Pure-Python HTTP Probe tool adapter with SSRF defense."""
2
+
3
+ import re
4
+ import urllib.parse
5
+ from typing import Any, AsyncIterator, Dict, List, Optional
6
+
7
+ from ether.common.context import ExecutionContext
8
+ from ether.common.exceptions import PolicyViolationError
9
+ from ether.common.ssrf import check_ssrf_safety
10
+ from ether.registry.adapter import ToolAdapter
11
+ from ether.schemas.base import BaseFinding
12
+ from ether.schemas.network import NetworkHost, NetworkService, TLSCertificate
13
+ from ether.schemas.web import WebEndpoint, WebTechnology
14
+
15
+
16
+ class HTTPProbeAdapter(ToolAdapter):
17
+ """Native coroutine adapter for HTTP probing and banner grabbing."""
18
+
19
+ execution_tier = "coroutine"
20
+
21
+ def validate_install(self) -> bool:
22
+ """HTTP probe is a pure-Python adapter relying on httpx."""
23
+ try:
24
+ import httpx # noqa: F401
25
+
26
+ return True
27
+ except ImportError:
28
+ return False
29
+
30
+ def build_command(self, target: BaseFinding, params: Dict[str, Any]) -> List[str]:
31
+ """Shim for CLI command building if ever invoked via subprocess."""
32
+ return ["http_probe", str(target.pik)]
33
+
34
+ async def parse_output(
35
+ self, raw_stdout: str, target: BaseFinding, context: Dict[str, Any] = None
36
+ ) -> AsyncIterator[BaseFinding]:
37
+ """Shim for parsing raw output (fuzz resilience)."""
38
+ return
39
+ yield # Make it an async generator
40
+
41
+ async def execute_action(
42
+ self,
43
+ target: BaseFinding,
44
+ params: Dict[str, Any],
45
+ context: ExecutionContext,
46
+ ) -> AsyncIterator[BaseFinding]:
47
+ """Execute in-process HTTP probe with pre-connect SSRF defense."""
48
+ import httpx
49
+
50
+ # 1. Determine target URL
51
+ url: Optional[str] = None
52
+ host_ip: Optional[str] = None
53
+ port: Optional[int] = None
54
+
55
+ if target.schema_type == "web.endpoint":
56
+ url = target.pik.get("url") or target.data.get("url")
57
+ host_ip = target.data.get("host_ip") or (
58
+ target.parent.target_pik.get("host_ip") if target.parent else None
59
+ )
60
+ port = target.data.get("port") or (
61
+ target.parent.target_pik.get("port") if target.parent else None
62
+ )
63
+ elif target.schema_type == "network.service":
64
+ host_ip = target.pik.get("host_ip") or target.data.get("host_ip")
65
+ port = int(target.pik.get("port") or target.data.get("port", 80))
66
+ scheme = "https" if port in (443, 8443) else "http"
67
+ url = f"{scheme}://{host_ip}:{port}/"
68
+ elif target.schema_type == "network.host":
69
+ host_ip = target.pik.get("ip") or target.data.get("ip")
70
+ url = f"http://{host_ip}/"
71
+ elif target.schema_type in ("dns.record", "domain.info"):
72
+ domain = (
73
+ target.pik.get("domain")
74
+ or target.data.get("domain")
75
+ or target.pik.get("name")
76
+ or target.data.get("name")
77
+ )
78
+ url = f"http://{domain}/"
79
+
80
+ if not url:
81
+ url = params.get("url") or params.get("target")
82
+
83
+ if not url:
84
+ await context.spool_line(
85
+ f"[-] Target {target.schema_type} missing valid URL/host",
86
+ is_error=True,
87
+ )
88
+ return
89
+
90
+ if not url.startswith(("http://", "https://")):
91
+ url = f"http://{url}"
92
+
93
+ # 2. SSRF Pre-Connect Defense
94
+ policy = params.get("policy", "safe")
95
+ if policy == "safe":
96
+ try:
97
+ check_ssrf_safety(url)
98
+ except PolicyViolationError as e:
99
+ await context.spool_line(f"[!] SSRF Defense Triggered: {e}", is_error=True)
100
+ raise
101
+
102
+ # 3. Request execution with httpx
103
+ timeout_sec = float(params.get("timeout", 10.0))
104
+ limits = httpx.Limits(max_connections=50, max_keepalive_connections=20)
105
+ transport = httpx.AsyncHTTPTransport(retries=1, verify=False)
106
+
107
+ await context.spool_line(f"[*] Probing {url} (timeout={timeout_sec}s)...")
108
+
109
+ parsed_url = urllib.parse.urlparse(url)
110
+ hostname = parsed_url.hostname or ""
111
+ scheme = parsed_url.scheme
112
+ port = parsed_url.port or (443 if scheme == "https" else 80)
113
+
114
+ # Pre-resolve host IP if not already set
115
+ if not host_ip:
116
+ import socket
117
+
118
+ try:
119
+ addrs = socket.getaddrinfo(hostname, port)
120
+ if addrs:
121
+ host_ip = addrs[0][4][0]
122
+ except Exception:
123
+ pass
124
+
125
+ # 4. Extract TLS certificate fingerprint if HTTPS
126
+ tls_fingerprint: Optional[str] = params.get("tls_cert_sha256") or params.get(
127
+ "tls_fingerprint"
128
+ )
129
+ if not tls_fingerprint and scheme == "https":
130
+ import hashlib
131
+ import socket
132
+ import ssl
133
+
134
+ try:
135
+ ssl_ctx = ssl.create_default_context()
136
+ ssl_ctx.check_hostname = False
137
+ ssl_ctx.verify_mode = ssl.CERT_NONE
138
+ with socket.create_connection(
139
+ (hostname, port), timeout=min(timeout_sec, 5.0)
140
+ ) as sock:
141
+ with ssl_ctx.wrap_socket(sock, server_hostname=hostname) as ssock:
142
+ cert_der = ssock.getpeercert(binary_form=True)
143
+ if cert_der:
144
+ tls_fingerprint = hashlib.sha256(cert_der).hexdigest()
145
+ await context.spool_line(
146
+ f"[+] TLS Certificate SHA-256: {tls_fingerprint}"
147
+ )
148
+ except Exception as ssl_err:
149
+ await context.spool_line(
150
+ f"[-] Could not retrieve TLS certificate directly: {ssl_err}"
151
+ )
152
+
153
+ async with httpx.AsyncClient(
154
+ transport=transport,
155
+ verify=False,
156
+ timeout=httpx.Timeout(timeout_sec, connect=5.0),
157
+ follow_redirects=True,
158
+ limits=limits,
159
+ ) as client:
160
+ try:
161
+ response = await client.get(url)
162
+ except Exception as exc:
163
+ await context.spool_line(
164
+ f"[-] HTTP request to {url} failed: {type(exc).__name__} ({exc})",
165
+ is_error=True,
166
+ )
167
+ return
168
+
169
+ status = response.status_code
170
+ headers = dict(response.headers)
171
+ server = headers.get("server", "").strip()
172
+ x_powered = headers.get("x-powered-by", "").strip()
173
+
174
+ await context.spool_line(f"[+] HTTP {status} {response.reason_phrase} - {url}")
175
+ for h_name, h_val in headers.items():
176
+ await context.spool_line(f" {h_name}: {h_val}")
177
+
178
+ # Extract <title>
179
+ title: Optional[str] = None
180
+ title_match = re.search(
181
+ r"<title[^>]*>(.*?)</title>", response.text, re.IGNORECASE | re.DOTALL
182
+ )
183
+ if title_match:
184
+ title = title_match.group(1).strip()
185
+ await context.spool_line(f"[+] Page Title: {title}")
186
+
187
+ # 5. Extract Favicon hash
188
+ favicon_hash: Optional[str] = params.get("favicon_hash")
189
+ if not favicon_hash:
190
+ import hashlib
191
+
192
+ favicon_url = urllib.parse.urljoin(url, "/favicon.ico")
193
+ try:
194
+ fav_resp = await client.get(favicon_url)
195
+ if fav_resp.status_code == 200 and fav_resp.content:
196
+ favicon_hash = hashlib.sha256(fav_resp.content).hexdigest()
197
+ await context.spool_line(f"[+] Favicon Hash (SHA-256): {favicon_hash}")
198
+ except Exception:
199
+ pass
200
+
201
+ # 6. Emit findings
202
+ if host_ip:
203
+ yield NetworkHost.create(ip=host_ip)
204
+
205
+ tls_anchor = f"tls:{tls_fingerprint}" if tls_fingerprint else None
206
+ svc = NetworkService.create(
207
+ host_ip=host_ip or hostname,
208
+ port=port,
209
+ protocol="tcp",
210
+ service_name=scheme,
211
+ banner=server or None,
212
+ tls_cert_sha256=tls_fingerprint,
213
+ anchor_hash=tls_anchor,
214
+ )
215
+ yield svc
216
+
217
+ if tls_fingerprint:
218
+ yield TLSCertificate.create(
219
+ fingerprint=tls_fingerprint,
220
+ host_ip=host_ip or hostname,
221
+ port=port,
222
+ anchor_hash=tls_anchor,
223
+ )
224
+
225
+ endpoint_anchor = (
226
+ tls_anchor if tls_anchor else (f"favicon:{favicon_hash}" if favicon_hash else None)
227
+ )
228
+ endpoint = WebEndpoint.create(
229
+ url=url,
230
+ host_ip=host_ip,
231
+ port=port,
232
+ status_code=status,
233
+ title=title,
234
+ server=server,
235
+ favicon_hash=favicon_hash,
236
+ anchor_hash=endpoint_anchor,
237
+ )
238
+ yield endpoint
239
+
240
+ if server:
241
+ yield WebTechnology.create(
242
+ url=url,
243
+ technology_name=server,
244
+ categories=["web-server"],
245
+ host_ip=host_ip,
246
+ port=port,
247
+ )
248
+
249
+ if x_powered:
250
+ yield WebTechnology.create(
251
+ url=url,
252
+ technology_name=x_powered,
253
+ categories=["framework"],
254
+ host_ip=host_ip,
255
+ port=port,
256
+ )
@@ -0,0 +1,40 @@
1
+ [meta]
2
+ name = "http_probe"
3
+ description = "Pure-Python asynchronous HTTP discovery, banner grabbing, and web technology identification engine."
4
+ one_line_summary = "zero-binary in-process HTTP discovery engine"
5
+ category = "Web Reconnaissance"
6
+ categories = ["recon", "web", "http"]
7
+ binary = ""
8
+ execution_tier = "coroutine"
9
+ theory = """
10
+ ### HTTP Protocol Discovery & RFC 9110/9112 Mechanics
11
+ High-performance asynchronous HTTP/1.1 and HTTP/2 probing extracts service banners, response codes, page titles, and web technologies directly in-process without spawning external processes.
12
+
13
+ ### Pre-Connect SSRF Defense
14
+ Under `GatePolicy.SAFE`, every target endpoint is resolved via DNS before initiating TCP connections. Any destination mapping to cloud metadata (169.254.169.254, fd00:ec2::254), loopback (127.0.0.0/8, ::1), or link-local subnets is aborted with `PolicyViolationError` to prevent Server-Side Request Forgery.
15
+ """
16
+
17
+ [modes]
18
+ learning = true
19
+ power = true
20
+
21
+ [input]
22
+ accepts = ["web.endpoint", "network.service", "network.host", "dns.record", "domain.info"]
23
+
24
+ [output]
25
+ produces = ["web.endpoint", "network.service", "web.technology"]
26
+
27
+ [learning]
28
+ enabled = true
29
+
30
+ [[learning.recipes]]
31
+ name = "HTTP Service Header & Title Audit"
32
+ difficulty = "Beginner"
33
+ description = "Perform HTTP GET and HEAD requests to inspect response codes, server banners, and HTML title."
34
+ flags = []
35
+
36
+ [learning.recipes.theory]
37
+ concept = "Hypertext Transfer Protocol (RFC 9110)"
38
+ explanation = "Probes HTTP services to identify server versions, redirection targets, and technology fingerprints."
39
+ packet_wire_summary = "Client TCP:80/443 -> GET / HTTP/1.1 -> Server 200 OK"
40
+ remediation = "Disable descriptive Server and X-Powered-By HTTP response headers to reduce technology fingerprinting."
@@ -0,0 +1 @@
1
+ """NetExec tool package."""
@@ -0,0 +1,163 @@
1
+ """NetExec (nxc) tool adapter."""
2
+
3
+ import re
4
+ import shlex
5
+ import shutil
6
+ from typing import Any, AsyncIterator, Dict, List, Optional
7
+
8
+ from ether.registry.adapter import ToolAdapter
9
+ from ether.registry.wordlists import substitute_wordlist_macros
10
+ from ether.schemas.base import BaseFinding
11
+ from ether.schemas.credential import CredentialFound
12
+ from ether.schemas.network import NetworkHost, NetworkService
13
+ from ether.schemas.vulnerability import AuditMisconfig
14
+
15
+
16
+ class NetexecAdapter(ToolAdapter):
17
+ """Adapter for the NetExec network execution and credential spraying tool."""
18
+
19
+ LINE_RE = re.compile(
20
+ r"^(?P<proto>[A-Z0-9]+)\s+(?P<ip>[0-9a-fA-F\.:]+)\s+(?P<port>\d+)\s+(?P<hostname>\S+)\s+(?P<status>\[[\+\-\*]\])\s+(?P<message>.*)$"
21
+ )
22
+ CRED_RE = re.compile(
23
+ r"(?:(?P<domain>[^\s\\:]+)\\)?(?P<user>[^:\s]+):(?P<pass>\S+)(?:\s+\((?P<pwn3d>[^)]+)\))?"
24
+ )
25
+
26
+ def validate_install(self) -> bool:
27
+ """Check if nxc or netexec binary is present in system PATH."""
28
+ return self.is_binary_available("nxc") or self.is_binary_available("netexec")
29
+
30
+ def sanitize_output(self, raw_stdout: str) -> str:
31
+ """Strip NetExec startup headers and noise lines."""
32
+ lines = []
33
+ for line in raw_stdout.splitlines():
34
+ s = line.strip()
35
+ if (
36
+ s.startswith("NetExec v")
37
+ or "[*] NetExec Active Directory" in s
38
+ or s.startswith("---")
39
+ ):
40
+ continue
41
+ lines.append(line)
42
+ return "\n".join(lines)
43
+
44
+ def build_command(self, target: BaseFinding, params: Dict[str, Any]) -> List[str]:
45
+ """Construct NetExec command line execution arguments."""
46
+ bin_name = "nxc" if shutil.which("nxc") else "netexec"
47
+
48
+ target_addr = self.extract_host(target)
49
+
50
+ raw_flags = params.get("raw_flags", "").strip()
51
+ raw_flags, _ = substitute_wordlist_macros(raw_flags)
52
+ flag_args = shlex.split(raw_flags) if raw_flags else []
53
+
54
+ args = [bin_name]
55
+
56
+ # 1. Check if protocol is already in flag_args (e.g. smb, ssh, ldap, winrm)
57
+ known_protocols = {"smb", "ssh", "ldap", "winrm", "wmi", "mssql", "rdp", "vnc", "ftp"}
58
+ has_protocol = bool(flag_args and flag_args[0].lower() in known_protocols)
59
+
60
+ if not has_protocol:
61
+ args.append("smb")
62
+
63
+ # 2. Check if target address is provided in flag_args
64
+ if not any(arg == target_addr for arg in flag_args):
65
+ if not target_addr:
66
+ raise ValueError(
67
+ f"Target finding {target.schema_type} has no IP or host address, and none provided in flags."
68
+ )
69
+ # Insert target right after protocol if protocol was in flag_args[0], else append
70
+ args.append(target_addr)
71
+
72
+ args.extend(flag_args)
73
+ return args
74
+
75
+ def _extract_target(self, target: BaseFinding) -> Optional[str]:
76
+ return self.extract_host(target)
77
+
78
+ async def parse_output(
79
+ self, raw_stdout: str, target: BaseFinding, context: Dict[str, Any] = None
80
+ ) -> AsyncIterator[BaseFinding]:
81
+ """Parse NetExec stdout into NetworkHost, NetworkService, AuditMisconfig, and CredentialFound findings."""
82
+ cleaned = raw_stdout.strip()
83
+ if not cleaned:
84
+ return
85
+
86
+ seen_hosts = set()
87
+ seen_services = set()
88
+ seen_misconfigs = set()
89
+ seen_creds = set()
90
+
91
+ for line in cleaned.splitlines():
92
+ line_str = line.strip()
93
+ match = self.LINE_RE.match(line_str)
94
+ if not match:
95
+ continue
96
+
97
+ proto = match.group("proto").lower()
98
+ ip = match.group("ip")
99
+ port = int(match.group("port"))
100
+ hostname = match.group("hostname")
101
+ status = match.group("status")
102
+ message = match.group("message").strip()
103
+
104
+ # 1. Register host and service
105
+ if ip not in seen_hosts:
106
+ seen_hosts.add(ip)
107
+ yield NetworkHost.create(ip=ip, hostname=hostname if hostname != ip else None)
108
+
109
+ service_key = (ip, port, proto)
110
+ if service_key not in seen_services:
111
+ seen_services.add(service_key)
112
+ yield NetworkService.create(
113
+ host_ip=ip,
114
+ port=port,
115
+ protocol="tcp",
116
+ service_name=proto,
117
+ )
118
+
119
+ # 2. Check for SMB signing misconfiguration
120
+ if "signing:False" in message:
121
+ misconfig_key = (ip, port, "smb_signing_disabled")
122
+ if misconfig_key not in seen_misconfigs:
123
+ seen_misconfigs.add(misconfig_key)
124
+ yield AuditMisconfig.create(
125
+ target=f"{proto}://{ip}:{port}",
126
+ check_id="smb_signing_disabled",
127
+ title="SMB Signing Disabled",
128
+ severity="medium",
129
+ description=(
130
+ f"Host {hostname} ({ip}) does not require SMB signing, "
131
+ f"exposing the system to NTLM relay attacks."
132
+ ),
133
+ remediation=(
134
+ "Enforce 'Digitally sign communications (always)' in Windows Group Policy."
135
+ ),
136
+ host_ip=ip,
137
+ port=port,
138
+ )
139
+
140
+ # 3. Check for successful credentials [+]
141
+ if status == "[+]":
142
+ cred_match = self.CRED_RE.search(message)
143
+ if cred_match:
144
+ domain = cred_match.group("domain") or "LOCAL"
145
+ user = cred_match.group("user")
146
+ password = cred_match.group("pass")
147
+ pwn3d = bool(cred_match.group("pwn3d"))
148
+
149
+ # Ignore non-credential success lines like "[+] Enumerated shares:"
150
+ if user.lower() in ("enumerated", "pwn3d!", "shares:"):
151
+ continue
152
+
153
+ cred_key = (domain, user, password, ip)
154
+ if cred_key not in seen_creds:
155
+ seen_creds.add(cred_key)
156
+ yield CredentialFound.create(
157
+ context=f"{proto}://{domain}",
158
+ username=user,
159
+ password=password,
160
+ host_ip=ip,
161
+ pwn3d=pwn3d,
162
+ domain=domain,
163
+ )
@@ -0,0 +1,83 @@
1
+ [meta]
2
+ name = "netexec"
3
+ description = "High-performance network execution and credential spraying tool (successor to CrackMapExec) automating assessment and exploitation of Active Directory, SMB, SSH, WinRM, and LDAP services."
4
+ one_line_summary = "Active Directory & network credential spraying Swiss army knife"
5
+ category = "Network Reconnaissance"
6
+ categories = ["network", "recon", "exploit", "active_directory"]
7
+ binary = "nxc"
8
+ theory = """
9
+ ### Theory & Active Directory Protocol Auditing
10
+ In enterprise Windows environments, authentication and administration rely heavily on multi-layered protocols: Server Message Block (SMB), Kerberos, NTLM, and Lightweight Directory Access Protocol (LDAP). NetExec interfaces directly with these protocols to audit configuration flaws and credential exposures.
11
+
12
+ ### Protocol Mechanics & Attack Surfaces
13
+ * **SMB Signing**: Without cryptographically enforced message signing, attackers can execute Man-in-the-Middle (MitM) attacks and relay intercepted NTLM authentication to secondary network servers (NTLM Relay).
14
+ * **Null & Guest Sessions**: Historical Windows implementations permitted unauthenticated null sessions (`IPC$`), allowing anonymous actors to list domain accounts, password policies, and file shares.
15
+ * **Credential Spraying & Password Spraying**: Testing a single common password against hundreds of domain users avoids account lockout thresholds while discovering weak accounts.
16
+ * **Pwn3d Status**: Indicates that authenticated credentials possess local Administrator or Domain Administrator rights, permitting remote command execution (via PsExec, WMI, or WinRM).
17
+
18
+ ### Defensive Hardening & Remediation
19
+ * **Enforce SMB Signing**: Mandate SMB signing via Group Policy (`Microsoft network server: Digitally sign communications (always)`).
20
+ * **Disable NTLM & Migrate to Kerberos**: Decommission legacy NTLMv1 and restrict NTLMv2 using Protected Users security groups.
21
+ * **Account Lockout Policies & Tiered Administration**: Enforce tiered administration (Tier 0 Domain Controllers never logging onto Tier 1/2 workstations) to block lateral credential harvesting.
22
+ """
23
+
24
+ [modes]
25
+ learning = true
26
+ power = true
27
+
28
+ [input]
29
+ accepts = ["network.host", "network.service"]
30
+
31
+ [output]
32
+ produces = ["network.host", "network.service", "audit.misconfig", "credential.found"]
33
+
34
+ [learning]
35
+ enabled = true
36
+
37
+ [[learning.recipes]]
38
+ name = "SMB Protocol Discovery & Signing Audit"
39
+ difficulty = "Beginner"
40
+ description = "Enumerate Windows workstations and domain controllers to verify SMB signing enforcement and OS versions."
41
+ flags = ["smb", "{target}", "--gen-relay-list", "/tmp/relay_targets.txt"]
42
+
43
+ [learning.recipes.theory]
44
+ concept = "SMB Protocol Negotiation & NTLM Relay Vulnerability"
45
+ explanation = """
46
+ 1. What the tool does: Connects to port 445 on target systems, negotiates SMB dialects (SMBv2/SMBv3), and interrogates the server's security flags for mandatory digital signatures.
47
+ 2. Flag selection: 'smb' targets the SMB transport; '--gen-relay-list' outputs systems with signing disabled to a file for relay assessment.
48
+ 3. Security analysis: When 'signing:False' is detected, any intercepted NTLM authentication packet can be relayed to that host to achieve unauthorized execution without cracking the password.
49
+ """
50
+ packet_wire_summary = "Client SMB2 NEGOTIATE_REQ -> Server SMB2 NEGOTIATE_RESP (SecurityMode: Signing Enabled, Not Required)"
51
+ remediation = "Enable 'Digitally sign communications (always)' in Windows GPO under Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options."
52
+
53
+ [[learning.recipes]]
54
+ name = "Null Session & Guest Share Discovery"
55
+ difficulty = "Intermediate"
56
+ description = "Audit target systems for anonymous IPC$ null sessions and unauthenticated network file shares."
57
+ flags = ["smb", "{target}", "-u", "''", "-p", "''", "--shares"]
58
+
59
+ [learning.recipes.theory]
60
+ concept = "Anonymous Access & Network Share Exposure"
61
+ explanation = """
62
+ 1. What the tool does: Attempts an unauthenticated SMB session with blank username and password to query the NetShareEnum RPC function.
63
+ 2. Flag selection: '-u \"\" -p \"\"' specifies null authentication credentials; '--shares' queries accessible file storage shares (e.g. IPC$, C$, SYSVOL, NETLOGON).
64
+ 3. Risk analysis: Accessible network shares frequently expose confidential backups, deployment scripts, cleartext credentials in web.config files, and sensitive spreadsheets.
65
+ """
66
+ packet_wire_summary = "Client SMB2 SESSION_SETUP_REQ (Anonymous) -> Server SMB2 TREE_CONNECT_RESP (IPC$ Access Granted)"
67
+ remediation = "Disable anonymous share enumeration by setting 'RestrictNullSessAccess' to 1 in the Windows Registry."
68
+
69
+ [[learning.recipes]]
70
+ name = "Domain Password Policy & Lockout Inspection"
71
+ difficulty = "Intermediate"
72
+ description = "Retrieve Active Directory password complexity rules and lockout thresholds without triggering lockouts."
73
+ flags = ["smb", "{target}", "-u", "guest", "-p", "''", "--pass-pol"]
74
+
75
+ [learning.recipes.theory]
76
+ concept = "Password Policy Reconnaissance & Spray Safety"
77
+ explanation = """
78
+ 1. What the tool does: Queries the SAM and LSA subsystem via RPC to extract domain password length rules, history length, and account lockout thresholds.
79
+ 2. Flag selection: '--pass-pol' extracts minimum password length and bad password lockout counts.
80
+ 3. Assessment safety: Professional penetration testers always verify lockout thresholds before password spraying to prevent locking out entire enterprise departments.
81
+ """
82
+ packet_wire_summary = "Client SAMR QueryInformationDomain -> Server returns LockoutThreshold: 5, LockoutDuration: 30m"
83
+ remediation = "Enforce a minimum password length of 15+ characters with multi-factor authentication (MFA) on all domain accounts."
File without changes