erosolar-cli 1.7.55 → 1.7.56

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 (273) hide show
  1. package/package.json +1 -1
  2. package/dist/active-stack-security.d.ts +0 -110
  3. package/dist/active-stack-security.js +0 -313
  4. package/dist/active-stack-security.js.map +0 -1
  5. package/dist/advanced-targeting.d.ts +0 -113
  6. package/dist/advanced-targeting.js +0 -252
  7. package/dist/advanced-targeting.js.map +0 -1
  8. package/dist/bin/adapters/node/index.js +0 -33
  9. package/dist/bin/adapters/types.js +0 -1
  10. package/dist/bin/alpha-zero/agentWrapper.js +0 -165
  11. package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
  12. package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
  13. package/dist/bin/alpha-zero/index.js +0 -98
  14. package/dist/bin/alpha-zero/introspection.js +0 -298
  15. package/dist/bin/alpha-zero/metricsTracker.js +0 -207
  16. package/dist/bin/alpha-zero/security/core.js +0 -269
  17. package/dist/bin/alpha-zero/security/google.js +0 -308
  18. package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
  19. package/dist/bin/alpha-zero/security/index.js +0 -31
  20. package/dist/bin/alpha-zero/security/simulation.js +0 -274
  21. package/dist/bin/alpha-zero/selfModification.js +0 -231
  22. package/dist/bin/alpha-zero/types.js +0 -30
  23. package/dist/bin/bin/erosolar-optimized.js +0 -205
  24. package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
  25. package/dist/bin/capabilities/bashCapability.js +0 -22
  26. package/dist/bin/capabilities/cloudCapability.js +0 -36
  27. package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
  28. package/dist/bin/capabilities/codeQualityCapability.js +0 -23
  29. package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
  30. package/dist/bin/capabilities/devCapability.js +0 -22
  31. package/dist/bin/capabilities/editCapability.js +0 -28
  32. package/dist/bin/capabilities/emailCapability.js +0 -20
  33. package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
  34. package/dist/bin/capabilities/filesystemCapability.js +0 -22
  35. package/dist/bin/capabilities/globCapability.js +0 -28
  36. package/dist/bin/capabilities/interactionCapability.js +0 -20
  37. package/dist/bin/capabilities/learnCapability.js +0 -22
  38. package/dist/bin/capabilities/mcpCapability.js +0 -20
  39. package/dist/bin/capabilities/notebookCapability.js +0 -28
  40. package/dist/bin/capabilities/planningCapability.js +0 -27
  41. package/dist/bin/capabilities/refactoringCapability.js +0 -23
  42. package/dist/bin/capabilities/repoChecksCapability.js +0 -22
  43. package/dist/bin/capabilities/searchCapability.js +0 -22
  44. package/dist/bin/capabilities/skillCapability.js +0 -76
  45. package/dist/bin/capabilities/taskManagementCapability.js +0 -20
  46. package/dist/bin/capabilities/testingCapability.js +0 -23
  47. package/dist/bin/capabilities/toolManifest.js +0 -159
  48. package/dist/bin/capabilities/toolRegistry.js +0 -114
  49. package/dist/bin/capabilities/webCapability.js +0 -20
  50. package/dist/bin/config.js +0 -139
  51. package/dist/bin/contracts/v1/agent.js +0 -7
  52. package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
  53. package/dist/bin/contracts/v1/agentRules.js +0 -9
  54. package/dist/bin/contracts/v1/toolAccess.js +0 -8
  55. package/dist/bin/erosolar-optimized.d.ts +0 -12
  56. package/dist/bin/erosolar-optimized.d.ts.map +0 -1
  57. package/dist/bin/erosolar-optimized.js +0 -239
  58. package/dist/bin/erosolar-optimized.js.map +0 -1
  59. package/dist/bin/headless/headlessApp.js +0 -172
  60. package/dist/bin/mcp/config.js +0 -202
  61. package/dist/bin/mcp/stdioClient.js +0 -172
  62. package/dist/bin/mcp/toolBridge.js +0 -104
  63. package/dist/bin/mcp/types.js +0 -1
  64. package/dist/bin/plugins/index.js +0 -113
  65. package/dist/bin/plugins/providers/anthropic/index.js +0 -25
  66. package/dist/bin/plugins/providers/deepseek/index.js +0 -24
  67. package/dist/bin/plugins/providers/google/index.js +0 -26
  68. package/dist/bin/plugins/providers/index.js +0 -19
  69. package/dist/bin/plugins/providers/ollama/index.js +0 -59
  70. package/dist/bin/plugins/providers/openai/index.js +0 -26
  71. package/dist/bin/plugins/providers/xai/index.js +0 -24
  72. package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
  73. package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
  74. package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
  75. package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
  76. package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
  77. package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
  78. package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
  79. package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
  80. package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
  81. package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
  82. package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
  83. package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
  84. package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
  85. package/dist/bin/plugins/tools/index.js +0 -2
  86. package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
  87. package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
  88. package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
  89. package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
  90. package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
  91. package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
  92. package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
  93. package/dist/bin/plugins/tools/registry.js +0 -57
  94. package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
  95. package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
  96. package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
  97. package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
  98. package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
  99. package/dist/bin/providers/anthropicProvider.js +0 -329
  100. package/dist/bin/providers/googleProvider.js +0 -203
  101. package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
  102. package/dist/bin/providers/openaiResponsesProvider.js +0 -249
  103. package/dist/bin/providers/providerFactory.js +0 -24
  104. package/dist/bin/runtime/agentController.js +0 -321
  105. package/dist/bin/runtime/agentHost.js +0 -153
  106. package/dist/bin/runtime/agentSession.js +0 -195
  107. package/dist/bin/runtime/node.js +0 -10
  108. package/dist/bin/runtime/universal.js +0 -28
  109. package/dist/bin/skills/skillRepository.js +0 -236
  110. package/dist/bin/skills/types.js +0 -1
  111. package/dist/bin/subagents/taskRunner.js +0 -269
  112. package/dist/bin/tools/backgroundBashTools.js +0 -211
  113. package/dist/bin/tools/bashTools.js +0 -159
  114. package/dist/bin/tools/cloudTools.js +0 -864
  115. package/dist/bin/tools/codeAnalysisTools.js +0 -641
  116. package/dist/bin/tools/codeQualityTools.js +0 -294
  117. package/dist/bin/tools/dependencyTools.js +0 -282
  118. package/dist/bin/tools/devTools.js +0 -238
  119. package/dist/bin/tools/diffUtils.js +0 -137
  120. package/dist/bin/tools/editTools.js +0 -134
  121. package/dist/bin/tools/emailTools.js +0 -448
  122. package/dist/bin/tools/fileTools.js +0 -282
  123. package/dist/bin/tools/globTools.js +0 -173
  124. package/dist/bin/tools/grepTools.js +0 -332
  125. package/dist/bin/tools/interactionTools.js +0 -170
  126. package/dist/bin/tools/learnTools.js +0 -1818
  127. package/dist/bin/tools/notebookEditTools.js +0 -196
  128. package/dist/bin/tools/planningTools.js +0 -46
  129. package/dist/bin/tools/refactoringTools.js +0 -293
  130. package/dist/bin/tools/repoChecksTools.js +0 -160
  131. package/dist/bin/tools/searchTools.js +0 -206
  132. package/dist/bin/tools/skillTools.js +0 -177
  133. package/dist/bin/tools/taskManagementTools.js +0 -156
  134. package/dist/bin/tools/testingTools.js +0 -232
  135. package/dist/bin/tools/webTools.js +0 -480
  136. package/dist/bin/workspace.js +0 -106
  137. package/dist/bin/workspace.validator.js +0 -213
  138. package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
  139. package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
  140. package/dist/capabilities/offensiveSecurityCapability.js +0 -58
  141. package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
  142. package/dist/capabilities/realSecurityCapability.d.ts +0 -26
  143. package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
  144. package/dist/capabilities/realSecurityCapability.js +0 -53
  145. package/dist/capabilities/realSecurityCapability.js.map +0 -1
  146. package/dist/capabilities/securityCapability.d.ts +0 -32
  147. package/dist/capabilities/securityCapability.d.ts.map +0 -1
  148. package/dist/capabilities/securityCapability.js +0 -57
  149. package/dist/capabilities/securityCapability.js.map +0 -1
  150. package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
  151. package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
  152. package/dist/capabilities/ultimateSecurityCapability.js +0 -96
  153. package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
  154. package/dist/core/designThoughtCheck.d.ts +0 -196
  155. package/dist/core/designThoughtCheck.d.ts.map +0 -1
  156. package/dist/core/designThoughtCheck.js +0 -287
  157. package/dist/core/designThoughtCheck.js.map +0 -1
  158. package/dist/core/designThoughtCheckEngine.d.ts +0 -58
  159. package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
  160. package/dist/core/designThoughtCheckEngine.js +0 -358
  161. package/dist/core/designThoughtCheckEngine.js.map +0 -1
  162. package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
  163. package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
  164. package/dist/core/designThoughtCheckIntegration.js +0 -207
  165. package/dist/core/designThoughtCheckIntegration.js.map +0 -1
  166. package/dist/core/intelligenceTools.d.ts +0 -19
  167. package/dist/core/intelligenceTools.d.ts.map +0 -1
  168. package/dist/core/intelligenceTools.js +0 -453
  169. package/dist/core/intelligenceTools.js.map +0 -1
  170. package/dist/core/operationalTools.d.ts +0 -19
  171. package/dist/core/operationalTools.d.ts.map +0 -1
  172. package/dist/core/operationalTools.js +0 -467
  173. package/dist/core/operationalTools.js.map +0 -1
  174. package/dist/offensive/core/offensive-engine.d.ts +0 -171
  175. package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
  176. package/dist/offensive/core/offensive-engine.js +0 -345
  177. package/dist/offensive/core/offensive-engine.js.map +0 -1
  178. package/dist/offensive/core/offensive-integration.d.ts +0 -129
  179. package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
  180. package/dist/offensive/core/offensive-integration.js +0 -364
  181. package/dist/offensive/core/offensive-integration.js.map +0 -1
  182. package/dist/offensive/core/offensive-tools.d.ts +0 -55
  183. package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
  184. package/dist/offensive/core/offensive-tools.js +0 -438
  185. package/dist/offensive/core/offensive-tools.js.map +0 -1
  186. package/dist/offensive/offensive-cli.d.ts +0 -48
  187. package/dist/offensive/offensive-cli.d.ts.map +0 -1
  188. package/dist/offensive/offensive-cli.js +0 -233
  189. package/dist/offensive/offensive-cli.js.map +0 -1
  190. package/dist/security/apt-simulation-cli.d.ts +0 -57
  191. package/dist/security/apt-simulation-cli.d.ts.map +0 -1
  192. package/dist/security/apt-simulation-cli.js +0 -278
  193. package/dist/security/apt-simulation-cli.js.map +0 -1
  194. package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
  195. package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
  196. package/dist/security/apt-simulation-engine-complete.js +0 -441
  197. package/dist/security/apt-simulation-engine-complete.js.map +0 -1
  198. package/dist/security/apt-simulation-engine.d.ts +0 -97
  199. package/dist/security/apt-simulation-engine.d.ts.map +0 -1
  200. package/dist/security/apt-simulation-engine.js +0 -441
  201. package/dist/security/apt-simulation-engine.js.map +0 -1
  202. package/dist/security/authorization.d.ts +0 -45
  203. package/dist/security/authorization.d.ts.map +0 -1
  204. package/dist/security/authorization.js +0 -128
  205. package/dist/security/authorization.js.map +0 -1
  206. package/dist/security/comprehensive-security-research.d.ts +0 -84
  207. package/dist/security/comprehensive-security-research.d.ts.map +0 -1
  208. package/dist/security/comprehensive-security-research.js +0 -211
  209. package/dist/security/comprehensive-security-research.js.map +0 -1
  210. package/dist/security/offensive/exploitationEngine.d.ts +0 -54
  211. package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
  212. package/dist/security/offensive/exploitationEngine.js +0 -263
  213. package/dist/security/offensive/exploitationEngine.js.map +0 -1
  214. package/dist/security/real/networkExploitation.d.ts +0 -92
  215. package/dist/security/real/networkExploitation.d.ts.map +0 -1
  216. package/dist/security/real/networkExploitation.js +0 -316
  217. package/dist/security/real/networkExploitation.js.map +0 -1
  218. package/dist/security/real/persistenceImplementation.d.ts +0 -62
  219. package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
  220. package/dist/security/real/persistenceImplementation.js +0 -323
  221. package/dist/security/real/persistenceImplementation.js.map +0 -1
  222. package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
  223. package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
  224. package/dist/security/real/vulnerabilityScanner.js +0 -341
  225. package/dist/security/real/vulnerabilityScanner.js.map +0 -1
  226. package/dist/shell/capturePastePatch.d.ts +0 -9
  227. package/dist/shell/capturePastePatch.d.ts.map +0 -1
  228. package/dist/shell/capturePastePatch.js +0 -98
  229. package/dist/shell/capturePastePatch.js.map +0 -1
  230. package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
  231. package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
  232. package/dist/shell/enhancedInteractiveShell.js +0 -248
  233. package/dist/shell/enhancedInteractiveShell.js.map +0 -1
  234. package/dist/shell/inputProcessor.d.ts +0 -56
  235. package/dist/shell/inputProcessor.d.ts.map +0 -1
  236. package/dist/shell/inputProcessor.js +0 -172
  237. package/dist/shell/inputProcessor.js.map +0 -1
  238. package/dist/shell/interactiveShell-patch.d.ts +0 -27
  239. package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
  240. package/dist/shell/interactiveShell-patch.js +0 -38
  241. package/dist/shell/interactiveShell-patch.js.map +0 -1
  242. package/dist/shell/interactiveShell-robust.d.ts +0 -26
  243. package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
  244. package/dist/shell/interactiveShell-robust.js +0 -34
  245. package/dist/shell/interactiveShell-robust.js.map +0 -1
  246. package/dist/shell/multiLinePasteManager.d.ts +0 -106
  247. package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
  248. package/dist/shell/multiLinePasteManager.js +0 -308
  249. package/dist/shell/multiLinePasteManager.js.map +0 -1
  250. package/dist/shell/processInputBlockPatch.d.ts +0 -8
  251. package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
  252. package/dist/shell/processInputBlockPatch.js +0 -133
  253. package/dist/shell/processInputBlockPatch.js.map +0 -1
  254. package/dist/shell/unifiedInputProcessor.d.ts +0 -23
  255. package/dist/shell/unifiedInputProcessor.d.ts.map +0 -1
  256. package/dist/shell/unifiedInputProcessor.js +0 -92
  257. package/dist/shell/unifiedInputProcessor.js.map +0 -1
  258. package/dist/tools/enhancedSecurityTools.d.ts +0 -19
  259. package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
  260. package/dist/tools/enhancedSecurityTools.js +0 -215
  261. package/dist/tools/enhancedSecurityTools.js.map +0 -1
  262. package/dist/tools/offensiveSecurityTools.d.ts +0 -16
  263. package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
  264. package/dist/tools/offensiveSecurityTools.js +0 -285
  265. package/dist/tools/offensiveSecurityTools.js.map +0 -1
  266. package/dist/tools/realSecurityTools.d.ts +0 -18
  267. package/dist/tools/realSecurityTools.d.ts.map +0 -1
  268. package/dist/tools/realSecurityTools.js +0 -468
  269. package/dist/tools/realSecurityTools.js.map +0 -1
  270. package/dist/tools/securityTools.d.ts +0 -20
  271. package/dist/tools/securityTools.d.ts.map +0 -1
  272. package/dist/tools/securityTools.js +0 -449
  273. package/dist/tools/securityTools.js.map +0 -1
@@ -1,269 +0,0 @@
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
- constructor(config = {}) {
35
- this.authorization = null;
36
- this.findings = [];
37
- this.reconResults = [];
38
- this.config = { ...DEFAULT_CONFIG, ...config };
39
- }
40
- /**
41
- * Set authorization for testing
42
- */
43
- setAuthorization(authorization) {
44
- this.authorization = authorization;
45
- if (this.config.verbose) {
46
- console.log(`[Authorization] Set for ${authorization.targetDomain}`);
47
- }
48
- }
49
- /**
50
- * Check if authorization is valid
51
- */
52
- checkAuthorization(target) {
53
- if (!this.authorization) {
54
- throw new Error('No authorization record set.');
55
- }
56
- // Check expiration
57
- if (this.authorization.expirationDate) {
58
- const exp = new Date(this.authorization.expirationDate);
59
- if (new Date() > exp) {
60
- throw new Error('Authorization has expired.');
61
- }
62
- }
63
- // Check scope
64
- const inScope = this.authorization.targetDomain.includes(target) ||
65
- target.endsWith(this.authorization.targetDomain);
66
- const outOfScope = this.authorization.outOfScope.some(oos => target.includes(oos));
67
- if (!inScope || outOfScope) {
68
- throw new Error(`Target ${target} is not within authorized scope.`);
69
- }
70
- }
71
- /**
72
- * Perform passive reconnaissance
73
- */
74
- async passiveRecon(target) {
75
- this.checkAuthorization(target);
76
- if (this.config.verbose) {
77
- console.log(`[Recon] Starting passive recon on ${target}`);
78
- }
79
- const result = {
80
- target,
81
- timestamp: Date.now(),
82
- dnsRecords: {},
83
- openPorts: [],
84
- sslInfo: {},
85
- httpHeaders: {},
86
- technologies: [],
87
- subdomains: [],
88
- potentialVectors: [],
89
- };
90
- // DNS lookup
91
- try {
92
- result.dnsRecords['A'] = await dns.resolve4(target);
93
- }
94
- catch { /* ignore */ }
95
- try {
96
- result.dnsRecords['MX'] = (await dns.resolveMx(target)).map(r => r.exchange);
97
- }
98
- catch { /* ignore */ }
99
- try {
100
- result.dnsRecords['TXT'] = await dns.resolveTxt(target).then(r => r.flat());
101
- }
102
- catch { /* ignore */ }
103
- // Common subdomain patterns
104
- const prefixes = ['www', 'mail', 'api', 'dev', 'staging', 'admin'];
105
- result.subdomains = prefixes.map(p => `${p}.${target}`);
106
- this.reconResults.push(result);
107
- return result;
108
- }
109
- /**
110
- * Perform active reconnaissance (requires stronger authorization)
111
- */
112
- async activeRecon(target, ports = [80, 443, 8080, 8443]) {
113
- this.checkAuthorization(target);
114
- // Active recon requires stronger authorization
115
- const allowed = [
116
- AuthorizationScope.OWNED_SYSTEMS,
117
- AuthorizationScope.PENTEST_ENGAGEMENT,
118
- AuthorizationScope.RED_TEAM,
119
- AuthorizationScope.CTF_COMPETITION,
120
- ];
121
- if (!allowed.includes(this.authorization.scope)) {
122
- throw new Error('Active recon requires stronger authorization.');
123
- }
124
- const result = await this.passiveRecon(target);
125
- // Port scan
126
- result.openPorts = await this.scanPorts(target, ports);
127
- // Identify vectors
128
- result.potentialVectors = this.identifyVectors(result);
129
- return result;
130
- }
131
- /**
132
- * Scan ports
133
- */
134
- async scanPorts(host, ports) {
135
- const checkPort = (port) => {
136
- return new Promise(resolve => {
137
- const socket = new net.Socket();
138
- socket.setTimeout(2000);
139
- socket.on('connect', () => {
140
- socket.destroy();
141
- resolve(true);
142
- });
143
- socket.on('error', () => {
144
- socket.destroy();
145
- resolve(false);
146
- });
147
- socket.on('timeout', () => {
148
- socket.destroy();
149
- resolve(false);
150
- });
151
- socket.connect(port, host);
152
- });
153
- };
154
- const results = await Promise.all(ports.map(async (port) => {
155
- const isOpen = await checkPort(port);
156
- return isOpen ? port : null;
157
- }));
158
- return results.filter((p) => p !== null);
159
- }
160
- /**
161
- * Identify potential attack vectors
162
- */
163
- identifyVectors(recon) {
164
- const vectors = [];
165
- // Missing security headers (would need HTTP request to determine)
166
- // Placeholder for now
167
- vectors.push('Check for missing security headers');
168
- // Open ports analysis
169
- if (recon.openPorts.includes(21)) {
170
- vectors.push('FTP port open - check for anonymous access');
171
- }
172
- if (recon.openPorts.includes(22)) {
173
- vectors.push('SSH port open - check for weak credentials');
174
- }
175
- return vectors;
176
- }
177
- /**
178
- * Analyze for vulnerabilities
179
- */
180
- analyzeForVulnerabilities(recon) {
181
- this.checkAuthorization(recon.target);
182
- const findings = [];
183
- // Example: missing HSTS (would need actual HTTP response)
184
- findings.push({
185
- title: 'Missing HSTS Header (Verify Required)',
186
- severity: 'medium',
187
- category: 'config',
188
- description: 'Verify HSTS header is present.',
189
- evidence: 'Requires HTTP response analysis',
190
- remediation: 'Add Strict-Transport-Security header',
191
- cweId: 'CWE-319',
192
- });
193
- this.findings.push(...findings);
194
- return findings;
195
- }
196
- /**
197
- * Generate report
198
- */
199
- generateReport(format = 'text') {
200
- if (format === 'json') {
201
- return JSON.stringify({
202
- generated: new Date().toISOString(),
203
- authorization: this.authorization,
204
- findings: this.findings,
205
- reconResults: this.reconResults,
206
- }, null, 2);
207
- }
208
- const lines = [
209
- '='.repeat(60),
210
- 'SECURITY RESEARCH REPORT',
211
- '='.repeat(60),
212
- `Generated: ${new Date().toISOString()}`,
213
- ];
214
- if (this.authorization) {
215
- lines.push(`Target: ${this.authorization.targetDomain}`);
216
- lines.push(`Scope: ${this.authorization.scope}`);
217
- }
218
- if (this.findings.length > 0) {
219
- lines.push('', `Findings: ${this.findings.length}`);
220
- for (const f of this.findings) {
221
- lines.push(` [${f.severity.toUpperCase()}] ${f.title}`);
222
- }
223
- }
224
- return lines.join('\n');
225
- }
226
- }
227
- /**
228
- * Create bug bounty authorization
229
- */
230
- export function createBugBountyAuthorization(targetDomain, programName, scopeLimitations = [], outOfScope = []) {
231
- return {
232
- scope: AuthorizationScope.BUG_BOUNTY,
233
- targetDomain,
234
- authorizedBy: `Bug Bounty: ${programName}`,
235
- authorizationDate: new Date().toISOString(),
236
- scopeLimitations,
237
- outOfScope,
238
- notes: 'Testing authorized under bug bounty program terms',
239
- };
240
- }
241
- /**
242
- * Create pentest authorization
243
- */
244
- export function createPentestAuthorization(targetDomain, clientName, engagementId, expirationDate) {
245
- return {
246
- scope: AuthorizationScope.PENTEST_ENGAGEMENT,
247
- targetDomain,
248
- authorizedBy: `Client: ${clientName} (${engagementId})`,
249
- authorizationDate: new Date().toISOString(),
250
- expirationDate,
251
- scopeLimitations: [],
252
- outOfScope: [],
253
- notes: 'Testing authorized under penetration testing agreement',
254
- };
255
- }
256
- /**
257
- * Create CTF authorization
258
- */
259
- export function createCtfAuthorization(targetDomain, ctfName) {
260
- return {
261
- scope: AuthorizationScope.CTF_COMPETITION,
262
- targetDomain,
263
- authorizedBy: `CTF: ${ctfName}`,
264
- authorizationDate: new Date().toISOString(),
265
- scopeLimitations: [],
266
- outOfScope: [],
267
- notes: 'CTF competition testing',
268
- };
269
- }
@@ -1,308 +0,0 @@
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 { AuthorizationScope } from './core.js';
16
- /**
17
- * Google services for persistence research
18
- */
19
- export var GoogleService;
20
- (function (GoogleService) {
21
- // Google Cloud Platform
22
- GoogleService["GCP_COMPUTE"] = "gcp_compute_engine";
23
- GoogleService["GCP_GKE"] = "gcp_kubernetes_engine";
24
- GoogleService["GCP_CLOUD_FUNCTIONS"] = "gcp_cloud_functions";
25
- GoogleService["GCP_IAM"] = "gcp_iam";
26
- GoogleService["GCP_SERVICE_ACCOUNTS"] = "gcp_service_accounts";
27
- GoogleService["GCP_CLOUD_STORAGE"] = "gcp_cloud_storage";
28
- GoogleService["GCP_SECRETS_MANAGER"] = "gcp_secrets_manager";
29
- // Google Workspace
30
- GoogleService["WORKSPACE_GMAIL"] = "workspace_gmail";
31
- GoogleService["WORKSPACE_DRIVE"] = "workspace_drive";
32
- GoogleService["WORKSPACE_ADMIN"] = "workspace_admin";
33
- GoogleService["WORKSPACE_APPS_SCRIPT"] = "workspace_apps_script";
34
- // Google Identity
35
- GoogleService["GOOGLE_OAUTH"] = "google_oauth";
36
- })(GoogleService || (GoogleService = {}));
37
- /**
38
- * Categories of persistence mechanisms
39
- */
40
- export var PersistenceCategory;
41
- (function (PersistenceCategory) {
42
- PersistenceCategory["SERVICE_ACCOUNT_ABUSE"] = "service_account_abuse";
43
- PersistenceCategory["IAM_POLICY_MODIFICATION"] = "iam_policy_modification";
44
- PersistenceCategory["OAUTH_APP_CONSENT"] = "oauth_app_consent";
45
- PersistenceCategory["API_KEYS"] = "api_keys";
46
- PersistenceCategory["CLOUD_FUNCTION_TRIGGER"] = "cloud_function_trigger";
47
- PersistenceCategory["APPS_SCRIPT_TRIGGER"] = "apps_script_trigger";
48
- PersistenceCategory["DELEGATION_ABUSE"] = "delegation_abuse";
49
- })(PersistenceCategory || (PersistenceCategory = {}));
50
- /**
51
- * GCP Persistence Vectors
52
- */
53
- export const GCP_PERSISTENCE_VECTORS = {
54
- sa_key_creation: {
55
- name: 'Service Account Key Creation',
56
- service: GoogleService.GCP_SERVICE_ACCOUNTS,
57
- category: PersistenceCategory.SERVICE_ACCOUNT_ABUSE,
58
- description: 'Create keys for service accounts to maintain API access',
59
- techniqueId: 'T1098.001',
60
- requiredPermissions: ['iam.serviceAccountKeys.create'],
61
- detectionMethods: ['Cloud Audit Logs', 'Security Command Center'],
62
- mitigations: ['Use Workload Identity', 'Key rotation policies'],
63
- stealthRating: 2,
64
- },
65
- iam_binding: {
66
- name: 'IAM Policy Binding',
67
- service: GoogleService.GCP_IAM,
68
- category: PersistenceCategory.IAM_POLICY_MODIFICATION,
69
- description: 'Add IAM bindings for persistent access',
70
- techniqueId: 'T1098.001',
71
- requiredPermissions: ['resourcemanager.projects.setIamPolicy'],
72
- detectionMethods: ['IAM audit logs', 'Policy monitoring'],
73
- mitigations: ['IAM Recommender', 'Least privilege'],
74
- stealthRating: 1,
75
- },
76
- cloud_function_backdoor: {
77
- name: 'Cloud Function Backdoor',
78
- service: GoogleService.GCP_CLOUD_FUNCTIONS,
79
- category: PersistenceCategory.CLOUD_FUNCTION_TRIGGER,
80
- description: 'Deploy function as persistent callback',
81
- techniqueId: 'T1059',
82
- requiredPermissions: ['cloudfunctions.functions.create'],
83
- detectionMethods: ['Function deployment logs', 'Network monitoring'],
84
- mitigations: ['Function allowlisting', 'Binary authorization'],
85
- stealthRating: 3,
86
- },
87
- };
88
- /**
89
- * Workspace Persistence Vectors
90
- */
91
- export const WORKSPACE_PERSISTENCE_VECTORS = {
92
- oauth_consent: {
93
- name: 'OAuth App Consent Persistence',
94
- service: GoogleService.GOOGLE_OAUTH,
95
- category: PersistenceCategory.OAUTH_APP_CONSENT,
96
- description: 'Persist via OAuth app with broad scope consent',
97
- techniqueId: 'T1550.001',
98
- requiredPermissions: ['OAuth consent grant'],
99
- detectionMethods: ['OAuth audit logs', 'App access reviews'],
100
- mitigations: ['OAuth app restrictions', 'Consent monitoring'],
101
- stealthRating: 4,
102
- },
103
- apps_script_trigger: {
104
- name: 'Apps Script Trigger Persistence',
105
- service: GoogleService.WORKSPACE_APPS_SCRIPT,
106
- category: PersistenceCategory.APPS_SCRIPT_TRIGGER,
107
- description: 'Create time/event triggers in Apps Script',
108
- techniqueId: 'T1053',
109
- requiredPermissions: ['Script Editor access'],
110
- detectionMethods: ['Apps Script audit logs', 'Trigger inventory'],
111
- mitigations: ['Apps Script restrictions', 'Trigger monitoring'],
112
- stealthRating: 4,
113
- },
114
- drive_sharing: {
115
- name: 'Drive Sharing Persistence',
116
- service: GoogleService.WORKSPACE_DRIVE,
117
- category: PersistenceCategory.DELEGATION_ABUSE,
118
- description: 'Maintain access via shared drive permissions',
119
- techniqueId: 'T1213',
120
- requiredPermissions: ['Drive sharing permissions'],
121
- detectionMethods: ['Drive audit logs', 'Sharing reports'],
122
- mitigations: ['External sharing restrictions', 'DLP policies'],
123
- stealthRating: 3,
124
- },
125
- };
126
- /**
127
- * Google Persistence Researcher
128
- */
129
- export class GooglePersistenceResearcher {
130
- constructor(authorization, verbose = false) {
131
- this.testResults = [];
132
- this.authorization = authorization;
133
- this.verbose = verbose;
134
- }
135
- /**
136
- * Check authorization
137
- */
138
- checkAuthorization() {
139
- if (!this.authorization) {
140
- throw new Error('No authorization record.');
141
- }
142
- const allowed = [
143
- AuthorizationScope.OWNED_SYSTEMS,
144
- AuthorizationScope.PENTEST_ENGAGEMENT,
145
- AuthorizationScope.RED_TEAM,
146
- AuthorizationScope.BUG_BOUNTY,
147
- ];
148
- if (!allowed.includes(this.authorization.scope)) {
149
- throw new Error('Google research requires pentest/red team authorization.');
150
- }
151
- }
152
- /**
153
- * Get all Google persistence vectors
154
- */
155
- getAllVectors() {
156
- return { ...GCP_PERSISTENCE_VECTORS, ...WORKSPACE_PERSISTENCE_VECTORS };
157
- }
158
- /**
159
- * Get vectors by service
160
- */
161
- getVectorsByService(service) {
162
- const all = this.getAllVectors();
163
- return Object.values(all).filter(v => v.service === service);
164
- }
165
- /**
166
- * Get vectors by category
167
- */
168
- getVectorsByCategory(category) {
169
- const all = this.getAllVectors();
170
- return Object.values(all).filter(v => v.category === category);
171
- }
172
- /**
173
- * Get stealthy vectors
174
- */
175
- getStealthyVectors(minRating = 3) {
176
- const all = this.getAllVectors();
177
- return Object.values(all).filter(v => v.stealthRating >= minRating);
178
- }
179
- /**
180
- * Analyze a persistence vector
181
- */
182
- analyzeVector(vectorId, targetProject) {
183
- this.checkAuthorization();
184
- const allVectors = this.getAllVectors();
185
- if (!(vectorId in allVectors)) {
186
- throw new Error(`Unknown vector: ${vectorId}`);
187
- }
188
- const vector = allVectors[vectorId];
189
- if (!vector) {
190
- throw new Error(`Unknown vector ID: ${vectorId}`);
191
- }
192
- const result = {
193
- vector,
194
- targetProject,
195
- timestamp: Date.now(),
196
- testable: true,
197
- permissionsVerified: [],
198
- missingPermissions: [],
199
- detectionRisk: vector.stealthRating < 3 ? 'medium' : 'low',
200
- notes: `Analysis for ${vector.name}`,
201
- };
202
- if (this.verbose) {
203
- console.log(`[Google] Analyzing ${vector.name}`);
204
- console.log(` Service: ${vector.service}`);
205
- console.log(` Stealth: ${vector.stealthRating}/5`);
206
- }
207
- this.testResults.push(result);
208
- return result;
209
- }
210
- /**
211
- * Generate attack playbook
212
- */
213
- generateAttackPlaybook(targetProject, vectors) {
214
- this.checkAuthorization();
215
- const useVectors = vectors || Object.values(this.getAllVectors());
216
- // Sort by stealth rating (stealthiest first)
217
- const sorted = [...useVectors].sort((a, b) => b.stealthRating - a.stealthRating);
218
- return {
219
- target: targetProject,
220
- generated: new Date().toISOString(),
221
- authorization: {
222
- scope: this.authorization.scope,
223
- authorizedBy: this.authorization.authorizedBy,
224
- },
225
- vectors: sorted.map(v => ({
226
- name: v.name,
227
- service: v.service,
228
- category: v.category,
229
- stealthRating: v.stealthRating,
230
- requiredPermissions: v.requiredPermissions,
231
- detectionMethods: v.detectionMethods,
232
- })),
233
- recommendedOrder: sorted.map(v => v.name),
234
- detectionCoverage: Array.from(new Set(sorted.flatMap(v => v.detectionMethods))),
235
- };
236
- }
237
- /**
238
- * Generate detection report (blue team)
239
- */
240
- generateDetectionReport() {
241
- this.checkAuthorization();
242
- const allVectors = this.getAllVectors();
243
- const lines = [
244
- '# Google Infrastructure Detection Guide',
245
- '',
246
- `Generated: ${new Date().toISOString()}`,
247
- '',
248
- '## Overview',
249
- '',
250
- `This guide covers ${Object.keys(allVectors).length} persistence vectors.`,
251
- '',
252
- '## Detection Methods',
253
- '',
254
- ];
255
- // Group by detection method
256
- const detectionMap = {};
257
- for (const vector of Object.values(allVectors)) {
258
- for (const method of vector.detectionMethods) {
259
- if (!detectionMap[method]) {
260
- detectionMap[method] = [];
261
- }
262
- detectionMap[method].push(vector.name);
263
- }
264
- }
265
- for (const [method, vectorNames] of Object.entries(detectionMap).sort()) {
266
- lines.push(`### ${method}`);
267
- lines.push('');
268
- lines.push('Detects:');
269
- for (const name of vectorNames) {
270
- lines.push(`- ${name}`);
271
- }
272
- lines.push('');
273
- }
274
- lines.push('## Vectors by Stealth Rating');
275
- lines.push('');
276
- for (let rating = 5; rating >= 1; rating--) {
277
- const vectorsAtRating = Object.values(allVectors).filter(v => v.stealthRating === rating);
278
- if (vectorsAtRating.length > 0) {
279
- lines.push(`### Stealth ${rating}/5`);
280
- for (const v of vectorsAtRating) {
281
- lines.push(`- ${v.name} (${v.service})`);
282
- }
283
- lines.push('');
284
- }
285
- }
286
- return lines.join('\n');
287
- }
288
- }
289
- /**
290
- * Create Google authorization
291
- */
292
- export function createGoogleAuthorization(engagementType, authorizedBy, targetProject = '*', scopeNotes = '') {
293
- const scopeMap = {
294
- bug_bounty: AuthorizationScope.BUG_BOUNTY,
295
- pentest: AuthorizationScope.PENTEST_ENGAGEMENT,
296
- red_team: AuthorizationScope.RED_TEAM,
297
- owned: AuthorizationScope.OWNED_SYSTEMS,
298
- };
299
- return {
300
- scope: scopeMap[engagementType] || AuthorizationScope.PENTEST_ENGAGEMENT,
301
- targetDomain: `*.googleapis.com,${targetProject}.iam.gserviceaccount.com`,
302
- authorizedBy,
303
- authorizationDate: new Date().toISOString(),
304
- scopeLimitations: [],
305
- outOfScope: [],
306
- notes: scopeNotes || `Google ${engagementType} engagement`,
307
- };
308
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Google Security Module Loader
3
- *
4
- * Provides lazy loading for the optional Google security research module.
5
- *
6
- * Principal Investigator: Bo Shang
7
- * Framework: erosolar-cli
8
- */
9
- let googleModule = null;
10
- /**
11
- * Check if Google security research module is available
12
- */
13
- export function isGoogleEnabled() {
14
- if (googleModule !== null) {
15
- return true;
16
- }
17
- try {
18
- // Dynamic import check would go here
19
- // For now, return true since we're creating the module
20
- return true;
21
- }
22
- catch {
23
- return false;
24
- }
25
- }
26
- /**
27
- * Get the Google security research module (lazy load)
28
- */
29
- export async function getGoogleModule() {
30
- if (googleModule === null) {
31
- try {
32
- googleModule = await import('./google.js');
33
- }
34
- catch (error) {
35
- throw new Error('Google security research module not available. ' +
36
- 'Ensure google.ts is built and available.');
37
- }
38
- }
39
- return googleModule;
40
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Security Research Module for Alpha Zero 2
3
- *
4
- * OPTIONAL MODULE - Only loaded when security research is enabled.
5
- *
6
- * A modular security research framework with optional provider-specific extensions.
7
- * All capabilities require explicit authorization.
8
- *
9
- * LEGAL NOTICE:
10
- * These tools are intended for:
11
- * - Authorized penetration testing engagements
12
- * - Bug bounty programs with explicit scope
13
- * - CTF competitions and security training
14
- * - Red team exercises with written authorization
15
- * - Security research on systems you own or have permission to test
16
- *
17
- * Structure:
18
- * - core: Base authorization and reconnaissance (always available)
19
- * - simulation: Attack simulation framework (always available)
20
- * - google: Google Cloud/Workspace persistence research (optional)
21
- *
22
- * Principal Investigator: Bo Shang
23
- * Framework: erosolar-cli
24
- */
25
- // Re-export core security components
26
- export { AuthorizationScope, SecurityResearchEngine, createBugBountyAuthorization, createPentestAuthorization, createCtfAuthorization, } from './core.js';
27
- // Re-export simulation components
28
- export { AttackCategory, AttackPhase, AttackSimulator, PayloadGenerator, ATTACK_VECTORS, } from './simulation.js';
29
- // Google module is optional - export checker function
30
- export { isGoogleEnabled, getGoogleModule } from './googleLoader.js';
31
- export const SECURITY_VERSION = '1.0.0';