zen-ai-pentest 2.0.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 (75) hide show
  1. agents/__init__.py +28 -0
  2. agents/agent_base.py +239 -0
  3. agents/agent_orchestrator.py +346 -0
  4. agents/analysis_agent.py +225 -0
  5. agents/cli.py +258 -0
  6. agents/exploit_agent.py +224 -0
  7. agents/integration.py +211 -0
  8. agents/post_scan_agent.py +937 -0
  9. agents/react_agent.py +384 -0
  10. agents/react_agent_enhanced.py +616 -0
  11. agents/react_agent_vm.py +298 -0
  12. agents/research_agent.py +176 -0
  13. api/__init__.py +11 -0
  14. api/auth.py +123 -0
  15. api/main.py +1027 -0
  16. api/schemas.py +357 -0
  17. api/websocket.py +97 -0
  18. autonomous/__init__.py +122 -0
  19. autonomous/agent.py +253 -0
  20. autonomous/agent_loop.py +1370 -0
  21. autonomous/exploit_validator.py +1537 -0
  22. autonomous/memory.py +448 -0
  23. autonomous/react.py +339 -0
  24. autonomous/tool_executor.py +488 -0
  25. backends/__init__.py +16 -0
  26. backends/chatgpt_direct.py +133 -0
  27. backends/claude_direct.py +130 -0
  28. backends/duckduckgo.py +138 -0
  29. backends/openrouter.py +120 -0
  30. benchmarks/__init__.py +149 -0
  31. benchmarks/benchmark_engine.py +904 -0
  32. benchmarks/ci_benchmark.py +785 -0
  33. benchmarks/comparison.py +729 -0
  34. benchmarks/metrics.py +553 -0
  35. benchmarks/run_benchmarks.py +809 -0
  36. ci_cd/__init__.py +2 -0
  37. core/__init__.py +17 -0
  38. core/async_pool.py +282 -0
  39. core/asyncio_fix.py +222 -0
  40. core/cache.py +472 -0
  41. core/container.py +277 -0
  42. core/database.py +114 -0
  43. core/input_validator.py +353 -0
  44. core/models.py +288 -0
  45. core/orchestrator.py +611 -0
  46. core/plugin_manager.py +571 -0
  47. core/rate_limiter.py +405 -0
  48. core/secure_config.py +328 -0
  49. core/shield_integration.py +296 -0
  50. modules/__init__.py +46 -0
  51. modules/cve_database.py +362 -0
  52. modules/exploit_assist.py +330 -0
  53. modules/nuclei_integration.py +480 -0
  54. modules/osint.py +604 -0
  55. modules/protonvpn.py +554 -0
  56. modules/recon.py +165 -0
  57. modules/sql_injection_db.py +826 -0
  58. modules/tool_orchestrator.py +498 -0
  59. modules/vuln_scanner.py +292 -0
  60. modules/wordlist_generator.py +566 -0
  61. risk_engine/__init__.py +99 -0
  62. risk_engine/business_impact.py +267 -0
  63. risk_engine/business_impact_calculator.py +563 -0
  64. risk_engine/cvss.py +156 -0
  65. risk_engine/epss.py +190 -0
  66. risk_engine/example_usage.py +294 -0
  67. risk_engine/false_positive_engine.py +1073 -0
  68. risk_engine/scorer.py +304 -0
  69. web_ui/backend/main.py +471 -0
  70. zen_ai_pentest-2.0.0.dist-info/METADATA +795 -0
  71. zen_ai_pentest-2.0.0.dist-info/RECORD +75 -0
  72. zen_ai_pentest-2.0.0.dist-info/WHEEL +5 -0
  73. zen_ai_pentest-2.0.0.dist-info/entry_points.txt +2 -0
  74. zen_ai_pentest-2.0.0.dist-info/licenses/LICENSE +21 -0
  75. zen_ai_pentest-2.0.0.dist-info/top_level.txt +10 -0
modules/recon.py ADDED
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Reconnaissance Module
4
+ Intelligent target reconnaissance using LLM analysis
5
+ Author: SHAdd0WTAka
6
+ """
7
+
8
+ import asyncio
9
+ import logging
10
+ import socket
11
+ import subprocess
12
+ from typing import Dict, List, Optional
13
+
14
+ logger = logging.getLogger("ZenAI")
15
+
16
+
17
+ class ReconModule:
18
+ """
19
+ Automated reconnaissance with LLM-powered analysis
20
+ """
21
+
22
+ def __init__(self, orchestrator):
23
+ self.orchestrator = orchestrator
24
+ self.results = {}
25
+
26
+ async def analyze_target(self, target: str) -> Dict:
27
+ """
28
+ Perform comprehensive target analysis
29
+ """
30
+ logger.info(f"[Recon] Starting analysis of {target}")
31
+
32
+ # Gather basic info
33
+ target_info = {
34
+ "target": target,
35
+ "ip": await self._resolve_ip(target),
36
+ "dns_records": await self._get_dns_records(target),
37
+ "whois": await self._get_whois(target),
38
+ }
39
+
40
+ # Use LLM to analyze and suggest next steps
41
+ prompt = f"""
42
+ Analyze this target for penetration testing:
43
+ Target: {target}
44
+ IP: {target_info['ip']}
45
+ DNS Records: {target_info['dns_records']}
46
+
47
+ Provide a structured reconnaissance plan including:
48
+ 1. Potential attack vectors
49
+ 2. Suggested tools (nmap, gobuster, etc.)
50
+ 3. Likely vulnerabilities based on common patterns
51
+ 4. OSINT sources to check
52
+ """
53
+
54
+ llm_response = await self.orchestrator.process(prompt)
55
+
56
+ target_info["llm_analysis"] = llm_response.content
57
+ target_info["attack_vectors"] = self._parse_attack_vectors(llm_response.content)
58
+
59
+ self.results[target] = target_info
60
+ return target_info
61
+
62
+ async def _resolve_ip(self, target: str) -> str:
63
+ """Resolve target to IP address"""
64
+ try:
65
+ ip = socket.gethostbyname(target)
66
+ return ip
67
+ except:
68
+ return "Could not resolve"
69
+
70
+ async def _get_dns_records(self, target: str) -> List[str]:
71
+ """Get DNS records for target"""
72
+ records = []
73
+ record_types = ["A", "MX", "NS", "TXT", "CNAME"]
74
+
75
+ for rtype in record_types:
76
+ try:
77
+ result = subprocess.run(
78
+ ["nslookup", "-type=" + rtype, target],
79
+ capture_output=True,
80
+ text=True,
81
+ timeout=10,
82
+ )
83
+ if result.returncode == 0:
84
+ records.append(f"{rtype}: {result.stdout[:200]}...")
85
+ except:
86
+ continue
87
+
88
+ return records if records else ["No DNS records found"]
89
+
90
+ async def _get_whois(self, target: str) -> str:
91
+ """Get WHOIS information"""
92
+ try:
93
+ result = subprocess.run(
94
+ ["whois", target], capture_output=True, text=True, timeout=15
95
+ )
96
+ # Return first 500 chars of relevant info
97
+ return result.stdout[:500] if result.returncode == 0 else "WHOIS failed"
98
+ except:
99
+ return "WHOIS not available"
100
+
101
+ def _parse_attack_vectors(self, llm_content: str) -> List[str]:
102
+ """Extract attack vectors from LLM response"""
103
+ vectors = []
104
+ lines = llm_content.split("\n")
105
+ for line in lines:
106
+ if any(
107
+ keyword in line.lower()
108
+ for keyword in ["vector", "attack", "exploit", "vulnerability"]
109
+ ):
110
+ vectors.append(line.strip())
111
+ return vectors[:10] # Limit to top 10
112
+
113
+ async def generate_nmap_command(
114
+ self, target: str, intensity: str = "normal"
115
+ ) -> str:
116
+ """
117
+ Generate optimized nmap command based on target analysis
118
+ """
119
+ prompt = f"""
120
+ Generate an nmap command for target {target} with {intensity} intensity.
121
+ Consider:
122
+ - Stealth vs speed requirements
123
+ - Most common ports for web services
124
+ - Version detection
125
+ - Script scanning for vulnerabilities
126
+
127
+ Return ONLY the nmap command, nothing else.
128
+ """
129
+
130
+ response = await self.orchestrator.process(prompt)
131
+ # Extract command from response
132
+ cmd = response.content.strip()
133
+
134
+ # Basic validation
135
+ if not cmd.startswith("nmap"):
136
+ # Fallback to default
137
+ cmd = f"nmap -sV -sC -O {target}"
138
+
139
+ return cmd
140
+
141
+ async def subdomain_enum(self, domain: str, wordlist: str = "common") -> List[str]:
142
+ """
143
+ LLM-assisted subdomain enumeration
144
+ """
145
+ prompt = f"""
146
+ Generate a list of likely subdomains for {domain}.
147
+ Include common patterns like:
148
+ - admin, api, dev, staging, test
149
+ - mail, ftp, vpn, remote
150
+ - www, blog, shop, app
151
+
152
+ Return as a comma-separated list.
153
+ """
154
+
155
+ response = await self.orchestrator.process(prompt)
156
+
157
+ # Parse subdomains from response
158
+ subdomains = []
159
+ for line in response.content.split("\n"):
160
+ for item in line.split(","):
161
+ item = item.strip().lower()
162
+ if item and "." not in item:
163
+ subdomains.append(f"{item}.{domain}")
164
+
165
+ return list(set(subdomains))[:20] # Return unique, limited