erosolar-cli 1.7.327 → 1.7.328

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 (323) hide show
  1. package/README.md +148 -24
  2. package/dist/alpha-zero/agentWrapper.d.ts +84 -0
  3. package/dist/alpha-zero/agentWrapper.d.ts.map +1 -0
  4. package/dist/alpha-zero/agentWrapper.js +171 -0
  5. package/dist/alpha-zero/agentWrapper.js.map +1 -0
  6. package/dist/alpha-zero/codeEvaluator.d.ts +25 -0
  7. package/dist/alpha-zero/codeEvaluator.d.ts.map +1 -0
  8. package/dist/alpha-zero/codeEvaluator.js +273 -0
  9. package/dist/alpha-zero/codeEvaluator.js.map +1 -0
  10. package/dist/alpha-zero/competitiveRunner.d.ts +66 -0
  11. package/dist/alpha-zero/competitiveRunner.d.ts.map +1 -0
  12. package/dist/alpha-zero/competitiveRunner.js +224 -0
  13. package/dist/alpha-zero/competitiveRunner.js.map +1 -0
  14. package/dist/alpha-zero/index.d.ts +67 -0
  15. package/dist/alpha-zero/index.d.ts.map +1 -0
  16. package/dist/alpha-zero/index.js +99 -0
  17. package/dist/alpha-zero/index.js.map +1 -0
  18. package/dist/alpha-zero/introspection.d.ts +128 -0
  19. package/dist/alpha-zero/introspection.d.ts.map +1 -0
  20. package/dist/alpha-zero/introspection.js +300 -0
  21. package/dist/alpha-zero/introspection.js.map +1 -0
  22. package/dist/alpha-zero/metricsTracker.d.ts +71 -0
  23. package/dist/alpha-zero/metricsTracker.d.ts.map +1 -0
  24. package/dist/{core → alpha-zero}/metricsTracker.js +5 -2
  25. package/dist/alpha-zero/metricsTracker.js.map +1 -0
  26. package/dist/alpha-zero/security/core.d.ts +125 -0
  27. package/dist/alpha-zero/security/core.d.ts.map +1 -0
  28. package/dist/alpha-zero/security/core.js +271 -0
  29. package/dist/alpha-zero/security/core.js.map +1 -0
  30. package/dist/alpha-zero/security/google.d.ts +125 -0
  31. package/dist/alpha-zero/security/google.d.ts.map +1 -0
  32. package/dist/alpha-zero/security/google.js +311 -0
  33. package/dist/alpha-zero/security/google.js.map +1 -0
  34. package/dist/alpha-zero/security/googleLoader.d.ts +17 -0
  35. package/dist/alpha-zero/security/googleLoader.d.ts.map +1 -0
  36. package/dist/alpha-zero/security/googleLoader.js +41 -0
  37. package/dist/alpha-zero/security/googleLoader.js.map +1 -0
  38. package/dist/alpha-zero/security/index.d.ts +29 -0
  39. package/dist/alpha-zero/security/index.d.ts.map +1 -0
  40. package/dist/alpha-zero/security/index.js +32 -0
  41. package/dist/alpha-zero/security/index.js.map +1 -0
  42. package/dist/alpha-zero/security/simulation.d.ts +124 -0
  43. package/dist/alpha-zero/security/simulation.d.ts.map +1 -0
  44. package/dist/alpha-zero/security/simulation.js +277 -0
  45. package/dist/alpha-zero/security/simulation.js.map +1 -0
  46. package/dist/alpha-zero/selfModification.d.ts +109 -0
  47. package/dist/alpha-zero/selfModification.d.ts.map +1 -0
  48. package/dist/alpha-zero/selfModification.js +233 -0
  49. package/dist/alpha-zero/selfModification.js.map +1 -0
  50. package/dist/alpha-zero/types.d.ts +170 -0
  51. package/dist/alpha-zero/types.d.ts.map +1 -0
  52. package/dist/alpha-zero/types.js +31 -0
  53. package/dist/alpha-zero/types.js.map +1 -0
  54. package/dist/bin/erosolar.js +21 -5
  55. package/dist/bin/erosolar.js.map +1 -1
  56. package/dist/capabilities/agentSpawningCapability.d.ts.map +1 -1
  57. package/dist/capabilities/agentSpawningCapability.js +31 -56
  58. package/dist/capabilities/agentSpawningCapability.js.map +1 -1
  59. package/dist/capabilities/securityTestingCapability.d.ts +13 -0
  60. package/dist/capabilities/securityTestingCapability.d.ts.map +1 -0
  61. package/dist/capabilities/securityTestingCapability.js +25 -0
  62. package/dist/capabilities/securityTestingCapability.js.map +1 -0
  63. package/dist/contracts/agent-schemas.json +15 -0
  64. package/dist/contracts/tools.schema.json +9 -0
  65. package/dist/core/agent.d.ts +2 -2
  66. package/dist/core/agent.d.ts.map +1 -1
  67. package/dist/core/agent.js.map +1 -1
  68. package/dist/core/aiFlowOptimizer.d.ts +26 -0
  69. package/dist/core/aiFlowOptimizer.d.ts.map +1 -0
  70. package/dist/core/aiFlowOptimizer.js +31 -0
  71. package/dist/core/aiFlowOptimizer.js.map +1 -0
  72. package/dist/core/aiOptimizationEngine.d.ts +158 -0
  73. package/dist/core/aiOptimizationEngine.d.ts.map +1 -0
  74. package/dist/core/aiOptimizationEngine.js +428 -0
  75. package/dist/core/aiOptimizationEngine.js.map +1 -0
  76. package/dist/core/aiOptimizationIntegration.d.ts +93 -0
  77. package/dist/core/aiOptimizationIntegration.d.ts.map +1 -0
  78. package/dist/core/aiOptimizationIntegration.js +250 -0
  79. package/dist/core/aiOptimizationIntegration.js.map +1 -0
  80. package/dist/core/customCommands.d.ts +0 -1
  81. package/dist/core/customCommands.d.ts.map +1 -1
  82. package/dist/core/customCommands.js +0 -3
  83. package/dist/core/customCommands.js.map +1 -1
  84. package/dist/core/enhancedErrorRecovery.d.ts +100 -0
  85. package/dist/core/enhancedErrorRecovery.d.ts.map +1 -0
  86. package/dist/core/enhancedErrorRecovery.js +345 -0
  87. package/dist/core/enhancedErrorRecovery.js.map +1 -0
  88. package/dist/core/hooksSystem.d.ts +65 -0
  89. package/dist/core/hooksSystem.d.ts.map +1 -0
  90. package/dist/core/hooksSystem.js +273 -0
  91. package/dist/core/hooksSystem.js.map +1 -0
  92. package/dist/core/memorySystem.d.ts +48 -0
  93. package/dist/core/memorySystem.d.ts.map +1 -0
  94. package/dist/core/memorySystem.js +271 -0
  95. package/dist/core/memorySystem.js.map +1 -0
  96. package/dist/core/toolPreconditions.d.ts.map +1 -1
  97. package/dist/core/toolPreconditions.js +14 -0
  98. package/dist/core/toolPreconditions.js.map +1 -1
  99. package/dist/core/toolRuntime.d.ts +1 -22
  100. package/dist/core/toolRuntime.d.ts.map +1 -1
  101. package/dist/core/toolRuntime.js +5 -0
  102. package/dist/core/toolRuntime.js.map +1 -1
  103. package/dist/core/toolValidation.d.ts.map +1 -1
  104. package/dist/core/toolValidation.js +3 -14
  105. package/dist/core/toolValidation.js.map +1 -1
  106. package/dist/core/unified/errors.d.ts +189 -0
  107. package/dist/core/unified/errors.d.ts.map +1 -0
  108. package/dist/core/unified/errors.js +497 -0
  109. package/dist/core/unified/errors.js.map +1 -0
  110. package/dist/core/unified/index.d.ts +19 -0
  111. package/dist/core/unified/index.d.ts.map +1 -0
  112. package/dist/core/unified/index.js +68 -0
  113. package/dist/core/unified/index.js.map +1 -0
  114. package/dist/core/unified/schema.d.ts +101 -0
  115. package/dist/core/unified/schema.d.ts.map +1 -0
  116. package/dist/core/unified/schema.js +350 -0
  117. package/dist/core/unified/schema.js.map +1 -0
  118. package/dist/core/unified/toolRuntime.d.ts +179 -0
  119. package/dist/core/unified/toolRuntime.d.ts.map +1 -0
  120. package/dist/core/unified/toolRuntime.js +517 -0
  121. package/dist/core/unified/toolRuntime.js.map +1 -0
  122. package/dist/core/unified/tools.d.ts +127 -0
  123. package/dist/core/unified/tools.d.ts.map +1 -0
  124. package/dist/core/unified/tools.js +1333 -0
  125. package/dist/core/unified/tools.js.map +1 -0
  126. package/dist/core/unified/types.d.ts +352 -0
  127. package/dist/core/unified/types.d.ts.map +1 -0
  128. package/dist/core/unified/types.js +12 -0
  129. package/dist/core/unified/types.js.map +1 -0
  130. package/dist/core/unified/version.d.ts +209 -0
  131. package/dist/core/unified/version.d.ts.map +1 -0
  132. package/dist/core/unified/version.js +454 -0
  133. package/dist/core/unified/version.js.map +1 -0
  134. package/dist/core/validationRunner.d.ts +3 -1
  135. package/dist/core/validationRunner.d.ts.map +1 -1
  136. package/dist/core/validationRunner.js.map +1 -1
  137. package/dist/headless/headlessApp.d.ts.map +1 -1
  138. package/dist/headless/headlessApp.js +0 -21
  139. package/dist/headless/headlessApp.js.map +1 -1
  140. package/dist/mcp/sseClient.d.ts.map +1 -1
  141. package/dist/mcp/sseClient.js +18 -9
  142. package/dist/mcp/sseClient.js.map +1 -1
  143. package/dist/plugins/tools/build/buildPlugin.d.ts +6 -0
  144. package/dist/plugins/tools/build/buildPlugin.d.ts.map +1 -1
  145. package/dist/plugins/tools/build/buildPlugin.js +10 -4
  146. package/dist/plugins/tools/build/buildPlugin.js.map +1 -1
  147. package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
  148. package/dist/plugins/tools/nodeDefaults.js +2 -0
  149. package/dist/plugins/tools/nodeDefaults.js.map +1 -1
  150. package/dist/plugins/tools/security/securityPlugin.d.ts +3 -0
  151. package/dist/plugins/tools/security/securityPlugin.d.ts.map +1 -0
  152. package/dist/plugins/tools/security/securityPlugin.js +12 -0
  153. package/dist/plugins/tools/security/securityPlugin.js.map +1 -0
  154. package/dist/runtime/agentSession.d.ts +2 -2
  155. package/dist/runtime/agentSession.d.ts.map +1 -1
  156. package/dist/runtime/agentSession.js +2 -2
  157. package/dist/runtime/agentSession.js.map +1 -1
  158. package/dist/security/active-stack-security.d.ts +112 -0
  159. package/dist/security/active-stack-security.d.ts.map +1 -0
  160. package/dist/security/active-stack-security.js +296 -0
  161. package/dist/security/active-stack-security.js.map +1 -0
  162. package/dist/security/advanced-persistence-research.d.ts +92 -0
  163. package/dist/security/advanced-persistence-research.d.ts.map +1 -0
  164. package/dist/security/advanced-persistence-research.js +195 -0
  165. package/dist/security/advanced-persistence-research.js.map +1 -0
  166. package/dist/security/advanced-targeting.d.ts +119 -0
  167. package/dist/security/advanced-targeting.d.ts.map +1 -0
  168. package/dist/security/advanced-targeting.js +233 -0
  169. package/dist/security/advanced-targeting.js.map +1 -0
  170. package/dist/security/assessment/vulnerabilityAssessment.d.ts +104 -0
  171. package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +1 -0
  172. package/dist/security/assessment/vulnerabilityAssessment.js +315 -0
  173. package/dist/security/assessment/vulnerabilityAssessment.js.map +1 -0
  174. package/dist/security/authorization/securityAuthorization.d.ts +88 -0
  175. package/dist/security/authorization/securityAuthorization.d.ts.map +1 -0
  176. package/dist/security/authorization/securityAuthorization.js +172 -0
  177. package/dist/security/authorization/securityAuthorization.js.map +1 -0
  178. package/dist/security/comprehensive-targeting.d.ts +85 -0
  179. package/dist/security/comprehensive-targeting.d.ts.map +1 -0
  180. package/dist/security/comprehensive-targeting.js +438 -0
  181. package/dist/security/comprehensive-targeting.js.map +1 -0
  182. package/dist/security/global-security-integration.d.ts +91 -0
  183. package/dist/security/global-security-integration.d.ts.map +1 -0
  184. package/dist/security/global-security-integration.js +218 -0
  185. package/dist/security/global-security-integration.js.map +1 -0
  186. package/dist/security/index.d.ts +38 -0
  187. package/dist/security/index.d.ts.map +1 -0
  188. package/dist/security/index.js +47 -0
  189. package/dist/security/index.js.map +1 -0
  190. package/dist/security/persistence-analyzer.d.ts +56 -0
  191. package/dist/security/persistence-analyzer.d.ts.map +1 -0
  192. package/dist/security/persistence-analyzer.js +187 -0
  193. package/dist/security/persistence-analyzer.js.map +1 -0
  194. package/dist/security/persistence-cli.d.ts +36 -0
  195. package/dist/security/persistence-cli.d.ts.map +1 -0
  196. package/dist/security/persistence-cli.js +160 -0
  197. package/dist/security/persistence-cli.js.map +1 -0
  198. package/dist/security/persistence-research.d.ts +92 -0
  199. package/dist/security/persistence-research.d.ts.map +1 -0
  200. package/dist/security/persistence-research.js +364 -0
  201. package/dist/security/persistence-research.js.map +1 -0
  202. package/dist/security/research/persistenceResearch.d.ts +97 -0
  203. package/dist/security/research/persistenceResearch.d.ts.map +1 -0
  204. package/dist/security/research/persistenceResearch.js +282 -0
  205. package/dist/security/research/persistenceResearch.js.map +1 -0
  206. package/dist/security/security-integration.d.ts +74 -0
  207. package/dist/security/security-integration.d.ts.map +1 -0
  208. package/dist/security/security-integration.js +137 -0
  209. package/dist/security/security-integration.js.map +1 -0
  210. package/dist/security/security-testing-framework.d.ts +112 -0
  211. package/dist/security/security-testing-framework.d.ts.map +1 -0
  212. package/dist/security/security-testing-framework.js +364 -0
  213. package/dist/security/security-testing-framework.js.map +1 -0
  214. package/dist/security/simulation/attackSimulation.d.ts +93 -0
  215. package/dist/security/simulation/attackSimulation.d.ts.map +1 -0
  216. package/dist/security/simulation/attackSimulation.js +341 -0
  217. package/dist/security/simulation/attackSimulation.js.map +1 -0
  218. package/dist/security/strategic-operations.d.ts +100 -0
  219. package/dist/security/strategic-operations.d.ts.map +1 -0
  220. package/dist/security/strategic-operations.js +276 -0
  221. package/dist/security/strategic-operations.js.map +1 -0
  222. package/dist/security/tool-security-wrapper.d.ts +58 -0
  223. package/dist/security/tool-security-wrapper.d.ts.map +1 -0
  224. package/dist/security/tool-security-wrapper.js +156 -0
  225. package/dist/security/tool-security-wrapper.js.map +1 -0
  226. package/dist/shell/claudeCodeStreamHandler.d.ts +145 -0
  227. package/dist/shell/claudeCodeStreamHandler.d.ts.map +1 -0
  228. package/dist/shell/claudeCodeStreamHandler.js +322 -0
  229. package/dist/shell/claudeCodeStreamHandler.js.map +1 -0
  230. package/dist/shell/inputQueueManager.d.ts +144 -0
  231. package/dist/shell/inputQueueManager.d.ts.map +1 -0
  232. package/dist/shell/inputQueueManager.js +290 -0
  233. package/dist/shell/inputQueueManager.js.map +1 -0
  234. package/dist/shell/interactiveShell.d.ts +7 -16
  235. package/dist/shell/interactiveShell.d.ts.map +1 -1
  236. package/dist/shell/interactiveShell.js +164 -235
  237. package/dist/shell/interactiveShell.js.map +1 -1
  238. package/dist/shell/metricsTracker.d.ts +60 -0
  239. package/dist/shell/metricsTracker.d.ts.map +1 -0
  240. package/dist/shell/metricsTracker.js +119 -0
  241. package/dist/shell/metricsTracker.js.map +1 -0
  242. package/dist/shell/shellApp.d.ts +0 -2
  243. package/dist/shell/shellApp.d.ts.map +1 -1
  244. package/dist/shell/shellApp.js +9 -40
  245. package/dist/shell/shellApp.js.map +1 -1
  246. package/dist/shell/streamingOutputManager.d.ts +115 -0
  247. package/dist/shell/streamingOutputManager.d.ts.map +1 -0
  248. package/dist/shell/streamingOutputManager.js +225 -0
  249. package/dist/shell/streamingOutputManager.js.map +1 -0
  250. package/dist/shell/systemPrompt.d.ts.map +1 -1
  251. package/dist/shell/systemPrompt.js +4 -1
  252. package/dist/shell/systemPrompt.js.map +1 -1
  253. package/dist/shell/terminalInput.d.ts +116 -149
  254. package/dist/shell/terminalInput.d.ts.map +1 -1
  255. package/dist/shell/terminalInput.js +527 -639
  256. package/dist/shell/terminalInput.js.map +1 -1
  257. package/dist/shell/terminalInputAdapter.d.ts +20 -79
  258. package/dist/shell/terminalInputAdapter.d.ts.map +1 -1
  259. package/dist/shell/terminalInputAdapter.js +30 -99
  260. package/dist/shell/terminalInputAdapter.js.map +1 -1
  261. package/dist/subagents/taskRunner.d.ts +1 -7
  262. package/dist/subagents/taskRunner.d.ts.map +1 -1
  263. package/dist/subagents/taskRunner.js +47 -180
  264. package/dist/subagents/taskRunner.js.map +1 -1
  265. package/dist/tools/securityTools.d.ts +22 -0
  266. package/dist/tools/securityTools.d.ts.map +1 -0
  267. package/dist/tools/securityTools.js +448 -0
  268. package/dist/tools/securityTools.js.map +1 -0
  269. package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
  270. package/dist/ui/ShellUIAdapter.js +12 -13
  271. package/dist/ui/ShellUIAdapter.js.map +1 -1
  272. package/dist/ui/display.d.ts +45 -24
  273. package/dist/ui/display.d.ts.map +1 -1
  274. package/dist/ui/display.js +259 -140
  275. package/dist/ui/display.js.map +1 -1
  276. package/dist/ui/persistentPrompt.d.ts +50 -0
  277. package/dist/ui/persistentPrompt.d.ts.map +1 -0
  278. package/dist/ui/persistentPrompt.js +92 -0
  279. package/dist/ui/persistentPrompt.js.map +1 -0
  280. package/dist/ui/terminalUISchema.d.ts +195 -0
  281. package/dist/ui/terminalUISchema.d.ts.map +1 -0
  282. package/dist/ui/terminalUISchema.js +113 -0
  283. package/dist/ui/terminalUISchema.js.map +1 -0
  284. package/dist/ui/theme.d.ts.map +1 -1
  285. package/dist/ui/theme.js +8 -6
  286. package/dist/ui/theme.js.map +1 -1
  287. package/dist/ui/toolDisplay.d.ts +158 -0
  288. package/dist/ui/toolDisplay.d.ts.map +1 -1
  289. package/dist/ui/toolDisplay.js +348 -0
  290. package/dist/ui/toolDisplay.js.map +1 -1
  291. package/dist/ui/unified/layout.d.ts +0 -1
  292. package/dist/ui/unified/layout.d.ts.map +1 -1
  293. package/dist/ui/unified/layout.js +25 -15
  294. package/dist/ui/unified/layout.js.map +1 -1
  295. package/package.json +4 -4
  296. package/scripts/deploy-security-capabilities.js +178 -0
  297. package/dist/core/hooks.d.ts +0 -113
  298. package/dist/core/hooks.d.ts.map +0 -1
  299. package/dist/core/hooks.js +0 -267
  300. package/dist/core/hooks.js.map +0 -1
  301. package/dist/core/metricsTracker.d.ts +0 -122
  302. package/dist/core/metricsTracker.d.ts.map +0 -1
  303. package/dist/core/metricsTracker.js.map +0 -1
  304. package/dist/core/securityAssessment.d.ts +0 -91
  305. package/dist/core/securityAssessment.d.ts.map +0 -1
  306. package/dist/core/securityAssessment.js +0 -580
  307. package/dist/core/securityAssessment.js.map +0 -1
  308. package/dist/core/verification.d.ts +0 -137
  309. package/dist/core/verification.d.ts.map +0 -1
  310. package/dist/core/verification.js +0 -323
  311. package/dist/core/verification.js.map +0 -1
  312. package/dist/subagents/agentConfig.d.ts +0 -27
  313. package/dist/subagents/agentConfig.d.ts.map +0 -1
  314. package/dist/subagents/agentConfig.js +0 -89
  315. package/dist/subagents/agentConfig.js.map +0 -1
  316. package/dist/subagents/agentRegistry.d.ts +0 -33
  317. package/dist/subagents/agentRegistry.d.ts.map +0 -1
  318. package/dist/subagents/agentRegistry.js +0 -162
  319. package/dist/subagents/agentRegistry.js.map +0 -1
  320. package/dist/utils/frontmatter.d.ts +0 -10
  321. package/dist/utils/frontmatter.d.ts.map +0 -1
  322. package/dist/utils/frontmatter.js +0 -78
  323. package/dist/utils/frontmatter.js.map +0 -1
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Core Security Research Framework
3
+ *
4
+ * Base authorization system and reconnaissance capabilities.
5
+ * All operations require explicit authorization.
6
+ *
7
+ * Principal Investigator: Bo Shang
8
+ * Framework: erosolar-cli
9
+ */
10
+ /**
11
+ * Scope of authorization for security testing
12
+ */
13
+ export declare enum AuthorizationScope {
14
+ OWNED_SYSTEMS = "owned_systems",
15
+ BUG_BOUNTY = "bug_bounty",
16
+ PENTEST_ENGAGEMENT = "pentest_engagement",
17
+ CTF_COMPETITION = "ctf_competition",
18
+ RED_TEAM = "red_team",
19
+ EDUCATIONAL = "educational"
20
+ }
21
+ /**
22
+ * Authorization record for security testing
23
+ */
24
+ export interface AuthorizationRecord {
25
+ scope: AuthorizationScope;
26
+ targetDomain: string;
27
+ authorizedBy: string;
28
+ authorizationDate: string;
29
+ expirationDate?: string;
30
+ scopeLimitations: string[];
31
+ outOfScope: string[];
32
+ notes: string;
33
+ }
34
+ /**
35
+ * Reconnaissance result
36
+ */
37
+ export interface ReconResult {
38
+ target: string;
39
+ timestamp: number;
40
+ dnsRecords: Record<string, string[]>;
41
+ openPorts: number[];
42
+ sslInfo: Record<string, unknown>;
43
+ httpHeaders: Record<string, string>;
44
+ technologies: string[];
45
+ subdomains: string[];
46
+ potentialVectors: string[];
47
+ }
48
+ /**
49
+ * Vulnerability finding
50
+ */
51
+ export interface VulnerabilityFinding {
52
+ title: string;
53
+ severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
54
+ category: string;
55
+ description: string;
56
+ evidence: string;
57
+ remediation: string;
58
+ cvssScore?: number;
59
+ cweId?: string;
60
+ affectedComponent?: string;
61
+ }
62
+ /**
63
+ * Security research engine configuration
64
+ */
65
+ export interface SecurityResearchConfig {
66
+ dataDir: string;
67
+ verbose: boolean;
68
+ }
69
+ /**
70
+ * Security Research Engine
71
+ *
72
+ * All operations require explicit authorization records.
73
+ */
74
+ export declare class SecurityResearchEngine {
75
+ private config;
76
+ private authorization;
77
+ findings: VulnerabilityFinding[];
78
+ reconResults: ReconResult[];
79
+ constructor(config?: Partial<SecurityResearchConfig>);
80
+ /**
81
+ * Set authorization for testing
82
+ */
83
+ setAuthorization(authorization: AuthorizationRecord): void;
84
+ /**
85
+ * Check if authorization is valid
86
+ */
87
+ private checkAuthorization;
88
+ /**
89
+ * Perform passive reconnaissance
90
+ */
91
+ passiveRecon(target: string): Promise<ReconResult>;
92
+ /**
93
+ * Perform active reconnaissance (requires stronger authorization)
94
+ */
95
+ activeRecon(target: string, ports?: number[]): Promise<ReconResult>;
96
+ /**
97
+ * Scan ports
98
+ */
99
+ private scanPorts;
100
+ /**
101
+ * Identify potential attack vectors
102
+ */
103
+ private identifyVectors;
104
+ /**
105
+ * Analyze for vulnerabilities
106
+ */
107
+ analyzeForVulnerabilities(recon: ReconResult): VulnerabilityFinding[];
108
+ /**
109
+ * Generate report
110
+ */
111
+ generateReport(format?: 'text' | 'json'): string;
112
+ }
113
+ /**
114
+ * Create bug bounty authorization
115
+ */
116
+ export declare function createBugBountyAuthorization(targetDomain: string, programName: string, scopeLimitations?: string[], outOfScope?: string[]): AuthorizationRecord;
117
+ /**
118
+ * Create pentest authorization
119
+ */
120
+ export declare function createPentestAuthorization(targetDomain: string, clientName: string, engagementId: string, expirationDate: string): AuthorizationRecord;
121
+ /**
122
+ * Create CTF authorization
123
+ */
124
+ export declare function createCtfAuthorization(targetDomain: string, ctfName: string): AuthorizationRecord;
125
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/alpha-zero/security/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,eAAe,oBAAoB;IACnC,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAA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,WAAW,EAAE,CAAM;gBAE5B,MAAM,GAAE,OAAO,CAAC,sBAAsB,CAAM;IAIxD;;OAEG;IACH,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,GAAG,IAAI;IAO1D;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAwCxD;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,WAAW,CAAC;IA0BhG;;OAEG;YACW,SAAS;IAiCvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAkBvB;;OAEG;IACH,yBAAyB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,EAAE;IAoBrE;;OAEG;IACH,cAAc,CAAC,MAAM,GAAE,MAAM,GAAG,MAAe,GAAG,MAAM;CA+BzD;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,gBAAgB,GAAE,MAAM,EAAO,EAC/B,UAAU,GAAE,MAAM,EAAO,GACxB,mBAAmB,CAUrB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GACrB,mBAAmB,CAWrB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,mBAAmB,CAUrB"}
@@ -0,0 +1,271 @@
1
+ /**
2
+ * Core Security Research Framework
3
+ *
4
+ * Base authorization system and reconnaissance capabilities.
5
+ * All operations require explicit authorization.
6
+ *
7
+ * Principal Investigator: Bo Shang
8
+ * Framework: erosolar-cli
9
+ */
10
+ import * as dns from 'dns/promises';
11
+ import * as net from 'net';
12
+ /**
13
+ * Scope of authorization for security testing
14
+ */
15
+ export var AuthorizationScope;
16
+ (function (AuthorizationScope) {
17
+ AuthorizationScope["OWNED_SYSTEMS"] = "owned_systems";
18
+ AuthorizationScope["BUG_BOUNTY"] = "bug_bounty";
19
+ AuthorizationScope["PENTEST_ENGAGEMENT"] = "pentest_engagement";
20
+ AuthorizationScope["CTF_COMPETITION"] = "ctf_competition";
21
+ AuthorizationScope["RED_TEAM"] = "red_team";
22
+ AuthorizationScope["EDUCATIONAL"] = "educational";
23
+ })(AuthorizationScope || (AuthorizationScope = {}));
24
+ const DEFAULT_CONFIG = {
25
+ dataDir: '.security_research',
26
+ verbose: false,
27
+ };
28
+ /**
29
+ * Security Research Engine
30
+ *
31
+ * All operations require explicit authorization records.
32
+ */
33
+ export class SecurityResearchEngine {
34
+ config;
35
+ authorization = null;
36
+ findings = [];
37
+ reconResults = [];
38
+ constructor(config = {}) {
39
+ this.config = { ...DEFAULT_CONFIG, ...config };
40
+ }
41
+ /**
42
+ * Set authorization for testing
43
+ */
44
+ setAuthorization(authorization) {
45
+ this.authorization = authorization;
46
+ if (this.config.verbose) {
47
+ console.log(`[Authorization] Set for ${authorization.targetDomain}`);
48
+ }
49
+ }
50
+ /**
51
+ * Check if authorization is valid
52
+ */
53
+ checkAuthorization(target) {
54
+ if (!this.authorization) {
55
+ throw new Error('No authorization record set.');
56
+ }
57
+ // Check expiration
58
+ if (this.authorization.expirationDate) {
59
+ const exp = new Date(this.authorization.expirationDate);
60
+ if (new Date() > exp) {
61
+ throw new Error('Authorization has expired.');
62
+ }
63
+ }
64
+ // Check scope
65
+ const inScope = this.authorization.targetDomain.includes(target) ||
66
+ target.endsWith(this.authorization.targetDomain);
67
+ const outOfScope = this.authorization.outOfScope.some(oos => target.includes(oos));
68
+ if (!inScope || outOfScope) {
69
+ throw new Error(`Target ${target} is not within authorized scope.`);
70
+ }
71
+ }
72
+ /**
73
+ * Perform passive reconnaissance
74
+ */
75
+ async passiveRecon(target) {
76
+ this.checkAuthorization(target);
77
+ if (this.config.verbose) {
78
+ console.log(`[Recon] Starting passive recon on ${target}`);
79
+ }
80
+ const result = {
81
+ target,
82
+ timestamp: Date.now(),
83
+ dnsRecords: {},
84
+ openPorts: [],
85
+ sslInfo: {},
86
+ httpHeaders: {},
87
+ technologies: [],
88
+ subdomains: [],
89
+ potentialVectors: [],
90
+ };
91
+ // DNS lookup
92
+ try {
93
+ result.dnsRecords['A'] = await dns.resolve4(target);
94
+ }
95
+ catch { /* ignore */ }
96
+ try {
97
+ result.dnsRecords['MX'] = (await dns.resolveMx(target)).map(r => r.exchange);
98
+ }
99
+ catch { /* ignore */ }
100
+ try {
101
+ result.dnsRecords['TXT'] = await dns.resolveTxt(target).then(r => r.flat());
102
+ }
103
+ catch { /* ignore */ }
104
+ // Common subdomain patterns
105
+ const prefixes = ['www', 'mail', 'api', 'dev', 'staging', 'admin'];
106
+ result.subdomains = prefixes.map(p => `${p}.${target}`);
107
+ this.reconResults.push(result);
108
+ return result;
109
+ }
110
+ /**
111
+ * Perform active reconnaissance (requires stronger authorization)
112
+ */
113
+ async activeRecon(target, ports = [80, 443, 8080, 8443]) {
114
+ this.checkAuthorization(target);
115
+ // Active recon requires stronger authorization
116
+ const allowed = [
117
+ AuthorizationScope.OWNED_SYSTEMS,
118
+ AuthorizationScope.PENTEST_ENGAGEMENT,
119
+ AuthorizationScope.RED_TEAM,
120
+ AuthorizationScope.CTF_COMPETITION,
121
+ ];
122
+ if (!allowed.includes(this.authorization.scope)) {
123
+ throw new Error('Active recon requires stronger authorization.');
124
+ }
125
+ const result = await this.passiveRecon(target);
126
+ // Port scan
127
+ result.openPorts = await this.scanPorts(target, ports);
128
+ // Identify vectors
129
+ result.potentialVectors = this.identifyVectors(result);
130
+ return result;
131
+ }
132
+ /**
133
+ * Scan ports
134
+ */
135
+ async scanPorts(host, ports) {
136
+ const checkPort = (port) => {
137
+ return new Promise(resolve => {
138
+ const socket = new net.Socket();
139
+ socket.setTimeout(2000);
140
+ socket.on('connect', () => {
141
+ socket.destroy();
142
+ resolve(true);
143
+ });
144
+ socket.on('error', () => {
145
+ socket.destroy();
146
+ resolve(false);
147
+ });
148
+ socket.on('timeout', () => {
149
+ socket.destroy();
150
+ resolve(false);
151
+ });
152
+ socket.connect(port, host);
153
+ });
154
+ };
155
+ const results = await Promise.all(ports.map(async (port) => {
156
+ const isOpen = await checkPort(port);
157
+ return isOpen ? port : null;
158
+ }));
159
+ return results.filter((p) => p !== null);
160
+ }
161
+ /**
162
+ * Identify potential attack vectors
163
+ */
164
+ identifyVectors(recon) {
165
+ const vectors = [];
166
+ // Missing security headers (would need HTTP request to determine)
167
+ // Placeholder for now
168
+ vectors.push('Check for missing security headers');
169
+ // Open ports analysis
170
+ if (recon.openPorts.includes(21)) {
171
+ vectors.push('FTP port open - check for anonymous access');
172
+ }
173
+ if (recon.openPorts.includes(22)) {
174
+ vectors.push('SSH port open - check for weak credentials');
175
+ }
176
+ return vectors;
177
+ }
178
+ /**
179
+ * Analyze for vulnerabilities
180
+ */
181
+ analyzeForVulnerabilities(recon) {
182
+ this.checkAuthorization(recon.target);
183
+ const findings = [];
184
+ // Example: missing HSTS (would need actual HTTP response)
185
+ findings.push({
186
+ title: 'Missing HSTS Header (Verify Required)',
187
+ severity: 'medium',
188
+ category: 'config',
189
+ description: 'Verify HSTS header is present.',
190
+ evidence: 'Requires HTTP response analysis',
191
+ remediation: 'Add Strict-Transport-Security header',
192
+ cweId: 'CWE-319',
193
+ });
194
+ this.findings.push(...findings);
195
+ return findings;
196
+ }
197
+ /**
198
+ * Generate report
199
+ */
200
+ generateReport(format = 'text') {
201
+ if (format === 'json') {
202
+ return JSON.stringify({
203
+ generated: new Date().toISOString(),
204
+ authorization: this.authorization,
205
+ findings: this.findings,
206
+ reconResults: this.reconResults,
207
+ }, null, 2);
208
+ }
209
+ const lines = [
210
+ '='.repeat(60),
211
+ 'SECURITY RESEARCH REPORT',
212
+ '='.repeat(60),
213
+ `Generated: ${new Date().toISOString()}`,
214
+ ];
215
+ if (this.authorization) {
216
+ lines.push(`Target: ${this.authorization.targetDomain}`);
217
+ lines.push(`Scope: ${this.authorization.scope}`);
218
+ }
219
+ if (this.findings.length > 0) {
220
+ lines.push('', `Findings: ${this.findings.length}`);
221
+ for (const f of this.findings) {
222
+ lines.push(` [${f.severity.toUpperCase()}] ${f.title}`);
223
+ }
224
+ }
225
+ return lines.join('\n');
226
+ }
227
+ }
228
+ /**
229
+ * Create bug bounty authorization
230
+ */
231
+ export function createBugBountyAuthorization(targetDomain, programName, scopeLimitations = [], outOfScope = []) {
232
+ return {
233
+ scope: AuthorizationScope.BUG_BOUNTY,
234
+ targetDomain,
235
+ authorizedBy: `Bug Bounty: ${programName}`,
236
+ authorizationDate: new Date().toISOString(),
237
+ scopeLimitations,
238
+ outOfScope,
239
+ notes: 'Testing authorized under bug bounty program terms',
240
+ };
241
+ }
242
+ /**
243
+ * Create pentest authorization
244
+ */
245
+ export function createPentestAuthorization(targetDomain, clientName, engagementId, expirationDate) {
246
+ return {
247
+ scope: AuthorizationScope.PENTEST_ENGAGEMENT,
248
+ targetDomain,
249
+ authorizedBy: `Client: ${clientName} (${engagementId})`,
250
+ authorizationDate: new Date().toISOString(),
251
+ expirationDate,
252
+ scopeLimitations: [],
253
+ outOfScope: [],
254
+ notes: 'Testing authorized under penetration testing agreement',
255
+ };
256
+ }
257
+ /**
258
+ * Create CTF authorization
259
+ */
260
+ export function createCtfAuthorization(targetDomain, ctfName) {
261
+ return {
262
+ scope: AuthorizationScope.CTF_COMPETITION,
263
+ targetDomain,
264
+ authorizedBy: `CTF: ${ctfName}`,
265
+ authorizationDate: new Date().toISOString(),
266
+ scopeLimitations: [],
267
+ outOfScope: [],
268
+ notes: 'CTF competition testing',
269
+ };
270
+ }
271
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/alpha-zero/security/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,K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,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,YAAoB,EACpB,WAAmB,EACnB,mBAA6B,EAAE,EAC/B,aAAuB,EAAE;IAEzB,OAAO;QACL,KAAK,EAAE,kBAAkB,CAAC,UAAU;QACpC,YAAY;QACZ,YAAY,EAAE,eAAe,WAAW,EAAE;QAC1C,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC3C,gBAAgB;QAChB,UAAU;QACV,KAAK,EAAE,mDAAmD;KAC3D,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,YAAoB,EACpB,UAAkB,EAClB,YAAoB,EACpB,cAAsB;IAEtB,OAAO;QACL,KAAK,EAAE,kBAAkB,CAAC,kBAAkB;QAC5C,YAAY;QACZ,YAAY,EAAE,WAAW,UAAU,KAAK,YAAY,GAAG;QACvD,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC3C,cAAc;QACd,gBAAgB,EAAE,EAAE;QACpB,UAAU,EAAE,EAAE;QACd,KAAK,EAAE,wDAAwD;KAChE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAAoB,EACpB,OAAe;IAEf,OAAO;QACL,KAAK,EAAE,kBAAkB,CAAC,eAAe;QACzC,YAAY;QACZ,YAAY,EAAE,QAAQ,OAAO,EAAE;QAC/B,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC3C,gBAAgB,EAAE,EAAE;QACpB,UAAU,EAAE,EAAE;QACd,KAAK,EAAE,yBAAyB;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Google Infrastructure Persistence Vector Research
3
+ *
4
+ * OPTIONAL MODULE - Only loaded when Google security research is enabled.
5
+ *
6
+ * Provides research tools for identifying persistence mechanisms
7
+ * in Google Cloud Platform and Google Workspace environments.
8
+ *
9
+ * AUTHORIZATION: Designed for authorized red team engagements and
10
+ * penetration testing of Google infrastructure under contract.
11
+ *
12
+ * Principal Investigator: Bo Shang
13
+ * Framework: erosolar-cli
14
+ */
15
+ import { AuthorizationRecord } from './core.js';
16
+ /**
17
+ * Google services for persistence research
18
+ */
19
+ export declare enum GoogleService {
20
+ GCP_COMPUTE = "gcp_compute_engine",
21
+ GCP_GKE = "gcp_kubernetes_engine",
22
+ GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions",
23
+ GCP_IAM = "gcp_iam",
24
+ GCP_SERVICE_ACCOUNTS = "gcp_service_accounts",
25
+ GCP_CLOUD_STORAGE = "gcp_cloud_storage",
26
+ GCP_SECRETS_MANAGER = "gcp_secrets_manager",
27
+ WORKSPACE_GMAIL = "workspace_gmail",
28
+ WORKSPACE_DRIVE = "workspace_drive",
29
+ WORKSPACE_ADMIN = "workspace_admin",
30
+ WORKSPACE_APPS_SCRIPT = "workspace_apps_script",
31
+ GOOGLE_OAUTH = "google_oauth"
32
+ }
33
+ /**
34
+ * Categories of persistence mechanisms
35
+ */
36
+ export declare enum PersistenceCategory {
37
+ SERVICE_ACCOUNT_ABUSE = "service_account_abuse",
38
+ IAM_POLICY_MODIFICATION = "iam_policy_modification",
39
+ OAUTH_APP_CONSENT = "oauth_app_consent",
40
+ API_KEYS = "api_keys",
41
+ CLOUD_FUNCTION_TRIGGER = "cloud_function_trigger",
42
+ APPS_SCRIPT_TRIGGER = "apps_script_trigger",
43
+ DELEGATION_ABUSE = "delegation_abuse"
44
+ }
45
+ /**
46
+ * Persistence vector definition
47
+ */
48
+ export interface PersistenceVector {
49
+ name: string;
50
+ service: GoogleService;
51
+ category: PersistenceCategory;
52
+ description: string;
53
+ techniqueId: string;
54
+ requiredPermissions: string[];
55
+ detectionMethods: string[];
56
+ mitigations: string[];
57
+ stealthRating: number;
58
+ }
59
+ /**
60
+ * Persistence test result
61
+ */
62
+ export interface PersistenceTestResult {
63
+ vector: PersistenceVector;
64
+ targetProject: string;
65
+ timestamp: number;
66
+ testable: boolean;
67
+ permissionsVerified: string[];
68
+ missingPermissions: string[];
69
+ detectionRisk: string;
70
+ notes: string;
71
+ }
72
+ /**
73
+ * GCP Persistence Vectors
74
+ */
75
+ export declare const GCP_PERSISTENCE_VECTORS: Record<string, PersistenceVector>;
76
+ /**
77
+ * Workspace Persistence Vectors
78
+ */
79
+ export declare const WORKSPACE_PERSISTENCE_VECTORS: Record<string, PersistenceVector>;
80
+ /**
81
+ * Google Persistence Researcher
82
+ */
83
+ export declare class GooglePersistenceResearcher {
84
+ private authorization;
85
+ private verbose;
86
+ testResults: PersistenceTestResult[];
87
+ constructor(authorization: AuthorizationRecord, verbose?: boolean);
88
+ /**
89
+ * Check authorization
90
+ */
91
+ private checkAuthorization;
92
+ /**
93
+ * Get all Google persistence vectors
94
+ */
95
+ getAllVectors(): Record<string, PersistenceVector>;
96
+ /**
97
+ * Get vectors by service
98
+ */
99
+ getVectorsByService(service: GoogleService): PersistenceVector[];
100
+ /**
101
+ * Get vectors by category
102
+ */
103
+ getVectorsByCategory(category: PersistenceCategory): PersistenceVector[];
104
+ /**
105
+ * Get stealthy vectors
106
+ */
107
+ getStealthyVectors(minRating?: number): PersistenceVector[];
108
+ /**
109
+ * Analyze a persistence vector
110
+ */
111
+ analyzeVector(vectorId: string, targetProject: string): PersistenceTestResult;
112
+ /**
113
+ * Generate attack playbook
114
+ */
115
+ generateAttackPlaybook(targetProject: string, vectors?: PersistenceVector[]): Record<string, unknown>;
116
+ /**
117
+ * Generate detection report (blue team)
118
+ */
119
+ generateDetectionReport(): string;
120
+ }
121
+ /**
122
+ * Create Google authorization
123
+ */
124
+ export declare function createGoogleAuthorization(engagementType: 'bug_bounty' | 'pentest' | 'red_team' | 'owned', authorizedBy: string, targetProject?: string, scopeNotes?: string): AuthorizationRecord;
125
+ //# sourceMappingURL=google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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