aiptx 2.0.2__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.

Potentially problematic release.


This version of aiptx might be problematic. Click here for more details.

Files changed (165) hide show
  1. aipt_v2/__init__.py +110 -0
  2. aipt_v2/__main__.py +24 -0
  3. aipt_v2/agents/AIPTxAgent/__init__.py +10 -0
  4. aipt_v2/agents/AIPTxAgent/aiptx_agent.py +211 -0
  5. aipt_v2/agents/__init__.py +24 -0
  6. aipt_v2/agents/base.py +520 -0
  7. aipt_v2/agents/ptt.py +406 -0
  8. aipt_v2/agents/state.py +168 -0
  9. aipt_v2/app.py +960 -0
  10. aipt_v2/browser/__init__.py +31 -0
  11. aipt_v2/browser/automation.py +458 -0
  12. aipt_v2/browser/crawler.py +453 -0
  13. aipt_v2/cli.py +321 -0
  14. aipt_v2/compliance/__init__.py +71 -0
  15. aipt_v2/compliance/compliance_report.py +449 -0
  16. aipt_v2/compliance/framework_mapper.py +424 -0
  17. aipt_v2/compliance/nist_mapping.py +345 -0
  18. aipt_v2/compliance/owasp_mapping.py +330 -0
  19. aipt_v2/compliance/pci_mapping.py +297 -0
  20. aipt_v2/config.py +288 -0
  21. aipt_v2/core/__init__.py +43 -0
  22. aipt_v2/core/agent.py +630 -0
  23. aipt_v2/core/llm.py +395 -0
  24. aipt_v2/core/memory.py +305 -0
  25. aipt_v2/core/ptt.py +329 -0
  26. aipt_v2/database/__init__.py +14 -0
  27. aipt_v2/database/models.py +232 -0
  28. aipt_v2/database/repository.py +384 -0
  29. aipt_v2/docker/__init__.py +23 -0
  30. aipt_v2/docker/builder.py +260 -0
  31. aipt_v2/docker/manager.py +222 -0
  32. aipt_v2/docker/sandbox.py +371 -0
  33. aipt_v2/evasion/__init__.py +58 -0
  34. aipt_v2/evasion/request_obfuscator.py +272 -0
  35. aipt_v2/evasion/tls_fingerprint.py +285 -0
  36. aipt_v2/evasion/ua_rotator.py +301 -0
  37. aipt_v2/evasion/waf_bypass.py +439 -0
  38. aipt_v2/execution/__init__.py +23 -0
  39. aipt_v2/execution/executor.py +302 -0
  40. aipt_v2/execution/parser.py +544 -0
  41. aipt_v2/execution/terminal.py +337 -0
  42. aipt_v2/health.py +437 -0
  43. aipt_v2/intelligence/__init__.py +85 -0
  44. aipt_v2/intelligence/auth.py +520 -0
  45. aipt_v2/intelligence/chaining.py +775 -0
  46. aipt_v2/intelligence/cve_aipt.py +334 -0
  47. aipt_v2/intelligence/cve_info.py +1111 -0
  48. aipt_v2/intelligence/rag.py +239 -0
  49. aipt_v2/intelligence/scope.py +442 -0
  50. aipt_v2/intelligence/searchers/__init__.py +5 -0
  51. aipt_v2/intelligence/searchers/exploitdb_searcher.py +523 -0
  52. aipt_v2/intelligence/searchers/github_searcher.py +467 -0
  53. aipt_v2/intelligence/searchers/google_searcher.py +281 -0
  54. aipt_v2/intelligence/tools.json +443 -0
  55. aipt_v2/intelligence/triage.py +670 -0
  56. aipt_v2/interface/__init__.py +5 -0
  57. aipt_v2/interface/cli.py +230 -0
  58. aipt_v2/interface/main.py +501 -0
  59. aipt_v2/interface/tui.py +1276 -0
  60. aipt_v2/interface/utils.py +583 -0
  61. aipt_v2/llm/__init__.py +39 -0
  62. aipt_v2/llm/config.py +26 -0
  63. aipt_v2/llm/llm.py +514 -0
  64. aipt_v2/llm/memory.py +214 -0
  65. aipt_v2/llm/request_queue.py +89 -0
  66. aipt_v2/llm/utils.py +89 -0
  67. aipt_v2/models/__init__.py +15 -0
  68. aipt_v2/models/findings.py +295 -0
  69. aipt_v2/models/phase_result.py +224 -0
  70. aipt_v2/models/scan_config.py +207 -0
  71. aipt_v2/monitoring/grafana/dashboards/aipt-dashboard.json +355 -0
  72. aipt_v2/monitoring/grafana/dashboards/default.yml +17 -0
  73. aipt_v2/monitoring/grafana/datasources/prometheus.yml +17 -0
  74. aipt_v2/monitoring/prometheus.yml +60 -0
  75. aipt_v2/orchestration/__init__.py +52 -0
  76. aipt_v2/orchestration/pipeline.py +398 -0
  77. aipt_v2/orchestration/progress.py +300 -0
  78. aipt_v2/orchestration/scheduler.py +296 -0
  79. aipt_v2/orchestrator.py +2284 -0
  80. aipt_v2/payloads/__init__.py +27 -0
  81. aipt_v2/payloads/cmdi.py +150 -0
  82. aipt_v2/payloads/sqli.py +263 -0
  83. aipt_v2/payloads/ssrf.py +204 -0
  84. aipt_v2/payloads/templates.py +222 -0
  85. aipt_v2/payloads/traversal.py +166 -0
  86. aipt_v2/payloads/xss.py +204 -0
  87. aipt_v2/prompts/__init__.py +60 -0
  88. aipt_v2/proxy/__init__.py +29 -0
  89. aipt_v2/proxy/history.py +352 -0
  90. aipt_v2/proxy/interceptor.py +452 -0
  91. aipt_v2/recon/__init__.py +44 -0
  92. aipt_v2/recon/dns.py +241 -0
  93. aipt_v2/recon/osint.py +367 -0
  94. aipt_v2/recon/subdomain.py +372 -0
  95. aipt_v2/recon/tech_detect.py +311 -0
  96. aipt_v2/reports/__init__.py +17 -0
  97. aipt_v2/reports/generator.py +313 -0
  98. aipt_v2/reports/html_report.py +378 -0
  99. aipt_v2/runtime/__init__.py +44 -0
  100. aipt_v2/runtime/base.py +30 -0
  101. aipt_v2/runtime/docker.py +401 -0
  102. aipt_v2/runtime/local.py +346 -0
  103. aipt_v2/runtime/tool_server.py +205 -0
  104. aipt_v2/scanners/__init__.py +28 -0
  105. aipt_v2/scanners/base.py +273 -0
  106. aipt_v2/scanners/nikto.py +244 -0
  107. aipt_v2/scanners/nmap.py +402 -0
  108. aipt_v2/scanners/nuclei.py +273 -0
  109. aipt_v2/scanners/web.py +454 -0
  110. aipt_v2/scripts/security_audit.py +366 -0
  111. aipt_v2/telemetry/__init__.py +7 -0
  112. aipt_v2/telemetry/tracer.py +347 -0
  113. aipt_v2/terminal/__init__.py +28 -0
  114. aipt_v2/terminal/executor.py +400 -0
  115. aipt_v2/terminal/sandbox.py +350 -0
  116. aipt_v2/tools/__init__.py +44 -0
  117. aipt_v2/tools/active_directory/__init__.py +78 -0
  118. aipt_v2/tools/active_directory/ad_config.py +238 -0
  119. aipt_v2/tools/active_directory/bloodhound_wrapper.py +447 -0
  120. aipt_v2/tools/active_directory/kerberos_attacks.py +430 -0
  121. aipt_v2/tools/active_directory/ldap_enum.py +533 -0
  122. aipt_v2/tools/active_directory/smb_attacks.py +505 -0
  123. aipt_v2/tools/agents_graph/__init__.py +19 -0
  124. aipt_v2/tools/agents_graph/agents_graph_actions.py +69 -0
  125. aipt_v2/tools/api_security/__init__.py +76 -0
  126. aipt_v2/tools/api_security/api_discovery.py +608 -0
  127. aipt_v2/tools/api_security/graphql_scanner.py +622 -0
  128. aipt_v2/tools/api_security/jwt_analyzer.py +577 -0
  129. aipt_v2/tools/api_security/openapi_fuzzer.py +761 -0
  130. aipt_v2/tools/browser/__init__.py +5 -0
  131. aipt_v2/tools/browser/browser_actions.py +238 -0
  132. aipt_v2/tools/browser/browser_instance.py +535 -0
  133. aipt_v2/tools/browser/tab_manager.py +344 -0
  134. aipt_v2/tools/cloud/__init__.py +70 -0
  135. aipt_v2/tools/cloud/cloud_config.py +273 -0
  136. aipt_v2/tools/cloud/cloud_scanner.py +639 -0
  137. aipt_v2/tools/cloud/prowler_tool.py +571 -0
  138. aipt_v2/tools/cloud/scoutsuite_tool.py +359 -0
  139. aipt_v2/tools/executor.py +307 -0
  140. aipt_v2/tools/parser.py +408 -0
  141. aipt_v2/tools/proxy/__init__.py +5 -0
  142. aipt_v2/tools/proxy/proxy_actions.py +103 -0
  143. aipt_v2/tools/proxy/proxy_manager.py +789 -0
  144. aipt_v2/tools/registry.py +196 -0
  145. aipt_v2/tools/scanners/__init__.py +343 -0
  146. aipt_v2/tools/scanners/acunetix_tool.py +712 -0
  147. aipt_v2/tools/scanners/burp_tool.py +631 -0
  148. aipt_v2/tools/scanners/config.py +156 -0
  149. aipt_v2/tools/scanners/nessus_tool.py +588 -0
  150. aipt_v2/tools/scanners/zap_tool.py +612 -0
  151. aipt_v2/tools/terminal/__init__.py +5 -0
  152. aipt_v2/tools/terminal/terminal_actions.py +37 -0
  153. aipt_v2/tools/terminal/terminal_manager.py +153 -0
  154. aipt_v2/tools/terminal/terminal_session.py +449 -0
  155. aipt_v2/tools/tool_processing.py +108 -0
  156. aipt_v2/utils/__init__.py +17 -0
  157. aipt_v2/utils/logging.py +201 -0
  158. aipt_v2/utils/model_manager.py +187 -0
  159. aipt_v2/utils/searchers/__init__.py +269 -0
  160. aiptx-2.0.2.dist-info/METADATA +324 -0
  161. aiptx-2.0.2.dist-info/RECORD +165 -0
  162. aiptx-2.0.2.dist-info/WHEEL +5 -0
  163. aiptx-2.0.2.dist-info/entry_points.txt +7 -0
  164. aiptx-2.0.2.dist-info/licenses/LICENSE +21 -0
  165. aiptx-2.0.2.dist-info/top_level.txt +1 -0
aipt_v2/cli.py ADDED
@@ -0,0 +1,321 @@
1
+ """
2
+ AIPTX Command Line Interface
3
+ ============================
4
+
5
+ Entry point for the AIPTX command-line tool.
6
+ Zero-click installation: pipx install aiptx
7
+
8
+ Usage:
9
+ aiptx scan example.com # Run security scan
10
+ aiptx scan example.com --full # Comprehensive scan
11
+ aiptx api # Start REST API
12
+ aiptx status # Check configuration
13
+ """
14
+
15
+ import argparse
16
+ import asyncio
17
+ import sys
18
+ from pathlib import Path
19
+
20
+ # Handle imports for both installed package and local development
21
+ try:
22
+ from . import __version__
23
+ from .config import get_config, validate_config_for_features
24
+ from .utils.logging import setup_logging, logger
25
+ except ImportError:
26
+ # Local development fallback
27
+ import os
28
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
29
+ from __init__ import __version__
30
+ from config import get_config, validate_config_for_features
31
+ from utils.logging import setup_logging, logger
32
+
33
+
34
+ def main():
35
+ """Main CLI entry point."""
36
+ parser = argparse.ArgumentParser(
37
+ prog="aiptx",
38
+ description="AIPTX - AI-Powered Penetration Testing Framework",
39
+ formatter_class=argparse.RawDescriptionHelpFormatter,
40
+ epilog="""
41
+ Examples:
42
+ aiptx scan example.com Run basic scan
43
+ aiptx scan example.com --full Run comprehensive scan
44
+ aiptx scan example.com --ai AI-guided scanning
45
+ aiptx api Start REST API server
46
+ aiptx status Check configuration status
47
+ aiptx version Show version information
48
+
49
+ Installation:
50
+ pipx install aiptx Zero-click install
51
+ pip install aiptx[full] Install with all features
52
+ """,
53
+ )
54
+
55
+ parser.add_argument(
56
+ "--version", "-V",
57
+ action="version",
58
+ version=f"AIPT v{__version__}",
59
+ )
60
+
61
+ parser.add_argument(
62
+ "--verbose", "-v",
63
+ action="count",
64
+ default=0,
65
+ help="Increase verbosity (use -vv for debug)",
66
+ )
67
+
68
+ parser.add_argument(
69
+ "--json",
70
+ action="store_true",
71
+ help="Output in JSON format",
72
+ )
73
+
74
+ subparsers = parser.add_subparsers(dest="command", help="Available commands")
75
+
76
+ # Scan command
77
+ scan_parser = subparsers.add_parser("scan", help="Run security scan")
78
+ scan_parser.add_argument("target", help="Target URL or domain")
79
+ scan_parser.add_argument("--client", "-c", help="Client name")
80
+ scan_parser.add_argument("--output", "-o", help="Output directory")
81
+ scan_parser.add_argument(
82
+ "--mode", "-m",
83
+ choices=["quick", "standard", "full", "ai"],
84
+ default="standard",
85
+ help="Scan mode (default: standard)",
86
+ )
87
+ scan_parser.add_argument("--full", action="store_true", help="Run full comprehensive scan")
88
+ scan_parser.add_argument("--ai", action="store_true", help="Enable AI-guided scanning")
89
+ scan_parser.add_argument("--use-vps", action="store_true", help="Use VPS for tool execution")
90
+ scan_parser.add_argument("--use-acunetix", action="store_true", help="Include Acunetix scan")
91
+ scan_parser.add_argument("--use-burp", action="store_true", help="Include Burp Suite scan")
92
+ scan_parser.add_argument("--skip-recon", action="store_true", help="Skip reconnaissance phase")
93
+
94
+ # API command
95
+ api_parser = subparsers.add_parser("api", help="Start REST API server")
96
+ # Security: Default to localhost to prevent accidental network exposure
97
+ api_parser.add_argument("--host", default="127.0.0.1", help="API host (default: 127.0.0.1, use 0.0.0.0 for network access)")
98
+ api_parser.add_argument("--port", "-p", type=int, default=8000, help="API port (default: 8000)")
99
+ api_parser.add_argument("--reload", action="store_true", help="Enable auto-reload for development")
100
+
101
+ # Status command
102
+ subparsers.add_parser("status", help="Check configuration and dependencies")
103
+
104
+ # Version command
105
+ subparsers.add_parser("version", help="Show detailed version information")
106
+
107
+ args = parser.parse_args()
108
+
109
+ # Setup logging
110
+ log_level = "DEBUG" if args.verbose >= 2 else "INFO" if args.verbose == 1 else "WARNING"
111
+ setup_logging(level=log_level, json_format=args.json)
112
+
113
+ # Handle commands
114
+ if args.command == "scan":
115
+ return run_scan(args)
116
+ elif args.command == "api":
117
+ return run_api(args)
118
+ elif args.command == "status":
119
+ return show_status(args)
120
+ elif args.command == "version":
121
+ return show_version()
122
+ else:
123
+ parser.print_help()
124
+ return 0
125
+
126
+
127
+ def run_scan(args):
128
+ """Run security scan."""
129
+ try:
130
+ from .orchestrator import Orchestrator, OrchestratorConfig
131
+ except ImportError:
132
+ from orchestrator import Orchestrator, OrchestratorConfig
133
+
134
+ # Validate configuration
135
+ features = ["llm"]
136
+ if args.use_acunetix:
137
+ features.append("acunetix")
138
+ if args.use_burp:
139
+ features.append("burp")
140
+ if args.use_vps:
141
+ features.append("vps")
142
+
143
+ errors = validate_config_for_features(features)
144
+ if errors:
145
+ logger.error("Configuration errors:")
146
+ for error in errors:
147
+ logger.error(f" - {error}")
148
+ return 1
149
+
150
+ # Create config
151
+ config = OrchestratorConfig(
152
+ target=args.target,
153
+ output_dir=Path(args.output) if args.output else Path("./results"),
154
+ skip_recon=args.skip_recon,
155
+ use_acunetix=args.use_acunetix,
156
+ use_burp=args.use_burp,
157
+ )
158
+
159
+ # Determine mode
160
+ if args.ai or args.mode == "ai":
161
+ mode = "ai"
162
+ elif args.full or args.mode == "full":
163
+ mode = "full"
164
+ elif args.mode == "quick":
165
+ mode = "quick"
166
+ else:
167
+ mode = "standard"
168
+
169
+ logger.info(f"Starting {mode} scan on {args.target}")
170
+
171
+ # Run orchestrator
172
+ orchestrator = Orchestrator(args.target, config)
173
+
174
+ try:
175
+ asyncio.run(orchestrator.run())
176
+ logger.info("Scan completed successfully")
177
+ return 0
178
+ except KeyboardInterrupt:
179
+ logger.warning("Scan interrupted by user")
180
+ return 130
181
+ except Exception as e:
182
+ logger.error(f"Scan failed: {e}")
183
+ return 1
184
+
185
+
186
+ def run_api(args):
187
+ """Start REST API server."""
188
+ import uvicorn
189
+
190
+ logger.info(f"Starting API server on {args.host}:{args.port}")
191
+
192
+ # Try package import first, then local
193
+ try:
194
+ uvicorn.run(
195
+ "app:app",
196
+ host=args.host,
197
+ port=args.port,
198
+ reload=args.reload,
199
+ log_level="info",
200
+ )
201
+ except Exception:
202
+ # Fallback for installed package
203
+ uvicorn.run(
204
+ "aiptx.app:app",
205
+ host=args.host,
206
+ port=args.port,
207
+ reload=args.reload,
208
+ log_level="info",
209
+ )
210
+
211
+ return 0
212
+
213
+
214
+ def show_status(args):
215
+ """Show configuration status."""
216
+ from rich.console import Console
217
+ from rich.table import Table
218
+
219
+ console = Console()
220
+ config = get_config()
221
+
222
+ console.print("\n[bold cyan]AIPT v2 Configuration Status[/bold cyan]\n")
223
+
224
+ # LLM Status
225
+ table = Table(title="LLM Configuration")
226
+ table.add_column("Setting", style="cyan")
227
+ table.add_column("Value", style="green")
228
+ table.add_column("Status", style="yellow")
229
+
230
+ table.add_row("Provider", config.llm.provider, "✓" if config.llm.provider else "✗")
231
+ table.add_row("Model", config.llm.model, "✓" if config.llm.model else "✗")
232
+ table.add_row("API Key", "****" if config.llm.api_key else "Not set", "✓" if config.llm.api_key else "✗")
233
+
234
+ console.print(table)
235
+
236
+ # Scanner Status
237
+ table = Table(title="Scanner Configuration")
238
+ table.add_column("Scanner", style="cyan")
239
+ table.add_column("URL", style="green")
240
+ table.add_column("API Key", style="yellow")
241
+
242
+ table.add_row(
243
+ "Acunetix",
244
+ config.scanners.acunetix_url or "Not configured",
245
+ "✓" if config.scanners.acunetix_api_key else "✗",
246
+ )
247
+ table.add_row(
248
+ "Burp Suite",
249
+ config.scanners.burp_url or "Not configured",
250
+ "✓" if config.scanners.burp_api_key else "✗",
251
+ )
252
+ table.add_row(
253
+ "Nessus",
254
+ config.scanners.nessus_url or "Not configured",
255
+ "✓" if config.scanners.nessus_access_key else "✗",
256
+ )
257
+ table.add_row(
258
+ "OWASP ZAP",
259
+ config.scanners.zap_url or "Not configured",
260
+ "✓" if config.scanners.zap_api_key else "✗",
261
+ )
262
+
263
+ console.print(table)
264
+
265
+ # VPS Status
266
+ table = Table(title="VPS Configuration")
267
+ table.add_column("Setting", style="cyan")
268
+ table.add_column("Value", style="green")
269
+
270
+ table.add_row("Host", config.vps.host or "Not configured")
271
+ table.add_row("User", config.vps.user)
272
+ table.add_row("SSH Key", config.vps.key_path or "Not configured")
273
+
274
+ console.print(table)
275
+
276
+ # Check for issues
277
+ console.print("\n[bold]Configuration Validation:[/bold]")
278
+
279
+ all_features = ["llm", "acunetix", "burp", "nessus", "vps"]
280
+ for feature in all_features:
281
+ errors = validate_config_for_features([feature])
282
+ if errors:
283
+ console.print(f" [yellow]⚠[/yellow] {feature}: {errors[0]}")
284
+ else:
285
+ console.print(f" [green]✓[/green] {feature}: Ready")
286
+
287
+ return 0
288
+
289
+
290
+ def show_version():
291
+ """Show detailed version information."""
292
+ from rich.console import Console
293
+ from rich.panel import Panel
294
+
295
+ console = Console()
296
+
297
+ info = f"""
298
+ [bold cyan]AIPT v2 - AI-Powered Penetration Testing Framework[/bold cyan]
299
+ Version: {__version__}
300
+
301
+ [bold]Components:[/bold]
302
+ • LLM Integration (litellm)
303
+ • Scanner Integration (Acunetix, Burp, Nessus, ZAP)
304
+ • VPS Execution Support
305
+ • AI-Guided Scanning
306
+ • Professional Report Generation
307
+
308
+ [bold]Documentation:[/bold]
309
+ https://github.com/aipt/aipt-v2
310
+
311
+ [bold]Author:[/bold]
312
+ Satyam Rastogi
313
+ """
314
+
315
+ console.print(Panel(info, title="Version Information", border_style="cyan"))
316
+
317
+ return 0
318
+
319
+
320
+ if __name__ == "__main__":
321
+ sys.exit(main())
@@ -0,0 +1,71 @@
1
+ """
2
+ AIPT Compliance Framework Module
3
+
4
+ Maps security findings to compliance frameworks:
5
+ - OWASP Top 10 2021 (A01-A10)
6
+ - SANS Top 25 CWEs
7
+ - PCI-DSS 4.0 Requirements
8
+ - NIST 800-53 Controls
9
+ - CIS Controls v8
10
+
11
+ Usage:
12
+ from aipt_v2.compliance import ComplianceMapper, generate_compliance_report
13
+
14
+ mapper = ComplianceMapper()
15
+ report = mapper.map_findings(findings, frameworks=["owasp", "pci"])
16
+ """
17
+
18
+ from aipt_v2.compliance.framework_mapper import (
19
+ ComplianceMapper,
20
+ ComplianceMapping,
21
+ FrameworkCategory,
22
+ map_to_frameworks,
23
+ )
24
+
25
+ from aipt_v2.compliance.owasp_mapping import (
26
+ OWASPMapper,
27
+ OWASP_TOP_10,
28
+ get_owasp_category,
29
+ )
30
+
31
+ from aipt_v2.compliance.pci_mapping import (
32
+ PCIMapper,
33
+ PCI_DSS_REQUIREMENTS,
34
+ get_pci_requirement,
35
+ )
36
+
37
+ from aipt_v2.compliance.nist_mapping import (
38
+ NISTMapper,
39
+ NIST_CONTROLS,
40
+ get_nist_control,
41
+ )
42
+
43
+ from aipt_v2.compliance.compliance_report import (
44
+ ComplianceReport,
45
+ generate_compliance_report,
46
+ ComplianceReportGenerator,
47
+ )
48
+
49
+ __all__ = [
50
+ # Mapper
51
+ "ComplianceMapper",
52
+ "ComplianceMapping",
53
+ "FrameworkCategory",
54
+ "map_to_frameworks",
55
+ # OWASP
56
+ "OWASPMapper",
57
+ "OWASP_TOP_10",
58
+ "get_owasp_category",
59
+ # PCI
60
+ "PCIMapper",
61
+ "PCI_DSS_REQUIREMENTS",
62
+ "get_pci_requirement",
63
+ # NIST
64
+ "NISTMapper",
65
+ "NIST_CONTROLS",
66
+ "get_nist_control",
67
+ # Reports
68
+ "ComplianceReport",
69
+ "generate_compliance_report",
70
+ "ComplianceReportGenerator",
71
+ ]