erosolar-cli 1.5.2 → 1.5.4

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 (346) hide show
  1. package/config/security-deployment.json +54 -0
  2. package/dist/bin/adapters/node/index.js +33 -0
  3. package/dist/bin/adapters/types.js +1 -0
  4. package/dist/bin/alpha-zero/agentWrapper.js +165 -0
  5. package/dist/bin/alpha-zero/codeEvaluator.js +272 -0
  6. package/dist/bin/alpha-zero/competitiveRunner.js +219 -0
  7. package/dist/bin/alpha-zero/index.js +98 -0
  8. package/dist/bin/alpha-zero/introspection.js +298 -0
  9. package/dist/bin/alpha-zero/metricsTracker.js +207 -0
  10. package/dist/bin/alpha-zero/security/core.js +269 -0
  11. package/dist/bin/alpha-zero/security/google.js +308 -0
  12. package/dist/bin/alpha-zero/security/googleLoader.js +40 -0
  13. package/dist/bin/alpha-zero/security/index.js +31 -0
  14. package/dist/bin/alpha-zero/security/simulation.js +274 -0
  15. package/dist/bin/alpha-zero/selfModification.js +231 -0
  16. package/dist/bin/alpha-zero/types.js +30 -0
  17. package/dist/bin/bin/erosolar-optimized.js +205 -0
  18. package/dist/bin/capabilities/agentSpawningCapability.js +116 -0
  19. package/dist/bin/capabilities/bashCapability.js +22 -0
  20. package/dist/bin/capabilities/cloudCapability.js +36 -0
  21. package/dist/bin/capabilities/codeAnalysisCapability.js +22 -0
  22. package/dist/bin/capabilities/codeQualityCapability.js +23 -0
  23. package/dist/bin/capabilities/dependencySecurityCapability.js +22 -0
  24. package/dist/bin/capabilities/devCapability.js +22 -0
  25. package/dist/bin/capabilities/editCapability.js +28 -0
  26. package/dist/bin/capabilities/emailCapability.js +20 -0
  27. package/dist/bin/capabilities/enhancedGitCapability.js +221 -0
  28. package/dist/bin/capabilities/filesystemCapability.js +22 -0
  29. package/dist/bin/capabilities/globCapability.js +28 -0
  30. package/dist/bin/capabilities/interactionCapability.js +20 -0
  31. package/dist/bin/capabilities/learnCapability.js +22 -0
  32. package/dist/bin/capabilities/mcpCapability.js +20 -0
  33. package/dist/bin/capabilities/notebookCapability.js +28 -0
  34. package/dist/bin/capabilities/planningCapability.js +27 -0
  35. package/dist/bin/capabilities/refactoringCapability.js +23 -0
  36. package/dist/bin/capabilities/repoChecksCapability.js +22 -0
  37. package/dist/bin/capabilities/searchCapability.js +22 -0
  38. package/dist/bin/capabilities/skillCapability.js +76 -0
  39. package/dist/bin/capabilities/taskManagementCapability.js +20 -0
  40. package/dist/bin/capabilities/testingCapability.js +23 -0
  41. package/dist/bin/capabilities/toolManifest.js +159 -0
  42. package/dist/bin/capabilities/toolRegistry.js +114 -0
  43. package/dist/bin/capabilities/webCapability.js +20 -0
  44. package/dist/bin/config.js +139 -0
  45. package/dist/bin/contracts/v1/agent.js +7 -0
  46. package/dist/bin/contracts/v1/agentProfileManifest.js +8 -0
  47. package/dist/bin/contracts/v1/agentRules.js +9 -0
  48. package/dist/bin/contracts/v1/toolAccess.js +8 -0
  49. package/dist/bin/core/agent.js +362 -0
  50. package/dist/bin/core/agentProfileManifest.js +187 -0
  51. package/dist/bin/core/agentProfiles.js +34 -0
  52. package/dist/bin/core/agentRulebook.js +135 -0
  53. package/dist/bin/core/agentSchemaLoader.js +233 -0
  54. package/dist/bin/core/contextManager.js +412 -0
  55. package/dist/bin/core/contextWindow.js +122 -0
  56. package/dist/bin/core/customCommands.js +80 -0
  57. package/dist/bin/core/errors/apiKeyErrors.js +114 -0
  58. package/dist/bin/core/errors/errorTypes.js +340 -0
  59. package/dist/bin/core/errors/safetyValidator.js +304 -0
  60. package/dist/bin/core/errors.js +32 -0
  61. package/dist/bin/core/modelDiscovery.js +755 -0
  62. package/dist/bin/core/preferences.js +224 -0
  63. package/dist/bin/core/schemaValidator.js +92 -0
  64. package/dist/bin/core/secretStore.js +199 -0
  65. package/dist/bin/core/sessionStore.js +187 -0
  66. package/dist/bin/core/toolRuntime.js +290 -0
  67. package/dist/bin/core/types.js +1 -0
  68. package/dist/bin/erosolar-optimized.d.ts +12 -0
  69. package/dist/bin/erosolar-optimized.d.ts.map +1 -0
  70. package/dist/bin/erosolar-optimized.js +239 -0
  71. package/dist/bin/erosolar-optimized.js.map +1 -0
  72. package/dist/bin/erosolar.js +14 -0
  73. package/dist/bin/erosolar.js.map +1 -1
  74. package/dist/bin/headless/headlessApp.js +172 -0
  75. package/dist/bin/mcp/config.js +202 -0
  76. package/dist/bin/mcp/stdioClient.js +172 -0
  77. package/dist/bin/mcp/toolBridge.js +104 -0
  78. package/dist/bin/mcp/types.js +1 -0
  79. package/dist/bin/plugins/index.js +113 -0
  80. package/dist/bin/plugins/providers/anthropic/index.js +25 -0
  81. package/dist/bin/plugins/providers/deepseek/index.js +24 -0
  82. package/dist/bin/plugins/providers/google/index.js +26 -0
  83. package/dist/bin/plugins/providers/index.js +19 -0
  84. package/dist/bin/plugins/providers/ollama/index.js +59 -0
  85. package/dist/bin/plugins/providers/openai/index.js +26 -0
  86. package/dist/bin/plugins/providers/xai/index.js +24 -0
  87. package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +8 -0
  88. package/dist/bin/plugins/tools/bash/localBashPlugin.js +13 -0
  89. package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +13 -0
  90. package/dist/bin/plugins/tools/cloud/cloudPlugin.js +13 -0
  91. package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +13 -0
  92. package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +13 -0
  93. package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +11 -0
  94. package/dist/bin/plugins/tools/development/devPlugin.js +13 -0
  95. package/dist/bin/plugins/tools/edit/editPlugin.js +14 -0
  96. package/dist/bin/plugins/tools/email/emailPlugin.js +11 -0
  97. package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +8 -0
  98. package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +13 -0
  99. package/dist/bin/plugins/tools/glob/globPlugin.js +14 -0
  100. package/dist/bin/plugins/tools/index.js +2 -0
  101. package/dist/bin/plugins/tools/interaction/interactionPlugin.js +11 -0
  102. package/dist/bin/plugins/tools/learn/learnPlugin.js +13 -0
  103. package/dist/bin/plugins/tools/mcp/mcpPlugin.js +8 -0
  104. package/dist/bin/plugins/tools/nodeDefaults.js +56 -0
  105. package/dist/bin/plugins/tools/notebook/notebookPlugin.js +14 -0
  106. package/dist/bin/plugins/tools/planning/planningPlugin.js +14 -0
  107. package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +11 -0
  108. package/dist/bin/plugins/tools/registry.js +57 -0
  109. package/dist/bin/plugins/tools/search/localSearchPlugin.js +13 -0
  110. package/dist/bin/plugins/tools/skills/skillPlugin.js +8 -0
  111. package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +11 -0
  112. package/dist/bin/plugins/tools/testing/testingPlugin.js +11 -0
  113. package/dist/bin/plugins/tools/web/webPlugin.js +11 -0
  114. package/dist/bin/providers/anthropicProvider.js +329 -0
  115. package/dist/bin/providers/googleProvider.js +203 -0
  116. package/dist/bin/providers/openaiChatCompletionsProvider.js +208 -0
  117. package/dist/bin/providers/openaiResponsesProvider.js +249 -0
  118. package/dist/bin/providers/providerFactory.js +24 -0
  119. package/dist/bin/runtime/agentController.js +321 -0
  120. package/dist/bin/runtime/agentHost.js +153 -0
  121. package/dist/bin/runtime/agentSession.js +195 -0
  122. package/dist/bin/runtime/node.js +10 -0
  123. package/dist/bin/runtime/universal.js +28 -0
  124. package/dist/bin/shell/bracketedPasteManager.js +350 -0
  125. package/dist/bin/shell/fileChangeTracker.js +65 -0
  126. package/dist/bin/shell/interactiveShell.js +2908 -0
  127. package/dist/bin/shell/liveStatus.js +78 -0
  128. package/dist/bin/shell/shellApp.js +290 -0
  129. package/dist/bin/shell/systemPrompt.js +60 -0
  130. package/dist/bin/shell/updateManager.js +108 -0
  131. package/dist/bin/skills/skillRepository.js +236 -0
  132. package/dist/bin/skills/types.js +1 -0
  133. package/dist/bin/subagents/taskRunner.js +269 -0
  134. package/dist/bin/tools/backgroundBashTools.js +211 -0
  135. package/dist/bin/tools/bashTools.js +159 -0
  136. package/dist/bin/tools/cloudTools.js +864 -0
  137. package/dist/bin/tools/codeAnalysisTools.js +641 -0
  138. package/dist/bin/tools/codeQualityTools.js +294 -0
  139. package/dist/bin/tools/dependencyTools.js +282 -0
  140. package/dist/bin/tools/devTools.js +238 -0
  141. package/dist/bin/tools/diffUtils.js +137 -0
  142. package/dist/bin/tools/editTools.js +134 -0
  143. package/dist/bin/tools/emailTools.js +448 -0
  144. package/dist/bin/tools/fileTools.js +282 -0
  145. package/dist/bin/tools/globTools.js +173 -0
  146. package/dist/bin/tools/grepTools.js +332 -0
  147. package/dist/bin/tools/interactionTools.js +170 -0
  148. package/dist/bin/tools/learnTools.js +1818 -0
  149. package/dist/bin/tools/notebookEditTools.js +196 -0
  150. package/dist/bin/tools/planningTools.js +46 -0
  151. package/dist/bin/tools/refactoringTools.js +293 -0
  152. package/dist/bin/tools/repoChecksTools.js +160 -0
  153. package/dist/bin/tools/searchTools.js +206 -0
  154. package/dist/bin/tools/skillTools.js +177 -0
  155. package/dist/bin/tools/taskManagementTools.js +156 -0
  156. package/dist/bin/tools/testingTools.js +232 -0
  157. package/dist/bin/tools/webTools.js +480 -0
  158. package/dist/bin/ui/ShellUIAdapter.js +459 -0
  159. package/dist/bin/ui/UnifiedUIController.js +183 -0
  160. package/dist/bin/ui/animation/AnimationScheduler.js +430 -0
  161. package/dist/bin/ui/codeHighlighter.js +854 -0
  162. package/dist/bin/ui/designSystem.js +121 -0
  163. package/dist/bin/ui/display.js +1222 -0
  164. package/dist/bin/ui/interrupts/InterruptManager.js +437 -0
  165. package/dist/bin/ui/layout.js +139 -0
  166. package/dist/bin/ui/orchestration/StatusOrchestrator.js +403 -0
  167. package/dist/bin/ui/outputMode.js +38 -0
  168. package/dist/bin/ui/persistentPrompt.js +183 -0
  169. package/dist/bin/ui/richText.js +338 -0
  170. package/dist/bin/ui/shortcutsHelp.js +87 -0
  171. package/dist/bin/ui/telemetry/UITelemetry.js +443 -0
  172. package/dist/bin/ui/textHighlighter.js +210 -0
  173. package/dist/bin/ui/theme.js +116 -0
  174. package/dist/bin/ui/toolDisplay.js +423 -0
  175. package/dist/bin/ui/toolDisplayAdapter.js +357 -0
  176. package/dist/bin/workspace.js +106 -0
  177. package/dist/bin/workspace.validator.js +213 -0
  178. package/dist/capabilities/cloudCapability.d.ts +13 -0
  179. package/dist/capabilities/cloudCapability.d.ts.map +1 -0
  180. package/dist/capabilities/cloudCapability.js +38 -0
  181. package/dist/capabilities/cloudCapability.js.map +1 -0
  182. package/dist/capabilities/index.d.ts +1 -0
  183. package/dist/capabilities/index.d.ts.map +1 -1
  184. package/dist/capabilities/index.js +1 -0
  185. package/dist/capabilities/index.js.map +1 -1
  186. package/dist/capabilities/offensiveSecurityCapability.d.ts +26 -0
  187. package/dist/capabilities/offensiveSecurityCapability.d.ts.map +1 -0
  188. package/dist/capabilities/offensiveSecurityCapability.js +58 -0
  189. package/dist/capabilities/offensiveSecurityCapability.js.map +1 -0
  190. package/dist/capabilities/realSecurityCapability.d.ts +26 -0
  191. package/dist/capabilities/realSecurityCapability.d.ts.map +1 -0
  192. package/dist/capabilities/realSecurityCapability.js +53 -0
  193. package/dist/capabilities/realSecurityCapability.js.map +1 -0
  194. package/dist/capabilities/securityCapability.d.ts +32 -0
  195. package/dist/capabilities/securityCapability.d.ts.map +1 -0
  196. package/dist/capabilities/securityCapability.js +57 -0
  197. package/dist/capabilities/securityCapability.js.map +1 -0
  198. package/dist/capabilities/ultimateSecurityCapability.d.ts +42 -0
  199. package/dist/capabilities/ultimateSecurityCapability.d.ts.map +1 -0
  200. package/dist/capabilities/ultimateSecurityCapability.js +96 -0
  201. package/dist/capabilities/ultimateSecurityCapability.js.map +1 -0
  202. package/dist/core/LazyLoader.d.ts +129 -0
  203. package/dist/core/LazyLoader.d.ts.map +1 -0
  204. package/dist/core/LazyLoader.js +240 -0
  205. package/dist/core/LazyLoader.js.map +1 -0
  206. package/dist/core/intelligenceTools.d.ts +19 -0
  207. package/dist/core/intelligenceTools.d.ts.map +1 -0
  208. package/dist/core/intelligenceTools.js +453 -0
  209. package/dist/core/intelligenceTools.js.map +1 -0
  210. package/dist/core/operationalTools.d.ts +19 -0
  211. package/dist/core/operationalTools.d.ts.map +1 -0
  212. package/dist/core/operationalTools.js +467 -0
  213. package/dist/core/operationalTools.js.map +1 -0
  214. package/dist/offensive/core/offensive-engine.d.ts +171 -0
  215. package/dist/offensive/core/offensive-engine.d.ts.map +1 -0
  216. package/dist/offensive/core/offensive-engine.js +345 -0
  217. package/dist/offensive/core/offensive-engine.js.map +1 -0
  218. package/dist/offensive/core/offensive-integration.d.ts +129 -0
  219. package/dist/offensive/core/offensive-integration.d.ts.map +1 -0
  220. package/dist/offensive/core/offensive-integration.js +364 -0
  221. package/dist/offensive/core/offensive-integration.js.map +1 -0
  222. package/dist/offensive/core/offensive-tools.d.ts +55 -0
  223. package/dist/offensive/core/offensive-tools.d.ts.map +1 -0
  224. package/dist/offensive/core/offensive-tools.js +438 -0
  225. package/dist/offensive/core/offensive-tools.js.map +1 -0
  226. package/dist/offensive/offensive-cli.d.ts +48 -0
  227. package/dist/offensive/offensive-cli.d.ts.map +1 -0
  228. package/dist/offensive/offensive-cli.js +233 -0
  229. package/dist/offensive/offensive-cli.js.map +1 -0
  230. package/dist/plugins/index.d.ts +1 -1
  231. package/dist/plugins/index.d.ts.map +1 -1
  232. package/dist/plugins/index.js +2 -0
  233. package/dist/plugins/index.js.map +1 -1
  234. package/dist/plugins/tools/cloud/cloudPlugin.d.ts +3 -0
  235. package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +1 -0
  236. package/dist/plugins/tools/cloud/cloudPlugin.js +14 -0
  237. package/dist/plugins/tools/cloud/cloudPlugin.js.map +1 -0
  238. package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
  239. package/dist/plugins/tools/nodeDefaults.js +2 -0
  240. package/dist/plugins/tools/nodeDefaults.js.map +1 -1
  241. package/dist/security/advanced-persistence-research.d.ts +92 -0
  242. package/dist/security/advanced-persistence-research.d.ts.map +1 -0
  243. package/dist/security/advanced-persistence-research.js +195 -0
  244. package/dist/security/advanced-persistence-research.js.map +1 -0
  245. package/dist/security/apt-simulation-cli.d.ts +57 -0
  246. package/dist/security/apt-simulation-cli.d.ts.map +1 -0
  247. package/dist/security/apt-simulation-cli.js +278 -0
  248. package/dist/security/apt-simulation-cli.js.map +1 -0
  249. package/dist/security/apt-simulation-engine-complete.d.ts +97 -0
  250. package/dist/security/apt-simulation-engine-complete.d.ts.map +1 -0
  251. package/dist/security/apt-simulation-engine-complete.js +441 -0
  252. package/dist/security/apt-simulation-engine-complete.js.map +1 -0
  253. package/dist/security/apt-simulation-engine.d.ts +97 -0
  254. package/dist/security/apt-simulation-engine.d.ts.map +1 -0
  255. package/dist/security/apt-simulation-engine.js +441 -0
  256. package/dist/security/apt-simulation-engine.js.map +1 -0
  257. package/dist/security/assessment/vulnerabilityAssessment.d.ts +104 -0
  258. package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +1 -0
  259. package/dist/security/assessment/vulnerabilityAssessment.js +315 -0
  260. package/dist/security/assessment/vulnerabilityAssessment.js.map +1 -0
  261. package/dist/security/authorization/securityAuthorization.d.ts +88 -0
  262. package/dist/security/authorization/securityAuthorization.d.ts.map +1 -0
  263. package/dist/security/authorization/securityAuthorization.js +172 -0
  264. package/dist/security/authorization/securityAuthorization.js.map +1 -0
  265. package/dist/security/authorization.d.ts +45 -0
  266. package/dist/security/authorization.d.ts.map +1 -0
  267. package/dist/security/authorization.js +128 -0
  268. package/dist/security/authorization.js.map +1 -0
  269. package/dist/security/comprehensive-security-research.d.ts +84 -0
  270. package/dist/security/comprehensive-security-research.d.ts.map +1 -0
  271. package/dist/security/comprehensive-security-research.js +211 -0
  272. package/dist/security/comprehensive-security-research.js.map +1 -0
  273. package/dist/security/offensive/exploitationEngine.d.ts +54 -0
  274. package/dist/security/offensive/exploitationEngine.d.ts.map +1 -0
  275. package/dist/security/offensive/exploitationEngine.js +263 -0
  276. package/dist/security/offensive/exploitationEngine.js.map +1 -0
  277. package/dist/security/persistence-analyzer.d.ts +56 -0
  278. package/dist/security/persistence-analyzer.d.ts.map +1 -0
  279. package/dist/security/persistence-analyzer.js +187 -0
  280. package/dist/security/persistence-analyzer.js.map +1 -0
  281. package/dist/security/persistence-cli.d.ts +36 -0
  282. package/dist/security/persistence-cli.d.ts.map +1 -0
  283. package/dist/security/persistence-cli.js +160 -0
  284. package/dist/security/persistence-cli.js.map +1 -0
  285. package/dist/security/persistence-research.d.ts +100 -0
  286. package/dist/security/persistence-research.d.ts.map +1 -0
  287. package/dist/security/persistence-research.js +372 -0
  288. package/dist/security/persistence-research.js.map +1 -0
  289. package/dist/security/real/networkExploitation.d.ts +92 -0
  290. package/dist/security/real/networkExploitation.d.ts.map +1 -0
  291. package/dist/security/real/networkExploitation.js +316 -0
  292. package/dist/security/real/networkExploitation.js.map +1 -0
  293. package/dist/security/real/persistenceImplementation.d.ts +62 -0
  294. package/dist/security/real/persistenceImplementation.d.ts.map +1 -0
  295. package/dist/security/real/persistenceImplementation.js +323 -0
  296. package/dist/security/real/persistenceImplementation.js.map +1 -0
  297. package/dist/security/real/vulnerabilityScanner.d.ts +73 -0
  298. package/dist/security/real/vulnerabilityScanner.d.ts.map +1 -0
  299. package/dist/security/real/vulnerabilityScanner.js +341 -0
  300. package/dist/security/real/vulnerabilityScanner.js.map +1 -0
  301. package/dist/security/research/persistenceResearch.d.ts +97 -0
  302. package/dist/security/research/persistenceResearch.d.ts.map +1 -0
  303. package/dist/security/research/persistenceResearch.js +282 -0
  304. package/dist/security/research/persistenceResearch.js.map +1 -0
  305. package/dist/security/security-testing-framework.d.ts +120 -0
  306. package/dist/security/security-testing-framework.d.ts.map +1 -0
  307. package/dist/security/security-testing-framework.js +372 -0
  308. package/dist/security/security-testing-framework.js.map +1 -0
  309. package/dist/security/simulation/attackSimulation.d.ts +93 -0
  310. package/dist/security/simulation/attackSimulation.d.ts.map +1 -0
  311. package/dist/security/simulation/attackSimulation.js +341 -0
  312. package/dist/security/simulation/attackSimulation.js.map +1 -0
  313. package/dist/shell/bracketedPasteManager.d.ts +76 -0
  314. package/dist/shell/bracketedPasteManager.d.ts.map +1 -1
  315. package/dist/shell/bracketedPasteManager.js +267 -9
  316. package/dist/shell/bracketedPasteManager.js.map +1 -1
  317. package/dist/shell/interactiveShell.d.ts +34 -1
  318. package/dist/shell/interactiveShell.d.ts.map +1 -1
  319. package/dist/shell/interactiveShell.js +304 -24
  320. package/dist/shell/interactiveShell.js.map +1 -1
  321. package/dist/shell/taskCompletionDetector.d.ts +101 -0
  322. package/dist/shell/taskCompletionDetector.d.ts.map +1 -0
  323. package/dist/shell/taskCompletionDetector.js +343 -0
  324. package/dist/shell/taskCompletionDetector.js.map +1 -0
  325. package/dist/tools/cloudTools.d.ts +57 -0
  326. package/dist/tools/cloudTools.d.ts.map +1 -0
  327. package/dist/tools/cloudTools.js +865 -0
  328. package/dist/tools/cloudTools.js.map +1 -0
  329. package/dist/tools/enhancedSecurityTools.d.ts +19 -0
  330. package/dist/tools/enhancedSecurityTools.d.ts.map +1 -0
  331. package/dist/tools/enhancedSecurityTools.js +215 -0
  332. package/dist/tools/enhancedSecurityTools.js.map +1 -0
  333. package/dist/tools/offensiveSecurityTools.d.ts +16 -0
  334. package/dist/tools/offensiveSecurityTools.d.ts.map +1 -0
  335. package/dist/tools/offensiveSecurityTools.js +285 -0
  336. package/dist/tools/offensiveSecurityTools.js.map +1 -0
  337. package/dist/tools/realSecurityTools.d.ts +18 -0
  338. package/dist/tools/realSecurityTools.d.ts.map +1 -0
  339. package/dist/tools/realSecurityTools.js +468 -0
  340. package/dist/tools/realSecurityTools.js.map +1 -0
  341. package/dist/tools/securityTools.d.ts +20 -0
  342. package/dist/tools/securityTools.d.ts.map +1 -0
  343. package/dist/tools/securityTools.js +449 -0
  344. package/dist/tools/securityTools.js.map +1 -0
  345. package/package.json +27 -12
  346. package/scripts/deploy-security-capabilities.js +178 -0
@@ -0,0 +1,341 @@
1
+ /**
2
+ * Attack Simulation Engine
3
+ *
4
+ * Provides attack simulation capabilities for authorized security testing
5
+ * and red team exercises.
6
+ *
7
+ * LEGAL NOTICE:
8
+ * For authorized security research, penetration testing, and red team exercises only.
9
+ */
10
+ /**
11
+ * Attack Simulation Engine
12
+ */
13
+ export class AttackSimulationEngine {
14
+ attackTemplates;
15
+ constructor() {
16
+ this.attackTemplates = new Map();
17
+ this.initializeAttackTemplates();
18
+ }
19
+ /**
20
+ * Simulate attack scenario
21
+ */
22
+ async simulateAttack(request) {
23
+ const template = this.attackTemplates.get(request.attackType);
24
+ if (!template) {
25
+ throw new Error(`Attack type not supported: ${request.attackType}`);
26
+ }
27
+ const steps = this.generateAttackSteps(template, request.stealthLevel);
28
+ const successProbability = this.calculateSuccessProbability(template, request.stealthLevel);
29
+ const detectionProbability = this.calculateDetectionProbability(template, request.stealthLevel);
30
+ const impactAssessment = this.generateImpactAssessment(template);
31
+ const recommendations = this.generateAttackRecommendations(template);
32
+ return {
33
+ attackType: request.attackType,
34
+ target: request.target,
35
+ stealthLevel: request.stealthLevel,
36
+ steps,
37
+ successProbability,
38
+ detectionProbability,
39
+ impactAssessment,
40
+ recommendations
41
+ };
42
+ }
43
+ /**
44
+ * Generate payloads for security testing
45
+ */
46
+ async generatePayloads(request) {
47
+ const payloads = this.generatePayloadsByType(request.payloadType, request.count);
48
+ const usageInstructions = this.generateUsageInstructions(request.payloadType);
49
+ const detectionMethods = this.generateDetectionMethods(request.payloadType);
50
+ return {
51
+ payloadType: request.payloadType,
52
+ target: request.target,
53
+ count: request.count,
54
+ payloads,
55
+ usageInstructions,
56
+ detectionMethods
57
+ };
58
+ }
59
+ /**
60
+ * Get available attack types
61
+ */
62
+ getAvailableAttackTypes() {
63
+ return Array.from(this.attackTemplates.keys());
64
+ }
65
+ /**
66
+ * Generate attack steps based on template and stealth level
67
+ */
68
+ generateAttackSteps(template, stealthLevel) {
69
+ const steps = [...template.baseSteps];
70
+ // Add stealth-specific steps
71
+ if (stealthLevel >= 4) {
72
+ steps.push('Implement traffic obfuscation', 'Use encrypted communication channels');
73
+ }
74
+ if (stealthLevel >= 5) {
75
+ steps.push('Employ anti-forensics techniques', 'Use memory-only execution');
76
+ }
77
+ return steps;
78
+ }
79
+ /**
80
+ * Calculate success probability
81
+ */
82
+ calculateSuccessProbability(template, stealthLevel) {
83
+ let probability = template.baseSuccessProbability;
84
+ // Adjust based on stealth level
85
+ if (stealthLevel >= 4) {
86
+ probability *= 0.8; // Higher stealth often reduces success probability
87
+ }
88
+ else if (stealthLevel <= 2) {
89
+ probability *= 1.2; // Lower stealth may increase success but also detection
90
+ }
91
+ return Math.min(1.0, Math.max(0.1, probability));
92
+ }
93
+ /**
94
+ * Calculate detection probability
95
+ */
96
+ calculateDetectionProbability(template, stealthLevel) {
97
+ let probability = template.baseDetectionProbability;
98
+ // Adjust based on stealth level
99
+ if (stealthLevel >= 4) {
100
+ probability *= 0.3;
101
+ }
102
+ else if (stealthLevel >= 3) {
103
+ probability *= 0.6;
104
+ }
105
+ else if (stealthLevel <= 1) {
106
+ probability *= 1.5;
107
+ }
108
+ return Math.min(1.0, Math.max(0.05, probability));
109
+ }
110
+ /**
111
+ * Generate impact assessment
112
+ */
113
+ generateImpactAssessment(template) {
114
+ return template.impactAssessment;
115
+ }
116
+ /**
117
+ * Generate attack recommendations
118
+ */
119
+ generateAttackRecommendations(template) {
120
+ return [
121
+ ...template.defenseRecommendations,
122
+ 'Implement proper monitoring and alerting',
123
+ 'Conduct regular security assessments',
124
+ 'Keep systems and applications updated'
125
+ ];
126
+ }
127
+ /**
128
+ * Generate payloads by type
129
+ */
130
+ generatePayloadsByType(payloadType, count) {
131
+ const payloadGenerators = {
132
+ 'sql_injection': () => [
133
+ "' OR '1'='1",
134
+ "'; DROP TABLE users; --",
135
+ "' UNION SELECT username, password FROM users --",
136
+ "' AND 1=1 --",
137
+ "'; EXEC xp_cmdshell('dir') --"
138
+ ],
139
+ 'xss': () => [
140
+ "<script>alert('XSS')</script>",
141
+ "<img src=x onerror=alert('XSS')>",
142
+ "javascript:alert('XSS')",
143
+ "<svg onload=alert('XSS')>",
144
+ "<body onload=alert('XSS')>"
145
+ ],
146
+ 'command_injection': () => [
147
+ "; ls -la",
148
+ "| cat /etc/passwd",
149
+ "&& whoami",
150
+ "`id`",
151
+ "$(uname -a)"
152
+ ],
153
+ 'file_upload': () => [
154
+ "shell.php",
155
+ "test.jpg.php",
156
+ ".htaccess",
157
+ "web.config",
158
+ "test.asp;.jpg"
159
+ ],
160
+ 'authentication_bypass': () => [
161
+ "admin' --",
162
+ "' OR '1'='1' --",
163
+ "admin'/*",
164
+ "'='",
165
+ "' OR 1=1 --"
166
+ ]
167
+ };
168
+ const generator = payloadGenerators[payloadType];
169
+ if (!generator) {
170
+ return [`No payload generator for type: ${payloadType}`];
171
+ }
172
+ return generator().slice(0, count);
173
+ }
174
+ /**
175
+ * Generate usage instructions
176
+ */
177
+ generateUsageInstructions(payloadType) {
178
+ const instructions = {
179
+ 'sql_injection': 'Inject payloads into SQL query parameters to test for injection vulnerabilities',
180
+ 'xss': 'Inject payloads into user input fields to test for cross-site scripting vulnerabilities',
181
+ 'command_injection': 'Inject payloads into command execution parameters to test for command injection',
182
+ 'file_upload': 'Attempt to upload files with these names to test for file upload vulnerabilities',
183
+ 'authentication_bypass': 'Use these payloads in login fields to test for authentication bypass'
184
+ };
185
+ return instructions[payloadType] || 'Use payloads in appropriate input fields for testing';
186
+ }
187
+ /**
188
+ * Generate detection methods
189
+ */
190
+ generateDetectionMethods(payloadType) {
191
+ const detectionMethods = {
192
+ 'sql_injection': [
193
+ 'Monitor for unusual SQL query patterns',
194
+ 'Check for SQL keywords in user input',
195
+ 'Implement WAF with SQL injection rules',
196
+ 'Use parameterized queries'
197
+ ],
198
+ 'xss': [
199
+ 'Monitor for script tags in user input',
200
+ 'Check for JavaScript execution in output',
201
+ 'Implement content security policy',
202
+ 'Use proper input sanitization'
203
+ ],
204
+ 'command_injection': [
205
+ 'Monitor for shell command patterns',
206
+ 'Check for command separators in input',
207
+ 'Implement command whitelisting',
208
+ 'Use safe command execution APIs'
209
+ ],
210
+ 'file_upload': [
211
+ 'Validate file types and extensions',
212
+ 'Scan uploaded files for malware',
213
+ 'Restrict upload directories',
214
+ 'Implement file type verification'
215
+ ],
216
+ 'authentication_bypass': [
217
+ 'Monitor for SQL injection in login attempts',
218
+ 'Check for unusual authentication patterns',
219
+ 'Implement rate limiting',
220
+ 'Use strong authentication mechanisms'
221
+ ]
222
+ };
223
+ return detectionMethods[payloadType] || ['Implement general input validation and monitoring'];
224
+ }
225
+ /**
226
+ * Initialize attack templates
227
+ */
228
+ initializeAttackTemplates() {
229
+ const templates = [
230
+ {
231
+ id: 'web_application',
232
+ name: 'Web Application Attack',
233
+ baseSteps: [
234
+ 'Reconnaissance and fingerprinting',
235
+ 'Identify application endpoints',
236
+ 'Test for input validation vulnerabilities',
237
+ 'Attempt injection attacks',
238
+ 'Test authentication mechanisms',
239
+ 'Check for information disclosure'
240
+ ],
241
+ baseSuccessProbability: 0.7,
242
+ baseDetectionProbability: 0.4,
243
+ impactAssessment: 'Potential data exposure, unauthorized access, and application compromise',
244
+ defenseRecommendations: [
245
+ 'Implement proper input validation',
246
+ 'Use secure authentication mechanisms',
247
+ 'Enable security headers',
248
+ 'Conduct regular security testing'
249
+ ]
250
+ },
251
+ {
252
+ id: 'authentication',
253
+ name: 'Authentication Attack',
254
+ baseSteps: [
255
+ 'Identify authentication endpoints',
256
+ 'Test for weak credentials',
257
+ 'Attempt brute force attacks',
258
+ 'Test for session management flaws',
259
+ 'Check for authentication bypass',
260
+ 'Test multi-factor authentication'
261
+ ],
262
+ baseSuccessProbability: 0.6,
263
+ baseDetectionProbability: 0.5,
264
+ impactAssessment: 'Unauthorized system access and potential data breach',
265
+ defenseRecommendations: [
266
+ 'Implement strong password policies',
267
+ 'Enable multi-factor authentication',
268
+ 'Use secure session management',
269
+ 'Implement account lockout mechanisms'
270
+ ]
271
+ },
272
+ {
273
+ id: 'injection',
274
+ name: 'Injection Attack',
275
+ baseSteps: [
276
+ 'Identify injection points',
277
+ 'Test for SQL injection vulnerabilities',
278
+ 'Test for command injection',
279
+ 'Test for LDAP injection',
280
+ 'Test for XML injection',
281
+ 'Validate input sanitization'
282
+ ],
283
+ baseSuccessProbability: 0.8,
284
+ baseDetectionProbability: 0.3,
285
+ impactAssessment: 'Data manipulation, system compromise, and information disclosure',
286
+ defenseRecommendations: [
287
+ 'Use parameterized queries',
288
+ 'Implement input validation',
289
+ 'Use prepared statements',
290
+ 'Enable proper error handling'
291
+ ]
292
+ },
293
+ {
294
+ id: 'persistence',
295
+ name: 'Persistence Attack',
296
+ baseSteps: [
297
+ 'Gain initial access',
298
+ 'Establish persistence mechanisms',
299
+ 'Create backdoor accounts',
300
+ 'Modify system configurations',
301
+ 'Install persistence malware',
302
+ 'Test detection evasion'
303
+ ],
304
+ baseSuccessProbability: 0.5,
305
+ baseDetectionProbability: 0.6,
306
+ impactAssessment: 'Long-term unauthorized access and system control',
307
+ defenseRecommendations: [
308
+ 'Monitor for unauthorized changes',
309
+ 'Implement file integrity monitoring',
310
+ 'Use application whitelisting',
311
+ 'Conduct regular system audits'
312
+ ]
313
+ },
314
+ {
315
+ id: 'privilege_escalation',
316
+ name: 'Privilege Escalation Attack',
317
+ baseSteps: [
318
+ 'Identify privilege levels',
319
+ 'Test for misconfigured permissions',
320
+ 'Exploit vulnerable services',
321
+ 'Use privilege escalation techniques',
322
+ 'Access restricted resources',
323
+ 'Maintain elevated privileges'
324
+ ],
325
+ baseSuccessProbability: 0.4,
326
+ baseDetectionProbability: 0.7,
327
+ impactAssessment: 'Unauthorized privilege access and system control',
328
+ defenseRecommendations: [
329
+ 'Implement least privilege principle',
330
+ 'Regularly review user permissions',
331
+ 'Patch known vulnerabilities',
332
+ 'Monitor for privilege escalation attempts'
333
+ ]
334
+ }
335
+ ];
336
+ for (const template of templates) {
337
+ this.attackTemplates.set(template.id, template);
338
+ }
339
+ }
340
+ }
341
+ //# sourceMappingURL=attackSimulation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attackSimulation.js","sourceRoot":"","sources":["../../../src/security/simulation/attackSimulation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkCH;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACzB,eAAe,CAA8B;IAErD;QACE,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,OAAgC;QACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE9D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,2BAA2B,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5F,MAAM,oBAAoB,GAAG,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QAChG,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACjE,MAAM,eAAe,GAAG,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;QAErE,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,KAAK;YACL,kBAAkB;YA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?: string;
12
+ /** True if we're still accumulating paste content */
13
+ isPending?: boolean;
14
+ /** Number of lines accumulated so far (for display) */
15
+ lineCount?: number;
16
+ /** Preview of the content (first line truncated) */
17
+ preview?: string;
18
+ }
19
+ export interface MultiLinePasteState {
20
+ /** Full content accumulated from multi-line paste */
21
+ content: string;
22
+ /** Number of lines in the paste */
23
+ lineCount: number;
24
+ /** First line preview (truncated for display) */
25
+ firstLinePreview: string;
26
+ /** Last line preview (truncated for display) */
27
+ lastLinePreview: string;
12
28
  }
13
29
  export declare class BracketedPasteManager {
14
30
  private enabled;
15
31
  private inPaste;
16
32
  private pasteBuffer;
33
+ /** Tracks accumulated multi-line input even without bracketed paste support */
34
+ private multiLineBuffer;
35
+ private multiLineMode;
36
+ private lastInputTime;
37
+ /** Time threshold (ms) to consider rapid input as paste */
38
+ private readonly PASTE_THRESHOLD_MS;
39
+ /** Raw data buffer for capturing complete bracketed paste content */
40
+ private rawPasteBuffer;
41
+ /** Callback for when raw paste is complete */
42
+ private onRawPasteComplete;
43
+ /** Whether we're currently capturing raw data */
44
+ private capturingRaw;
45
+ private static readonly START_MARKER;
46
+ private static readonly END_MARKER;
17
47
  constructor(enabled: boolean);
48
+ /**
49
+ * Process raw data from stdin before readline handles it.
50
+ * This intercepts bracketed paste content and captures it in full.
51
+ * Returns true if the data was consumed (should not be passed to readline).
52
+ */
53
+ processRawData(data: string): {
54
+ consumed: boolean;
55
+ passThrough?: string;
56
+ };
57
+ /**
58
+ * Set callback for when a complete paste is captured via raw data processing
59
+ */
60
+ setRawPasteCallback(callback: (content: string) => void): void;
61
+ /**
62
+ * Check if currently capturing raw paste data
63
+ */
64
+ isCapturingRaw(): boolean;
65
+ /**
66
+ * Get current raw buffer size (for display)
67
+ */
68
+ getRawBufferLineCount(): number;
69
+ /**
70
+ * Get preview of raw buffer content
71
+ */
72
+ getRawBufferPreview(): string;
18
73
  /**
19
74
  * Process input text, handling bracketed paste sequences
20
75
  */
21
76
  process(input: string): BracketedPasteResult;
77
+ /**
78
+ * Process input when bracketed paste is not enabled
79
+ * Uses timing heuristics to detect rapid multi-line input (likely paste)
80
+ */
81
+ private processWithoutBracketed;
82
+ /**
83
+ * Generate a preview string for multi-line content
84
+ */
85
+ private getPreview;
86
+ /**
87
+ * Get current multi-line state for display purposes
88
+ */
89
+ getMultiLineState(): MultiLinePasteState | null;
90
+ /**
91
+ * Format a multi-line paste as a collapsed block for display
92
+ */
93
+ static formatCollapsedBlock(content: string, maxPreviewLength?: number): string;
22
94
  /**
23
95
  * Check if currently processing a paste
24
96
  */
@@ -27,6 +99,10 @@ export declare class BracketedPasteManager {
27
99
  * Get the current paste buffer
28
100
  */
29
101
  getPasteBuffer(): string[];
102
+ /**
103
+ * Finalize any pending multi-line input
104
+ */
105
+ finalize(): string | null;
30
106
  /**
31
107
  * Reset the paste state
32
108
  */
@@ -1 +1 @@
1
- {"version":3,"file":"bracketedPasteManager.d.ts","sourceRoot":"","sources":["../../src/shell/bracketedPasteManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAgB;gBAEvB,OAAO,EAAE,OAAO;IAI5B;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB;IAoE5C;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}
1
+ {"version":3,"file":"bracketedPasteManager.d.ts","sourceRoot":"","sources":["../../src/shell/bracketedPasteManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,C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