souleyez 2.43.34__py3-none-any.whl → 3.0.7__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 (326) hide show
  1. souleyez/__init__.py +1 -1
  2. souleyez/ai/__init__.py +7 -7
  3. souleyez/ai/action_mapper.py +3 -2
  4. souleyez/ai/chain_advisor.py +2 -1
  5. souleyez/ai/claude_provider.py +2 -2
  6. souleyez/ai/context_builder.py +4 -2
  7. souleyez/ai/executor.py +9 -6
  8. souleyez/ai/feedback_handler.py +4 -2
  9. souleyez/ai/llm_provider.py +2 -2
  10. souleyez/ai/ollama_provider.py +2 -2
  11. souleyez/ai/ollama_service.py +10 -26
  12. souleyez/ai/path_scorer.py +2 -1
  13. souleyez/ai/recommender.py +6 -4
  14. souleyez/ai/report_context.py +2 -2
  15. souleyez/ai/report_service.py +5 -5
  16. souleyez/ai/result_parser.py +3 -2
  17. souleyez/ai/safety.py +5 -2
  18. souleyez/auth/__init__.py +6 -6
  19. souleyez/auth/audit.py +2 -2
  20. souleyez/auth/engagement_access.py +5 -7
  21. souleyez/auth/permissions.py +1 -1
  22. souleyez/auth/session_manager.py +5 -5
  23. souleyez/auth/user_manager.py +4 -5
  24. souleyez/commands/audit.py +6 -5
  25. souleyez/commands/auth.py +6 -5
  26. souleyez/commands/deliverables.py +2 -3
  27. souleyez/commands/engagement.py +3 -3
  28. souleyez/commands/license.py +3 -2
  29. souleyez/commands/screenshots.py +5 -4
  30. souleyez/commands/user.py +10 -8
  31. souleyez/config.py +4 -2
  32. souleyez/core/credential_tester.py +4 -2
  33. souleyez/core/cve_mappings.py +2 -1
  34. souleyez/core/cve_matcher.py +2 -1
  35. souleyez/core/msf_auto_mapper.py +2 -0
  36. souleyez/core/msf_chain_engine.py +3 -1
  37. souleyez/core/msf_database.py +7 -13
  38. souleyez/core/msf_integration.py +2 -2
  39. souleyez/core/msf_rpc_client.py +3 -2
  40. souleyez/core/msf_rpc_manager.py +4 -4
  41. souleyez/core/msf_sync_manager.py +7 -7
  42. souleyez/core/network_utils.py +1 -1
  43. souleyez/core/parser_handler.py +2 -1
  44. souleyez/core/pending_chains.py +4 -3
  45. souleyez/core/templates.py +5 -2
  46. souleyez/core/tool_chaining.py +297 -230
  47. souleyez/core/version_utils.py +1 -0
  48. souleyez/core/vuln_correlation.py +3 -2
  49. souleyez/core/web_utils.py +2 -1
  50. souleyez/detection/__init__.py +1 -1
  51. souleyez/detection/attack_signatures.py +1 -1
  52. souleyez/detection/mitre_mappings.py +1 -2
  53. souleyez/detection/validator.py +5 -4
  54. souleyez/devtools.py +4 -2
  55. souleyez/docs/README.md +2 -2
  56. souleyez/engine/background.py +168 -7
  57. souleyez/engine/base.py +2 -1
  58. souleyez/engine/loader.py +4 -2
  59. souleyez/engine/log_sanitizer.py +1 -0
  60. souleyez/engine/manager.py +3 -1
  61. souleyez/engine/result_handler.py +50 -67
  62. souleyez/engine/worker_manager.py +6 -4
  63. souleyez/export/evidence_bundle.py +1 -0
  64. souleyez/handlers/base.py +1 -0
  65. souleyez/handlers/bash_handler.py +1 -0
  66. souleyez/handlers/bloodhound_handler.py +1 -0
  67. souleyez/handlers/certipy_handler.py +1 -0
  68. souleyez/handlers/crackmapexec_handler.py +2 -20
  69. souleyez/handlers/dnsrecon_handler.py +2 -1
  70. souleyez/handlers/enum4linux_handler.py +65 -37
  71. souleyez/handlers/evil_winrm_handler.py +1 -0
  72. souleyez/handlers/ffuf_handler.py +3 -1
  73. souleyez/handlers/gobuster_handler.py +7 -6
  74. souleyez/handlers/gpp_extract_handler.py +1 -0
  75. souleyez/handlers/hashcat_handler.py +1 -0
  76. souleyez/handlers/hydra_handler.py +5 -1
  77. souleyez/handlers/impacket_getuserspns_handler.py +1 -0
  78. souleyez/handlers/impacket_psexec_handler.py +1 -0
  79. souleyez/handlers/impacket_secretsdump_handler.py +1 -0
  80. souleyez/handlers/john_handler.py +1 -0
  81. souleyez/handlers/katana_handler.py +39 -2
  82. souleyez/handlers/kerbrute_handler.py +1 -0
  83. souleyez/handlers/ldapsearch_handler.py +90 -17
  84. souleyez/handlers/lfi_extract_handler.py +1 -0
  85. souleyez/handlers/msf_auxiliary_handler.py +2 -0
  86. souleyez/handlers/msf_exploit_handler.py +1 -0
  87. souleyez/handlers/nikto_handler.py +2 -1
  88. souleyez/handlers/nmap_handler.py +2 -1
  89. souleyez/handlers/nuclei_handler.py +2 -1
  90. souleyez/handlers/nxc_handler.py +50 -19
  91. souleyez/handlers/rdp_sec_check_handler.py +1 -0
  92. souleyez/handlers/registry.py +1 -0
  93. souleyez/handlers/responder_handler.py +1 -0
  94. souleyez/handlers/service_explorer_handler.py +2 -1
  95. souleyez/handlers/smbclient_handler.py +1 -0
  96. souleyez/handlers/smbmap_handler.py +3 -2
  97. souleyez/handlers/sqlmap_handler.py +6 -4
  98. souleyez/handlers/theharvester_handler.py +2 -1
  99. souleyez/handlers/web_login_test_handler.py +1 -0
  100. souleyez/handlers/whois_handler.py +3 -2
  101. souleyez/handlers/wpscan_handler.py +2 -1
  102. souleyez/history.py +4 -3
  103. souleyez/importers/msf_importer.py +5 -3
  104. souleyez/importers/smart_importer.py +6 -4
  105. souleyez/integrations/siem/__init__.py +6 -6
  106. souleyez/integrations/siem/base.py +1 -1
  107. souleyez/integrations/siem/elastic.py +3 -3
  108. souleyez/integrations/siem/factory.py +1 -2
  109. souleyez/integrations/siem/googlesecops.py +4 -4
  110. souleyez/integrations/siem/rule_mappings/wazuh_rules.py +1 -1
  111. souleyez/integrations/siem/sentinel.py +3 -3
  112. souleyez/integrations/siem/splunk.py +3 -3
  113. souleyez/integrations/siem/wazuh.py +4 -4
  114. souleyez/integrations/wazuh/__init__.py +1 -1
  115. souleyez/integrations/wazuh/client.py +3 -2
  116. souleyez/integrations/wazuh/config.py +3 -2
  117. souleyez/integrations/wazuh/host_mapper.py +3 -1
  118. souleyez/integrations/wazuh/sync.py +4 -1
  119. souleyez/intelligence/__init__.py +1 -1
  120. souleyez/intelligence/correlation_analyzer.py +6 -5
  121. souleyez/intelligence/exploit_knowledge.py +4 -4
  122. souleyez/intelligence/exploit_suggestions.py +4 -3
  123. souleyez/intelligence/gap_analyzer.py +5 -3
  124. souleyez/intelligence/gap_detector.py +2 -0
  125. souleyez/intelligence/sensitive_tables.py +1 -1
  126. souleyez/intelligence/service_parser.py +1 -0
  127. souleyez/intelligence/surface_analyzer.py +9 -9
  128. souleyez/intelligence/target_parser.py +1 -0
  129. souleyez/licensing/__init__.py +3 -3
  130. souleyez/main.py +25 -18
  131. souleyez/migrations/fix_job_counter.py +2 -1
  132. souleyez/parsers/bloodhound_parser.py +1 -0
  133. souleyez/parsers/crackmapexec_parser.py +2 -1
  134. souleyez/parsers/dalfox_parser.py +3 -2
  135. souleyez/parsers/dnsrecon_parser.py +2 -1
  136. souleyez/parsers/enum4linux_parser.py +2 -1
  137. souleyez/parsers/ffuf_parser.py +2 -1
  138. souleyez/parsers/gobuster_parser.py +2 -1
  139. souleyez/parsers/hashcat_parser.py +3 -2
  140. souleyez/parsers/http_fingerprint_parser.py +2 -1
  141. souleyez/parsers/hydra_parser.py +2 -1
  142. souleyez/parsers/impacket_parser.py +2 -1
  143. souleyez/parsers/john_parser.py +4 -3
  144. souleyez/parsers/katana_parser.py +134 -2
  145. souleyez/parsers/msf_parser.py +2 -1
  146. souleyez/parsers/nikto_parser.py +2 -1
  147. souleyez/parsers/nmap_parser.py +14 -3
  148. souleyez/parsers/nuclei_parser.py +3 -2
  149. souleyez/parsers/responder_parser.py +1 -0
  150. souleyez/parsers/searchsploit_parser.py +3 -2
  151. souleyez/parsers/service_explorer_parser.py +1 -0
  152. souleyez/parsers/smbmap_parser.py +2 -1
  153. souleyez/parsers/sqlmap_parser.py +36 -2
  154. souleyez/parsers/theharvester_parser.py +2 -1
  155. souleyez/parsers/whois_parser.py +2 -1
  156. souleyez/parsers/wpscan_parser.py +3 -2
  157. souleyez/plugins/afp.py +3 -1
  158. souleyez/plugins/afp_brute.py +3 -1
  159. souleyez/plugins/ard.py +3 -1
  160. souleyez/plugins/bloodhound.py +3 -2
  161. souleyez/plugins/certipy.py +1 -0
  162. souleyez/plugins/crackmapexec.py +11 -7
  163. souleyez/plugins/dalfox.py +5 -2
  164. souleyez/plugins/dns_hijack.py +3 -1
  165. souleyez/plugins/dnsrecon.py +3 -1
  166. souleyez/plugins/enum4linux.py +3 -1
  167. souleyez/plugins/evil_winrm.py +1 -0
  168. souleyez/plugins/ffuf.py +3 -1
  169. souleyez/plugins/firmware_extract.py +3 -2
  170. souleyez/plugins/gobuster.py +6 -3
  171. souleyez/plugins/gpp_extract.py +1 -0
  172. souleyez/plugins/hashcat.py +2 -1
  173. souleyez/plugins/http_fingerprint.py +149 -40
  174. souleyez/plugins/hydra.py +5 -3
  175. souleyez/plugins/impacket_common.py +40 -0
  176. souleyez/plugins/impacket_getnpusers.py +19 -2
  177. souleyez/plugins/impacket_getuserspns.py +158 -0
  178. souleyez/plugins/impacket_psexec.py +19 -2
  179. souleyez/plugins/impacket_secretsdump.py +19 -2
  180. souleyez/plugins/impacket_smbclient.py +19 -2
  181. souleyez/plugins/john.py +2 -1
  182. souleyez/plugins/katana.py +48 -6
  183. souleyez/plugins/kerbrute.py +1 -0
  184. souleyez/plugins/lfi_extract.py +1 -0
  185. souleyez/plugins/macos_ssh.py +3 -1
  186. souleyez/plugins/mdns.py +3 -1
  187. souleyez/plugins/msf_auxiliary.py +3 -2
  188. souleyez/plugins/msf_exploit.py +6 -5
  189. souleyez/plugins/nikto.py +5 -2
  190. souleyez/plugins/nmap.py +6 -4
  191. souleyez/plugins/nuclei.py +3 -1
  192. souleyez/plugins/nxc.py +1 -0
  193. souleyez/plugins/plugin_base.py +3 -2
  194. souleyez/plugins/plugin_template.py +3 -2
  195. souleyez/plugins/rdp_sec_check.py +1 -0
  196. souleyez/plugins/responder.py +2 -1
  197. souleyez/plugins/router_http_brute.py +3 -1
  198. souleyez/plugins/router_ssh_brute.py +3 -1
  199. souleyez/plugins/router_telnet_brute.py +3 -1
  200. souleyez/plugins/routersploit.py +5 -3
  201. souleyez/plugins/routersploit_exploit.py +5 -3
  202. souleyez/plugins/searchsploit.py +1 -0
  203. souleyez/plugins/service_explorer.py +2 -1
  204. souleyez/plugins/smbmap.py +3 -1
  205. souleyez/plugins/smbpasswd.py +1 -0
  206. souleyez/plugins/sqlmap.py +3 -1
  207. souleyez/plugins/theharvester.py +3 -1
  208. souleyez/plugins/tr069.py +3 -1
  209. souleyez/plugins/upnp.py +3 -1
  210. souleyez/plugins/upnp_abuse.py +4 -2
  211. souleyez/plugins/vnc_access.py +4 -2
  212. souleyez/plugins/vnc_brute.py +3 -1
  213. souleyez/plugins/web_login_test.py +1 -0
  214. souleyez/plugins/whois.py +3 -1
  215. souleyez/plugins/wpscan.py +49 -1
  216. souleyez/reporting/attack_chain.py +2 -1
  217. souleyez/reporting/charts.py +1 -0
  218. souleyez/reporting/compliance_mappings.py +1 -0
  219. souleyez/reporting/detection_report.py +10 -10
  220. souleyez/reporting/formatters.py +7 -12
  221. souleyez/reporting/generator.py +34 -46
  222. souleyez/reporting/metrics.py +2 -1
  223. souleyez/scanner.py +6 -3
  224. souleyez/security/__init__.py +7 -5
  225. souleyez/security/scope_validator.py +5 -4
  226. souleyez/security/validation.py +14 -0
  227. souleyez/security.py +5 -2
  228. souleyez/storage/credentials.py +14 -19
  229. souleyez/storage/crypto.py +7 -4
  230. souleyez/storage/database.py +6 -6
  231. souleyez/storage/db.py +8 -8
  232. souleyez/storage/deliverable_evidence.py +2 -1
  233. souleyez/storage/deliverable_exporter.py +3 -2
  234. souleyez/storage/deliverable_templates.py +2 -1
  235. souleyez/storage/deliverables.py +2 -1
  236. souleyez/storage/engagements.py +6 -4
  237. souleyez/storage/evidence.py +5 -4
  238. souleyez/storage/execution_log.py +4 -2
  239. souleyez/storage/exploit_attempts.py +3 -2
  240. souleyez/storage/exploits.py +3 -1
  241. souleyez/storage/findings.py +3 -1
  242. souleyez/storage/hosts.py +5 -2
  243. souleyez/storage/migrate_to_engagements.py +14 -24
  244. souleyez/storage/migrations/_001_add_credential_enhancements.py +12 -21
  245. souleyez/storage/migrations/_003_add_execution_log.py +8 -13
  246. souleyez/storage/migrations/_005_screenshots.py +2 -4
  247. souleyez/storage/migrations/_006_deliverables.py +2 -4
  248. souleyez/storage/migrations/_007_deliverable_templates.py +4 -8
  249. souleyez/storage/migrations/_008_add_nuclei_table.py +2 -4
  250. souleyez/storage/migrations/_010_evidence_linking.py +6 -12
  251. souleyez/storage/migrations/_012_team_collaboration.py +12 -24
  252. souleyez/storage/migrations/_013_add_host_tags.py +2 -4
  253. souleyez/storage/migrations/_014_exploit_attempts.py +10 -20
  254. souleyez/storage/migrations/_015_add_mac_os_fields.py +4 -8
  255. souleyez/storage/migrations/_016_add_domain_field.py +2 -4
  256. souleyez/storage/migrations/_017_msf_sessions.py +8 -16
  257. souleyez/storage/migrations/_018_add_osint_target.py +4 -8
  258. souleyez/storage/migrations/_019_add_engagement_type.py +4 -8
  259. souleyez/storage/migrations/_020_add_rbac.py +9 -17
  260. souleyez/storage/migrations/_021_wazuh_integration.py +4 -8
  261. souleyez/storage/migrations/_023_fix_detection_results_fk.py +2 -4
  262. souleyez/storage/migrations/_024_wazuh_vulnerabilities.py +4 -8
  263. souleyez/storage/migrations/_026_add_engagement_scope.py +4 -8
  264. souleyez/storage/migrations/_027_multi_siem_persistence.py +8 -16
  265. souleyez/storage/migrations/__init__.py +1 -4
  266. souleyez/storage/migrations/migration_manager.py +6 -9
  267. souleyez/storage/msf_sessions.py +1 -1
  268. souleyez/storage/osint.py +3 -1
  269. souleyez/storage/recommendation_engine.py +3 -2
  270. souleyez/storage/screenshots.py +2 -1
  271. souleyez/storage/smb_shares.py +3 -1
  272. souleyez/storage/sqlmap_data.py +6 -4
  273. souleyez/storage/team_collaboration.py +3 -2
  274. souleyez/storage/timeline_tracker.py +2 -1
  275. souleyez/storage/wazuh_vulns.py +3 -1
  276. souleyez/storage/web_paths.py +3 -1
  277. souleyez/testing/credential_tester.py +2 -0
  278. souleyez/ui/__init__.py +2 -1
  279. souleyez/ui/ai_quotes.py +1 -1
  280. souleyez/ui/attack_surface.py +50 -28
  281. souleyez/ui/chain_rules_view.py +6 -3
  282. souleyez/ui/correlation_view.py +3 -2
  283. souleyez/ui/dashboard.py +85 -139
  284. souleyez/ui/deliverables_view.py +1 -1
  285. souleyez/ui/design_system.py +5 -3
  286. souleyez/ui/errors.py +3 -1
  287. souleyez/ui/evidence_linking_view.py +2 -1
  288. souleyez/ui/evidence_vault.py +11 -6
  289. souleyez/ui/exploit_suggestions_view.py +11 -7
  290. souleyez/ui/export_view.py +3 -1
  291. souleyez/ui/gap_analysis_view.py +6 -3
  292. souleyez/ui/help_system.py +4 -1
  293. souleyez/ui/intelligence_view.py +7 -3
  294. souleyez/ui/interactive.py +1512 -584
  295. souleyez/ui/interactive_selector.py +3 -2
  296. souleyez/ui/log_formatter.py +1 -0
  297. souleyez/ui/menu_components.py +3 -1
  298. souleyez/ui/msf_auxiliary_menu.py +4 -1
  299. souleyez/ui/pending_chains_view.py +15 -12
  300. souleyez/ui/progress_indicators.py +5 -2
  301. souleyez/ui/recommendations_view.py +4 -2
  302. souleyez/ui/rule_builder.py +4 -1
  303. souleyez/ui/setup_wizard.py +10 -8
  304. souleyez/ui/shortcuts.py +1 -1
  305. souleyez/ui/splunk_gap_analysis_view.py +7 -4
  306. souleyez/ui/splunk_vulns_view.py +4 -1
  307. souleyez/ui/team_dashboard.py +7 -5
  308. souleyez/ui/template_selector.py +2 -1
  309. souleyez/ui/terminal.py +3 -2
  310. souleyez/ui/timeline_view.py +2 -1
  311. souleyez/ui/tool_setup.py +92 -31
  312. souleyez/ui/tutorial.py +7 -4
  313. souleyez/ui/tutorial_state.py +3 -2
  314. souleyez/ui/wazuh_vulns_view.py +5 -2
  315. souleyez/ui/wordlist_browser.py +4 -3
  316. souleyez/ui.py +13 -7
  317. souleyez/utils/tool_checker.py +61 -12
  318. souleyez/utils.py +4 -4
  319. souleyez/wordlists.py +1 -0
  320. {souleyez-2.43.34.dist-info → souleyez-3.0.7.dist-info}/METADATA +2 -2
  321. souleyez-3.0.7.dist-info/RECORD +445 -0
  322. souleyez-2.43.34.dist-info/RECORD +0 -443
  323. {souleyez-2.43.34.dist-info → souleyez-3.0.7.dist-info}/WHEEL +0 -0
  324. {souleyez-2.43.34.dist-info → souleyez-3.0.7.dist-info}/entry_points.txt +0 -0
  325. {souleyez-2.43.34.dist-info → souleyez-3.0.7.dist-info}/licenses/LICENSE +0 -0
  326. {souleyez-2.43.34.dist-info → souleyez-3.0.7.dist-info}/top_level.txt +0 -0
souleyez/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.43.34"
1
+ __version__ = "3.0.7"
souleyez/ai/__init__.py CHANGED
@@ -2,18 +2,18 @@
2
2
  souleyez.ai - AI-powered attack path recommendations and report generation
3
3
  """
4
4
 
5
- from .ollama_service import OllamaService, OLLAMA_AVAILABLE
6
- from .context_builder import ContextBuilder
7
- from .recommender import AttackRecommender
8
- from .llm_provider import LLMProvider, LLMProviderType
9
- from .ollama_provider import OllamaProvider
10
5
  from .claude_provider import (
11
- ClaudeProvider,
12
6
  ANTHROPIC_AVAILABLE,
13
- set_claude_api_key,
7
+ ClaudeProvider,
14
8
  clear_claude_api_key,
9
+ set_claude_api_key,
15
10
  )
11
+ from .context_builder import ContextBuilder
16
12
  from .llm_factory import LLMFactory
13
+ from .llm_provider import LLMProvider, LLMProviderType
14
+ from .ollama_provider import OllamaProvider
15
+ from .ollama_service import OLLAMA_AVAILABLE, OllamaService
16
+ from .recommender import AttackRecommender
17
17
  from .report_context import ReportContextBuilder
18
18
  from .report_service import AIReportService
19
19
 
@@ -2,9 +2,10 @@
2
2
  """
3
3
  souleyez.ai.action_mapper - Map AI recommendations to executable commands
4
4
  """
5
- import re
6
- from typing import Optional, Dict, Any
5
+
7
6
  import logging
7
+ import re
8
+ from typing import Any, Dict, Optional
8
9
 
9
10
  logger = logging.getLogger(__name__)
10
11
 
@@ -5,11 +5,12 @@ souleyez.ai.chain_advisor - AI-powered tool chain recommendations
5
5
  Uses LLM to analyze scan results and suggest additional tools to run,
6
6
  complementing the static rule-based chaining system.
7
7
  """
8
+
8
9
  import logging
9
10
  import re
10
11
  from dataclasses import dataclass, field
11
12
  from enum import Enum
12
- from typing import Dict, Any, List, Optional
13
+ from typing import Any, Dict, List, Optional
13
14
 
14
15
  from .llm_factory import LLMFactory
15
16
 
@@ -6,7 +6,7 @@ Requires API key stored securely via CryptoManager.
6
6
  """
7
7
 
8
8
  import logging
9
- from typing import Optional, Dict, Any
9
+ from typing import Any, Dict, Optional
10
10
 
11
11
  from .llm_provider import LLMProvider, LLMProviderType
12
12
 
@@ -240,8 +240,8 @@ def set_claude_api_key(api_key: str) -> bool:
240
240
  Returns:
241
241
  bool: True if stored successfully, False otherwise
242
242
  """
243
- from souleyez.storage.crypto import get_crypto_manager
244
243
  from souleyez.config import read_config, write_config
244
+ from souleyez.storage.crypto import get_crypto_manager
245
245
 
246
246
  crypto = get_crypto_manager()
247
247
  if not crypto.is_unlocked():
@@ -2,11 +2,13 @@
2
2
  """
3
3
  souleyez.ai.context_builder - Build context from engagement data for LLM
4
4
  """
5
+
5
6
  from typing import Optional
6
- from ..storage.engagements import EngagementManager
7
- from ..storage.hosts import HostManager
7
+
8
8
  from ..storage.credentials import CredentialsManager
9
+ from ..storage.engagements import EngagementManager
9
10
  from ..storage.findings import FindingsManager
11
+ from ..storage.hosts import HostManager
10
12
 
11
13
 
12
14
  class ContextBuilder:
souleyez/ai/executor.py CHANGED
@@ -2,16 +2,19 @@
2
2
  """
3
3
  souleyez.ai.executor - Interactive AI-driven command execution
4
4
  """
5
- import subprocess
5
+
6
6
  import logging
7
+ import subprocess
8
+ from typing import Any, Dict, Optional
9
+
7
10
  import click
8
- from typing import Optional, Dict, Any
9
- from .recommender import AttackRecommender
11
+
12
+ from ..storage.execution_log import ExecutionLogManager
10
13
  from .action_mapper import ActionMapper
11
- from .safety import SafetyFramework, ApprovalMode, RiskLevel
12
- from .result_parser import ResultParser
13
14
  from .feedback_handler import FeedbackHandler
14
- from ..storage.execution_log import ExecutionLogManager
15
+ from .recommender import AttackRecommender
16
+ from .result_parser import ResultParser
17
+ from .safety import ApprovalMode, RiskLevel, SafetyFramework
15
18
 
16
19
  logger = logging.getLogger(__name__)
17
20
 
@@ -2,11 +2,13 @@
2
2
  """
3
3
  souleyez.ai.feedback_handler - Auto-update database after command execution
4
4
  """
5
+
5
6
  import logging
6
- from typing import Dict, Any, Optional
7
7
  from datetime import datetime
8
- from ..storage.hosts import HostManager
8
+ from typing import Any, Dict, Optional
9
+
9
10
  from ..storage.credentials import CredentialsManager
11
+ from ..storage.hosts import HostManager
10
12
 
11
13
  logger = logging.getLogger(__name__)
12
14
 
@@ -5,10 +5,10 @@ This module defines the abstract base class for LLM providers,
5
5
  enabling support for multiple backends (Ollama, Claude, etc.)
6
6
  """
7
7
 
8
+ import logging
8
9
  from abc import ABC, abstractmethod
9
10
  from enum import Enum
10
- from typing import Optional, Dict, Any
11
- import logging
11
+ from typing import Any, Dict, Optional
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
@@ -5,10 +5,10 @@ Wraps the existing OllamaService to implement the LLMProvider interface.
5
5
  """
6
6
 
7
7
  import logging
8
- from typing import Optional, Dict, Any
8
+ from typing import Any, Dict, Optional
9
9
 
10
10
  from .llm_provider import LLMProvider, LLMProviderType
11
- from .ollama_service import OllamaService, OLLAMA_AVAILABLE
11
+ from .ollama_service import OLLAMA_AVAILABLE, OllamaService
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
@@ -7,7 +7,7 @@ without sending sensitive engagement data to the cloud.
7
7
  """
8
8
 
9
9
  import logging
10
- from typing import Optional, Dict, Any
10
+ from typing import Any, Dict, Optional
11
11
 
12
12
  # Ollama is optional - not available in Ubuntu repos
13
13
  try:
@@ -252,40 +252,24 @@ class OllamaService:
252
252
  return None
253
253
 
254
254
  try:
255
- import threading
255
+ import concurrent.futures
256
256
 
257
- # Check if we're in main thread (signal only works in main thread)
258
- in_main_thread = threading.current_thread() is threading.main_thread()
259
-
260
- if in_main_thread:
261
- # Use signal-based timeout (only works in main thread)
262
- import signal
263
-
264
- def timeout_handler(signum, frame):
265
- raise TimeoutError("AI generation timed out")
266
-
267
- old_handler = signal.signal(signal.SIGALRM, timeout_handler)
268
- signal.alarm(timeout)
257
+ # Use thread-based timeout instead of signals
258
+ # Signals can interrupt unrelated code (like click.prompt) causing crashes
259
+ def _do_generate():
260
+ return self.client.generate(model=model_name, prompt=prompt)
269
261
 
262
+ with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
263
+ future = executor.submit(_do_generate)
270
264
  try:
271
- response = self.client.generate(model=model_name, prompt=prompt)
272
- signal.alarm(0)
273
- signal.signal(signal.SIGALRM, old_handler)
265
+ response = future.result(timeout=timeout)
274
266
  return response.get("response", "")
275
- except TimeoutError:
276
- signal.alarm(0)
277
- signal.signal(signal.SIGALRM, old_handler)
267
+ except concurrent.futures.TimeoutError:
278
268
  logger.error(f"Generation timed out after {timeout}s")
279
269
  return None
280
270
  except Exception as e:
281
- signal.alarm(0)
282
- signal.signal(signal.SIGALRM, old_handler)
283
271
  logger.error(f"Generation error: {e}")
284
272
  return None
285
- else:
286
- # In a thread - can't use signals, just call directly
287
- response = self.client.generate(model=model_name, prompt=prompt)
288
- return response.get("response", "")
289
273
  except Exception as e:
290
274
  logger.error(f"Generation failed: {e}")
291
275
  return None
@@ -2,8 +2,9 @@
2
2
  """
3
3
  souleyez.ai.path_scorer - Score and rank attack paths
4
4
  """
5
+
5
6
  import logging
6
- from typing import Dict, List, Any
7
+ from typing import Any, Dict, List
7
8
 
8
9
  logger = logging.getLogger(__name__)
9
10
 
@@ -5,12 +5,14 @@ souleyez.ai.recommender - AI-powered attack path recommendations
5
5
  Uses LLM (via Ollama or Claude) to analyze engagement data and suggest
6
6
  the next most promising penetration testing step.
7
7
  """
8
+
8
9
  import logging
9
10
  import re
10
- from typing import Optional, Dict, Any, List
11
- from .ollama_service import OllamaService
11
+ from typing import Any, Dict, List, Optional
12
+
12
13
  from .context_builder import ContextBuilder
13
14
  from .llm_factory import LLMFactory
15
+ from .ollama_service import OllamaService
14
16
 
15
17
  logger = logging.getLogger(__name__)
16
18
 
@@ -585,10 +587,10 @@ Be specific and actionable. Think like a professional pentester considering mult
585
587
 
586
588
  def _get_engagement_data(self, engagement_id: int) -> Dict[str, Any]:
587
589
  """Get engagement data for scoring."""
588
- from ..storage.engagements import EngagementManager
589
- from ..storage.hosts import HostManager
590
590
  from ..storage.credentials import CredentialsManager
591
+ from ..storage.engagements import EngagementManager
591
592
  from ..storage.findings import FindingsManager
593
+ from ..storage.hosts import HostManager
592
594
 
593
595
  em = EngagementManager()
594
596
  hm = HostManager()
@@ -5,7 +5,7 @@ Prepares engagement data in formats suitable for LLM prompt templates.
5
5
  """
6
6
 
7
7
  import logging
8
- from typing import Dict, Any, List, Optional
8
+ from typing import Any, Dict, List, Optional
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
@@ -19,10 +19,10 @@ class ReportContextBuilder:
19
19
  """
20
20
 
21
21
  def __init__(self):
22
+ from souleyez.storage.credentials import CredentialsManager
22
23
  from souleyez.storage.engagements import EngagementManager
23
24
  from souleyez.storage.findings import FindingsManager
24
25
  from souleyez.storage.hosts import HostManager
25
- from souleyez.storage.credentials import CredentialsManager
26
26
 
27
27
  self.em = EngagementManager()
28
28
  self.fm = FindingsManager()
@@ -5,21 +5,21 @@ Provides methods for generating AI-enhanced report sections using
5
5
  configured LLM providers (Claude or Ollama).
6
6
  """
7
7
 
8
+ import concurrent.futures
8
9
  import logging
9
10
  import re
10
- import concurrent.futures
11
- from typing import Optional, Dict, Any, List
11
+ from typing import Any, Dict, List, Optional
12
12
 
13
- from .llm_provider import LLMProvider
14
13
  from .llm_factory import LLMFactory
14
+ from .llm_provider import LLMProvider
15
15
  from .report_context import ReportContextBuilder
16
16
  from .report_prompts import (
17
- REPORT_SYSTEM_PROMPT,
17
+ ATTACK_CHAIN_PROMPT,
18
18
  EXECUTIVE_SUMMARY_PROMPT,
19
19
  FINDING_ENHANCEMENT_PROMPT,
20
20
  REMEDIATION_PLAN_PROMPT,
21
+ REPORT_SYSTEM_PROMPT,
21
22
  RISK_RATING_PROMPT,
22
- ATTACK_CHAIN_PROMPT,
23
23
  )
24
24
 
25
25
  logger = logging.getLogger(__name__)
@@ -2,9 +2,10 @@
2
2
  """
3
3
  souleyez.ai.result_parser - Parse command execution results
4
4
  """
5
- import re
6
- from typing import Dict, Any, Optional
5
+
7
6
  import logging
7
+ import re
8
+ from typing import Any, Dict, Optional
8
9
 
9
10
  logger = logging.getLogger(__name__)
10
11
 
souleyez/ai/safety.py CHANGED
@@ -2,9 +2,12 @@
2
2
  """
3
3
  souleyez.ai.safety - Safety framework for AI-driven command execution
4
4
  """
5
- import click
6
- from typing import Dict, Optional
5
+
7
6
  from enum import Enum
7
+ from typing import Dict, Optional
8
+
9
+ import click
10
+
8
11
  from souleyez.ui.design_system import DesignSystem
9
12
 
10
13
 
souleyez/auth/__init__.py CHANGED
@@ -10,20 +10,20 @@ Usage:
10
10
  pass
11
11
  """
12
12
 
13
+ from .audit import AuditAction, AuditLogger, audit_log, get_audit_logger
13
14
  from .permissions import (
14
- Role,
15
- Tier,
15
+ PRO_TIER_PERMISSIONS,
16
+ ROLE_PERMISSIONS,
16
17
  Permission,
17
18
  PermissionChecker,
19
+ Role,
20
+ Tier,
18
21
  requires_permission,
19
22
  requires_pro,
20
23
  requires_role,
21
- PRO_TIER_PERMISSIONS,
22
- ROLE_PERMISSIONS,
23
24
  )
24
- from .user_manager import User, UserManager
25
25
  from .session_manager import Session, SessionManager
26
- from .audit import AuditLogger, AuditAction, audit_log, get_audit_logger
26
+ from .user_manager import User, UserManager
27
27
 
28
28
  # Module-level session manager instance (initialized on first use)
29
29
  _session_manager: SessionManager = None
souleyez/auth/audit.py CHANGED
@@ -5,11 +5,11 @@ All sensitive actions should be logged through this module.
5
5
  Logs are immutable and include user context automatically.
6
6
  """
7
7
 
8
- import sqlite3
9
8
  import json
9
+ import sqlite3
10
10
  from datetime import datetime, timedelta
11
- from typing import Optional, Dict, Any, List
12
11
  from enum import Enum
12
+ from typing import Any, Dict, List, Optional
13
13
 
14
14
  from souleyez.storage.database import get_db
15
15
 
@@ -8,12 +8,12 @@ Permission levels:
8
8
  """
9
9
 
10
10
  import sqlite3
11
- from enum import Enum
12
- from typing import Optional, List, Dict, Any
13
11
  from dataclasses import dataclass
14
12
  from datetime import datetime
13
+ from enum import Enum
14
+ from typing import Any, Dict, List, Optional
15
15
 
16
- from souleyez.auth import get_current_user, Role
16
+ from souleyez.auth import Role, get_current_user
17
17
 
18
18
 
19
19
  class EngagementPermission(Enum):
@@ -131,13 +131,11 @@ class EngagementAccessManager:
131
131
 
132
132
  if user_role == Role.ADMIN:
133
133
  # Admins see everything
134
- rows = conn.execute(
135
- """
134
+ rows = conn.execute("""
136
135
  SELECT e.*, 'admin' as permission_level
137
136
  FROM engagements e
138
137
  ORDER BY e.created_at DESC
139
- """
140
- ).fetchall()
138
+ """).fetchall()
141
139
  else:
142
140
  # Non-admins see owned + shared engagements
143
141
  rows = conn.execute(
@@ -6,8 +6,8 @@ Tiers: FREE, PRO (for licensing)
6
6
  """
7
7
 
8
8
  from enum import Enum, auto
9
- from typing import Set, Optional
10
9
  from functools import wraps
10
+ from typing import Optional, Set
11
11
 
12
12
 
13
13
  class Role(Enum):
@@ -7,18 +7,17 @@ Handles:
7
7
  - Current user context
8
8
  """
9
9
 
10
- import sqlite3
11
- import secrets
12
10
  import hashlib
13
11
  import json
12
+ import secrets
13
+ import sqlite3
14
+ from dataclasses import dataclass
14
15
  from datetime import datetime, timedelta
15
16
  from pathlib import Path
16
17
  from typing import Optional
17
- from dataclasses import dataclass
18
18
 
19
- from .user_manager import User, UserManager
20
19
  from .permissions import Role, Tier
21
-
20
+ from .user_manager import User, UserManager
22
21
 
23
22
  # Session configuration
24
23
  SESSION_TOKEN_BYTES = 32
@@ -250,6 +249,7 @@ class SessionManager:
250
249
  vault_failures: Number of recent vault unlock failures
251
250
  """
252
251
  import time
252
+
253
253
  import click
254
254
 
255
255
  if vault_failures >= 2:
@@ -8,17 +8,16 @@ Handles:
8
8
  - Tier management for licensing
9
9
  """
10
10
 
11
- import sqlite3
12
11
  import hashlib
13
- import secrets
14
12
  import re
15
- from datetime import datetime
16
- from typing import Optional, List
13
+ import secrets
14
+ import sqlite3
17
15
  from dataclasses import dataclass
16
+ from datetime import datetime
17
+ from typing import List, Optional
18
18
 
19
19
  from .permissions import Role, Tier
20
20
 
21
-
22
21
  # OWASP 2023 recommendation for PBKDF2-HMAC-SHA256
23
22
  HASH_ITERATIONS = 480_000
24
23
  SALT_LENGTH = 32
@@ -8,17 +8,18 @@ Commands:
8
8
  - souleyez audit export - Export audit logs
9
9
  """
10
10
 
11
- import click
11
+ import json
12
12
  from datetime import datetime
13
+
14
+ import click
13
15
  from rich.console import Console
14
- from rich.table import Table
15
16
  from rich.panel import Panel
16
- import json
17
+ from rich.table import Table
17
18
 
18
- from souleyez.security import require_login
19
19
  from souleyez.auth import Role
20
- from souleyez.auth.permissions import requires_role
21
20
  from souleyez.auth.audit import get_audit_logger
21
+ from souleyez.auth.permissions import requires_role
22
+ from souleyez.security import require_login
22
23
 
23
24
  console = Console()
24
25
 
souleyez/commands/auth.py CHANGED
@@ -7,19 +7,20 @@ Commands:
7
7
  - souleyez whoami - Show current user info
8
8
  """
9
9
 
10
- import click
11
10
  import getpass
11
+
12
+ import click
12
13
  from rich.console import Console
13
14
  from rich.panel import Panel
14
15
  from rich.table import Table
15
16
 
16
17
  from souleyez.auth import (
17
- init_auth,
18
- get_session_manager,
18
+ Tier,
19
+ UserManager,
19
20
  get_current_user,
21
+ get_session_manager,
22
+ init_auth,
20
23
  is_logged_in,
21
- UserManager,
22
- Tier,
23
24
  )
24
25
  from souleyez.storage.database import get_db
25
26
 
@@ -4,17 +4,16 @@ CLI commands for deliverable tracking.
4
4
 
5
5
  import click
6
6
  from rich.console import Console
7
+ from rich.progress import BarColumn, Progress, TextColumn
7
8
  from rich.table import Table
8
- from rich.progress import Progress, BarColumn, TextColumn
9
9
 
10
10
  try:
11
11
  from rich.progress import TaskProgressColumn
12
12
  except ImportError:
13
13
  TaskProgressColumn = None # Not available in older rich versions
14
+ from souleyez.security import require_password
14
15
  from souleyez.storage.deliverables import DeliverableManager
15
16
  from souleyez.storage.engagements import EngagementManager
16
- from souleyez.security import require_password
17
-
18
17
 
19
18
  console = Console()
20
19
 
@@ -12,14 +12,14 @@ import click
12
12
  from rich.console import Console
13
13
  from rich.table import Table
14
14
 
15
- from souleyez.security import require_login
16
- from souleyez.auth import get_current_user, Role, UserManager
15
+ from souleyez.auth import Role, UserManager, get_current_user
17
16
  from souleyez.auth.engagement_access import (
18
17
  EngagementAccessManager,
19
18
  EngagementPermission,
20
19
  )
21
- from souleyez.storage.engagements import EngagementManager
20
+ from souleyez.security import require_login
22
21
  from souleyez.storage.database import get_db
22
+ from souleyez.storage.engagements import EngagementManager
23
23
 
24
24
  console = Console()
25
25
 
@@ -7,9 +7,10 @@ souleyez license deactivate - Remove license
7
7
  souleyez license machine-id - Show machine ID for hardware-bound licenses
8
8
  """
9
9
 
10
- import click
11
10
  from datetime import datetime
12
11
 
12
+ import click
13
+
13
14
 
14
15
  @click.group()
15
16
  def license():
@@ -59,7 +60,7 @@ def activate(license_key: str):
59
60
 
60
61
  # Update user tier if auth system is in use
61
62
  try:
62
- from souleyez.auth import get_current_user, UserManager
63
+ from souleyez.auth import UserManager, get_current_user
63
64
  from souleyez.auth.permissions import Tier
64
65
  from souleyez.storage.database import get_db
65
66
 
@@ -2,14 +2,15 @@
2
2
  CLI commands for screenshot management.
3
3
  """
4
4
 
5
- import click
6
5
  from pathlib import Path
6
+
7
+ import click
7
8
  from rich.console import Console
8
9
  from rich.table import Table
9
- from souleyez.storage.screenshots import ScreenshotManager
10
- from souleyez.storage.engagements import EngagementManager
11
- from souleyez.security import require_password
12
10
 
11
+ from souleyez.security import require_password
12
+ from souleyez.storage.engagements import EngagementManager
13
+ from souleyez.storage.screenshots import ScreenshotManager
13
14
 
14
15
  console = Console()
15
16
 
souleyez/commands/user.py CHANGED
@@ -9,23 +9,24 @@ Commands (admin only):
9
9
  - souleyez user passwd [username] - Change password
10
10
  """
11
11
 
12
- import click
13
12
  import getpass
13
+
14
+ import click
14
15
  from rich.console import Console
15
- from rich.table import Table
16
16
  from rich.panel import Panel
17
+ from rich.table import Table
17
18
 
18
19
  from souleyez.auth import (
19
- init_auth,
20
- get_current_user,
21
- is_logged_in,
22
- UserManager,
23
20
  Role,
24
21
  Tier,
22
+ UserManager,
23
+ get_current_user,
24
+ init_auth,
25
+ is_logged_in,
25
26
  )
26
- from souleyez.storage.database import get_db
27
- from souleyez.security import require_login, require_admin
28
27
  from souleyez.licensing.validator import get_active_license
28
+ from souleyez.security import require_admin, require_login
29
+ from souleyez.storage.database import get_db
29
30
 
30
31
  console = Console()
31
32
 
@@ -410,6 +411,7 @@ def _log_audit(action: str, user_id: str, username: str, details: str = None):
410
411
  """Log an audit event."""
411
412
  import sqlite3
412
413
  from datetime import datetime
414
+
413
415
  from souleyez.storage.database import get_db
414
416
 
415
417
  try: