@poolzin/pool-bot 2026.3.6 → 2026.3.9

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 (68) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/.buildstamp +1 -1
  3. package/dist/agents/error-classifier.js +302 -0
  4. package/dist/agents/pi-tools.js +32 -2
  5. package/dist/agents/skills/security.js +217 -0
  6. package/dist/auto-reply/reply/get-reply.js +6 -0
  7. package/dist/auto-reply/reply/message-preprocess-hooks.js +17 -0
  8. package/dist/build-info.json +3 -3
  9. package/dist/cli/banner.js +20 -1
  10. package/dist/cli/lazy-commands.example.js +113 -0
  11. package/dist/cli/lazy-commands.js +329 -0
  12. package/dist/cli/program/command-registry.js +13 -0
  13. package/dist/cli/program/register.skills.js +4 -0
  14. package/dist/cli/security-cli.js +211 -2
  15. package/dist/cli/tagline.js +7 -0
  16. package/dist/config/config.js +1 -0
  17. package/dist/config/secrets-integration.js +88 -0
  18. package/dist/config/types.cli.js +1 -0
  19. package/dist/config/types.security.js +33 -0
  20. package/dist/config/zod-schema.js +15 -0
  21. package/dist/config/zod-schema.providers-core.js +1 -0
  22. package/dist/config/zod-schema.security.js +113 -0
  23. package/dist/context-engine/index.js +33 -0
  24. package/dist/context-engine/legacy.js +181 -0
  25. package/dist/context-engine/registry.js +86 -0
  26. package/dist/context-engine/summarizing.js +293 -0
  27. package/dist/context-engine/types.js +7 -0
  28. package/dist/discord/monitor/message-handler.preflight.js +11 -2
  29. package/dist/gateway/http-common.js +6 -1
  30. package/dist/hooks/fire-and-forget.js +6 -0
  31. package/dist/hooks/internal-hooks.js +64 -19
  32. package/dist/hooks/message-hook-mappers.js +179 -0
  33. package/dist/infra/abort-pattern.js +106 -0
  34. package/dist/infra/retry.js +94 -0
  35. package/dist/secrets/index.js +28 -0
  36. package/dist/secrets/resolver.js +185 -0
  37. package/dist/secrets/runtime.js +142 -0
  38. package/dist/secrets/types.js +11 -0
  39. package/dist/security/capability-guards.js +89 -0
  40. package/dist/security/capability-manager.js +76 -0
  41. package/dist/security/capability.js +147 -0
  42. package/dist/security/dangerous-tools.js +80 -0
  43. package/dist/security/index.js +7 -0
  44. package/dist/security/middleware.js +105 -0
  45. package/dist/security/types.js +12 -0
  46. package/dist/skills/commands.js +351 -0
  47. package/dist/skills/index.js +167 -0
  48. package/dist/skills/loader.js +282 -0
  49. package/dist/skills/parser.js +461 -0
  50. package/dist/skills/registry.js +397 -0
  51. package/dist/skills/security.js +318 -0
  52. package/dist/skills/types.js +21 -0
  53. package/dist/slack/monitor/context.js +1 -0
  54. package/dist/slack/monitor/message-handler/dispatch.js +14 -1
  55. package/dist/slack/monitor/provider.js +2 -0
  56. package/dist/test-utils/index.js +219 -0
  57. package/dist/tui/index.js +595 -0
  58. package/docs/INTEGRATION_PLAN.md +475 -0
  59. package/docs/INTEGRATION_SUMMARY.md +215 -0
  60. package/docs/integrations/HEXSTRIKE_PLAN.md +796 -0
  61. package/docs/integrations/INTEGRATION_PLAN.md +424 -0
  62. package/docs/integrations/PAGE_AGENT_PLAN.md +370 -0
  63. package/docs/integrations/XYOPS_PLAN.md +978 -0
  64. package/docs/skills/IMPLEMENTATION_SUMMARY.md +145 -0
  65. package/docs/skills/SKILL.md +524 -0
  66. package/docs/skills.md +405 -0
  67. package/package.json +1 -1
  68. package/skills/example-skill/SKILL.md +195 -0
@@ -0,0 +1,796 @@
1
+ # HexStrike AI Integration - Implementation Plan
2
+
3
+ **Status**: Ready for implementation
4
+ **Priority**: High
5
+ **Estimated Duration**: 3 weeks
6
+ **Dependencies**: Python Gateway Node SDK
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ Integrate HexStrike AI's 150+ security tools as a Gateway Node to enable security scanning, penetration testing, and CTF solving within PoolBot.
13
+
14
+ ## Architecture
15
+
16
+ ```
17
+ ┌─────────────────────────────────────────────────────────────┐
18
+ │ PoolBot Core │
19
+ │ ┌─────────────────────────────────────────────────────┐ │
20
+ │ │ Gateway Server (WebSocket) │ │
21
+ │ └──────────────────────┬──────────────────────────────┘ │
22
+ └─────────────────────────┼───────────────────────────────────┘
23
+
24
+ │ WebSocket (JSON-RPC)
25
+
26
+ ┌─────────────────────────────────────────────────────────────┐
27
+ │ HexStrike Gateway Node (Python) │
28
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
29
+ │ │ Node Client │ │ FastMCP │ │ Security │ │
30
+ │ │ (WebSocket) │──│ Server │──│ Tools │ │
31
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
32
+ │ │ │
33
+ │ │ ┌──────────────┐ ┌──────────────┐ │
34
+ │ │ │ nmap │ │ nuclei │ │
35
+ │ │ │ sqlmap │ │ metasploit │ │
36
+ │ │ │ burpsuite │ │ ... │ │
37
+ │ │ └──────────────┘ └──────────────┘ │
38
+ │ │ │
39
+ │ └───────────────────────────────────────────────────┘
40
+ └─────────────────────────────────────────────────────────────┘
41
+ ```
42
+
43
+ ## Tool Categories
44
+
45
+ | Category | Tools | Use Case |
46
+ |----------|-------|----------|
47
+ | **Reconnaissance** | nmap, subfinder, amass | Network discovery |
48
+ | **Vulnerability Scanning** | nuclei, openvas, nessus | Find vulnerabilities |
49
+ | **Web Testing** | sqlmap, burpsuite, zap | Web app security |
50
+ | **Exploitation** | metasploit, beef, commix | Proof of concept |
51
+ | **CTF** | Custom solvers | Capture The Flag |
52
+ | **Bug Bounty** | Recon + vuln scanners | Automated hunting |
53
+
54
+ ## Implementation Steps
55
+
56
+ ### Week 1: Python Gateway Node SDK
57
+
58
+ #### Day 1-2: Core SDK
59
+ ```python
60
+ # extensions/python-sdk/poolbot_node/__init__.py
61
+ from typing import Any, Callable, Dict, List, Optional
62
+ from websocket import WebSocketApp
63
+ import json
64
+ import asyncio
65
+
66
+ class GatewayNode:
67
+ def __init__(self, config: NodeConfig):
68
+ self.node_id = config.node_id
69
+ self.gateway_url = config.gateway_url
70
+ self.token = config.token
71
+ self.tools: Dict[str, Tool] = {}
72
+ self.ws: Optional[WebSocketApp] = None
73
+
74
+ def register_tool(self, name: str, handler: Callable, schema: Dict):
75
+ self.tools[name] = Tool(name, handler, schema)
76
+
77
+ async def connect(self):
78
+ self.ws = WebSocketApp(
79
+ self.gateway_url,
80
+ header={"Authorization": f"Bearer {self.token}"},
81
+ on_open=self._on_open,
82
+ on_message=self._on_message,
83
+ on_error=self._on_error,
84
+ on_close=self._on_close
85
+ )
86
+ self.ws.run_forever()
87
+
88
+ async def _on_open(self, ws):
89
+ await self._register()
90
+
91
+ async def _register(self):
92
+ registration = {
93
+ "type": "register",
94
+ "payload": {
95
+ "nodeId": self.node_id,
96
+ "capabilities": ["tools.security.*"],
97
+ "tools": [
98
+ {
99
+ "name": name,
100
+ "description": tool.schema.get("description"),
101
+ "parameters": tool.schema
102
+ }
103
+ for name, tool in self.tools.items()
104
+ ]
105
+ }
106
+ }
107
+ self.ws.send(json.dumps(registration))
108
+ ```
109
+
110
+ #### Day 3-4: Tool Wrappers
111
+ ```python
112
+ # extensions/hexstrike-gateway/src/tools/nmap_tool.py
113
+ from poolbot_node import GatewayNode
114
+ import subprocess
115
+ import json
116
+ import xml.etree.ElementTree as ET
117
+
118
+ class NmapTool:
119
+ def __init__(self):
120
+ self.schema = {
121
+ "description": "Network discovery and security auditing",
122
+ "parameters": {
123
+ "type": "object",
124
+ "properties": {
125
+ "target": {
126
+ "type": "string",
127
+ "description": "Target IP or hostname"
128
+ },
129
+ "ports": {
130
+ "type": "string",
131
+ "description": "Port range (e.g., '1-65535' or '80,443')",
132
+ "default": "1-1000"
133
+ },
134
+ "options": {
135
+ "type": "array",
136
+ "items": {"type": "string"},
137
+ "description": "Additional nmap options",
138
+ "default": ["-sV", "-sC"]
139
+ }
140
+ },
141
+ "required": ["target"]
142
+ }
143
+ }
144
+
145
+ async def execute(self, params: Dict[str, Any]) -> Dict[str, Any]:
146
+ target = params["target"]
147
+ ports = params.get("ports", "1-1000")
148
+ options = params.get("options", ["-sV", "-sC"])
149
+
150
+ cmd = ["nmap", "-oX", "-"] + options + ["-p", ports, target]
151
+
152
+ try:
153
+ result = subprocess.run(
154
+ cmd,
155
+ capture_output=True,
156
+ text=True,
157
+ timeout=300
158
+ )
159
+
160
+ if result.returncode != 0:
161
+ return {
162
+ "success": False,
163
+ "error": result.stderr
164
+ }
165
+
166
+ # Parse XML output
167
+ parsed = self._parse_xml(result.stdout)
168
+
169
+ return {
170
+ "success": True,
171
+ "data": parsed,
172
+ "raw": result.stdout
173
+ }
174
+ except subprocess.TimeoutExpired:
175
+ return {
176
+ "success": False,
177
+ "error": "Scan timed out after 5 minutes"
178
+ }
179
+ except Exception as e:
180
+ return {
181
+ "success": False,
182
+ "error": str(e)
183
+ }
184
+
185
+ def _parse_xml(self, xml_output: str) -> Dict:
186
+ root = ET.fromstring(xml_output)
187
+ hosts = []
188
+
189
+ for host in root.findall("host"):
190
+ host_data = {
191
+ "address": host.find("address").get("addr"),
192
+ "ports": []
193
+ }
194
+
195
+ ports = host.find("ports")
196
+ if ports:
197
+ for port in ports.findall("port"):
198
+ port_data = {
199
+ "port": port.get("portid"),
200
+ "protocol": port.get("protocol"),
201
+ "state": port.find("state").get("state"),
202
+ "service": port.find("service").get("name") if port.find("service") else None
203
+ }
204
+ host_data["ports"].append(port_data)
205
+
206
+ hosts.append(host_data)
207
+
208
+ return {"hosts": hosts}
209
+ ```
210
+
211
+ #### Day 5: Security Scanner Tool
212
+ ```python
213
+ # extensions/hexstrike-gateway/src/tools/security_scanner.py
214
+ from typing import List, Dict, Any
215
+ import asyncio
216
+
217
+ class SecurityScanner:
218
+ """Orchestrates multiple security tools"""
219
+
220
+ def __init__(self, tools: Dict[str, Any]):
221
+ self.tools = tools
222
+ self.schema = {
223
+ "description": "Run comprehensive security scan using multiple tools",
224
+ "parameters": {
225
+ "type": "object",
226
+ "properties": {
227
+ "target": {
228
+ "type": "string",
229
+ "description": "Target URL or IP"
230
+ },
231
+ "scan_type": {
232
+ "type": "string",
233
+ "enum": ["quick", "full", "web", "network"],
234
+ "default": "quick"
235
+ },
236
+ "tools": {
237
+ "type": "array",
238
+ "items": {"type": "string"},
239
+ "description": "Specific tools to run (default: auto-select)"
240
+ }
241
+ },
242
+ "required": ["target"]
243
+ }
244
+ }
245
+
246
+ async def execute(self, params: Dict[str, Any]) -> Dict[str, Any]:
247
+ target = params["target"]
248
+ scan_type = params.get("scan_type", "quick")
249
+ selected_tools = params.get("tools")
250
+
251
+ # Auto-select tools based on scan type
252
+ if not selected_tools:
253
+ selected_tools = self._select_tools(scan_type, target)
254
+
255
+ # Run tools in parallel
256
+ results = await asyncio.gather(*[
257
+ self._run_tool(tool_name, target)
258
+ for tool_name in selected_tools
259
+ ])
260
+
261
+ # Aggregate results
262
+ return {
263
+ "success": True,
264
+ "scan_type": scan_type,
265
+ "target": target,
266
+ "results": {
267
+ name: result
268
+ for name, result in zip(selected_tools, results)
269
+ },
270
+ "summary": self._generate_summary(results)
271
+ }
272
+
273
+ def _select_tools(self, scan_type: str, target: str) -> List[str]:
274
+ if scan_type == "quick":
275
+ return ["nmap"]
276
+ elif scan_type == "full":
277
+ return ["nmap", "nuclei", "subfinder"]
278
+ elif scan_type == "web":
279
+ return ["nuclei", "sqlmap", "nikto"]
280
+ elif scan_type == "network":
281
+ return ["nmap", "masscan"]
282
+ return ["nmap"]
283
+
284
+ async def _run_tool(self, tool_name: str, target: str) -> Dict:
285
+ if tool_name not in self.tools:
286
+ return {"error": f"Tool {tool_name} not available"}
287
+
288
+ tool = self.tools[tool_name]
289
+ return await tool.execute({"target": target})
290
+
291
+ def _generate_summary(self, results: List[Dict]) -> Dict:
292
+ total_findings = sum(
293
+ len(r.get("data", {}).get("hosts", []))
294
+ for r in results
295
+ )
296
+ return {
297
+ "total_tools": len(results),
298
+ "successful": sum(1 for r in results if r.get("success")),
299
+ "failed": sum(1 for r in results if not r.get("success")),
300
+ "total_findings": total_findings
301
+ }
302
+ ```
303
+
304
+ ### Week 2: HexStrike Integration
305
+
306
+ #### Day 6-7: Main Node
307
+ ```python
308
+ # extensions/hexstrike-gateway/src/node.py
309
+ from poolbot_node import GatewayNode
310
+ from tools.nmap_tool import NmapTool
311
+ from tools.nuclei_tool import NucleiTool
312
+ from tools.security_scanner import SecurityScanner
313
+ from tools.ctf_solver import CTFSolver
314
+ from tools.bug_bounty import BugBountyHunter
315
+
316
+ class HexStrikeNode(GatewayNode):
317
+ def __init__(self, config: NodeConfig):
318
+ super().__init__(config)
319
+ self._setup_tools()
320
+
321
+ def _setup_tools(self):
322
+ # Individual tools
323
+ nmap = NmapTool()
324
+ self.register_tool("security.nmap", nmap.execute, nmap.schema)
325
+
326
+ nuclei = NucleiTool()
327
+ self.register_tool("security.nuclei", nuclei.execute, nuclei.schema)
328
+
329
+ # Composite tools
330
+ scanner = SecurityScanner({
331
+ "nmap": nmap,
332
+ "nuclei": nuclei
333
+ })
334
+ self.register_tool("security.scan", scanner.execute, scanner.schema)
335
+
336
+ # AI agents
337
+ ctf = CTFSolver()
338
+ self.register_tool("pentest.ctf", ctf.execute, ctf.schema)
339
+
340
+ bounty = BugBountyHunter()
341
+ self.register_tool("pentest.bugbounty", bounty.execute, bounty.schema)
342
+
343
+ async def handle_tool_call(self, call: ToolCall) -> ToolResult:
344
+ tool_name = call.tool
345
+
346
+ # Map PoolBot tool names to HexStrike tools
347
+ tool_map = {
348
+ "security.nmap": self.tools.get("security.nmap"),
349
+ "security.nuclei": self.tools.get("security.nuclei"),
350
+ "security.scan": self.tools.get("security.scan"),
351
+ "pentest.ctf": self.tools.get("pentest.ctf"),
352
+ "pentest.bugbounty": self.tools.get("pentest.bugbounty"),
353
+ }
354
+
355
+ tool = tool_map.get(tool_name)
356
+ if not tool:
357
+ return {"success": False, "error": f"Unknown tool: {tool_name}"}
358
+
359
+ try:
360
+ result = await tool.handler(call.params)
361
+ return {"success": True, "data": result}
362
+ except Exception as e:
363
+ return {"success": False, "error": str(e)}
364
+
365
+ if __name__ == "__main__":
366
+ import asyncio
367
+
368
+ config = NodeConfig(
369
+ node_id="hexstrike-1",
370
+ gateway_url="ws://localhost:8080/gateway",
371
+ token=os.getenv("POOLBOT_GATEWAY_TOKEN")
372
+ )
373
+
374
+ node = HexStrikeNode(config)
375
+ asyncio.run(node.connect())
376
+ ```
377
+
378
+ #### Day 8-9: CTF Solver Agent
379
+ ```python
380
+ # extensions/hexstrike-gateway/src/tools/ctf_solver.py
381
+ import openai
382
+ import re
383
+
384
+ class CTFSolver:
385
+ """AI-powered CTF challenge solver"""
386
+
387
+ def __init__(self):
388
+ self.client = openai.AsyncOpenAI()
389
+ self.schema = {
390
+ "description": "Solve CTF challenges using AI analysis",
391
+ "parameters": {
392
+ "type": "object",
393
+ "properties": {
394
+ "challenge": {
395
+ "type": "string",
396
+ "description": "Challenge description or file content"
397
+ },
398
+ "category": {
399
+ "type": "string",
400
+ "enum": ["crypto", "web", "pwn", "reverse", "forensics", "misc"],
401
+ "description": "Challenge category"
402
+ },
403
+ "hints": {
404
+ "type": "boolean",
405
+ "default": True,
406
+ "description": "Provide hints instead of full solution"
407
+ }
408
+ },
409
+ "required": ["challenge"]
410
+ }
411
+ }
412
+
413
+ async def execute(self, params: Dict[str, Any]) -> Dict[str, Any]:
414
+ challenge = params["challenge"]
415
+ category = params.get("category")
416
+ hints_only = params.get("hints", True)
417
+
418
+ prompt = self._build_prompt(challenge, category, hints_only)
419
+
420
+ response = await self.client.chat.completions.create(
421
+ model="gpt-4",
422
+ messages=[
423
+ {"role": "system", "content": "You are a CTF expert. Analyze challenges and provide solutions."},
424
+ {"role": "user", "content": prompt}
425
+ ]
426
+ )
427
+
428
+ analysis = response.choices[0].message.content
429
+
430
+ return {
431
+ "success": True,
432
+ "analysis": analysis,
433
+ "category": category,
434
+ "hints": hints_only,
435
+ "flag": self._extract_flag(analysis) if not hints_only else None
436
+ }
437
+
438
+ def _build_prompt(self, challenge: str, category: Optional[str], hints: bool) -> str:
439
+ parts = [
440
+ "Analyze this CTF challenge:",
441
+ "",
442
+ challenge,
443
+ ""
444
+ ]
445
+
446
+ if category:
447
+ parts.append(f"Category: {category}")
448
+
449
+ if hints:
450
+ parts.append("\nProvide hints and approach guidance. Do not give the full solution immediately.")
451
+ else:
452
+ parts.append("\nProvide a complete solution with the flag if possible.")
453
+
454
+ return "\n".join(parts)
455
+
456
+ def _extract_flag(self, text: str) -> Optional[str]:
457
+ # Common flag formats
458
+ patterns = [
459
+ r'flag\{[^}]+\}',
460
+ r'FLAG\{[^}]+\}',
461
+ r'ctf\{[^}]+\}',
462
+ r'CTF\{[^}]+\}'
463
+ ]
464
+
465
+ for pattern in patterns:
466
+ match = re.search(pattern, text)
467
+ if match:
468
+ return match.group(0)
469
+
470
+ return None
471
+ ```
472
+
473
+ #### Day 10: Bug Bounty Hunter
474
+ ```python
475
+ # extensions/hexstrike-gateway/src/tools/bug_bounty.py
476
+ class BugBountyHunter:
477
+ """Automated bug bounty hunting workflow"""
478
+
479
+ def __init__(self):
480
+ self.schema = {
481
+ "description": "Automated bug bounty reconnaissance and scanning",
482
+ "parameters": {
483
+ "type": "object",
484
+ "properties": {
485
+ "target": {
486
+ "type": "string",
487
+ "description": "Target domain (e.g., example.com)"
488
+ },
489
+ "scope": {
490
+ "type": "string",
491
+ "description": "Bug bounty scope (in-scope domains/paths)"
492
+ },
493
+ "depth": {
494
+ "type": "string",
495
+ "enum": ["passive", "active", "aggressive"],
496
+ "default": "passive"
497
+ }
498
+ },
499
+ "required": ["target", "scope"]
500
+ }
501
+ }
502
+
503
+ async def execute(self, params: Dict[str, Any]) -> Dict[str, Any]:
504
+ target = params["target"]
505
+ scope = params["scope"]
506
+ depth = params.get("depth", "passive")
507
+
508
+ workflow = []
509
+
510
+ # Phase 1: Subdomain enumeration
511
+ if depth in ["passive", "active", "aggressive"]:
512
+ workflow.append({"phase": "subdomain_enum", "tool": "subfinder"})
513
+
514
+ # Phase 2: Port scanning
515
+ if depth in ["active", "aggressive"]:
516
+ workflow.append({"phase": "port_scan", "tool": "nmap"})
517
+
518
+ # Phase 3: Web scanning
519
+ if depth in ["active", "aggressive"]:
520
+ workflow.append({"phase": "web_scan", "tool": "nuclei"})
521
+
522
+ # Phase 4: Vulnerability scanning
523
+ if depth == "aggressive":
524
+ workflow.append({"phase": "vuln_scan", "tool": "nuclei"})
525
+
526
+ return {
527
+ "success": True,
528
+ "target": target,
529
+ "scope": scope,
530
+ "depth": depth,
531
+ "workflow": workflow,
532
+ "findings": [], # Populated during execution
533
+ "report_url": None # Generated after completion
534
+ }
535
+ ```
536
+
537
+ ### Week 3: PoolBot Integration
538
+
539
+ #### Day 11-12: Security Agent Type
540
+ ```typescript
541
+ // src/agents/types/security.ts
542
+ export const securityAgentConfig: AgentConfig = {
543
+ type: 'security',
544
+ name: 'Security Analyst',
545
+ description: 'Specialized agent for security testing and analysis',
546
+
547
+ systemPrompt: `
548
+ You are a security analyst with access to professional security tools.
549
+ Your capabilities include:
550
+ - Network reconnaissance (nmap)
551
+ - Vulnerability scanning (nuclei)
552
+ - Web application testing (sqlmap, burpsuite)
553
+ - CTF challenge solving
554
+ - Bug bounty hunting
555
+
556
+ Always:
557
+ 1. Get explicit authorization before scanning
558
+ 2. Respect scope and rules of engagement
559
+ 3. Document findings clearly
560
+ 4. Provide actionable remediation advice
561
+
562
+ Never:
563
+ - Scan without permission
564
+ - Exploit vulnerabilities without authorization
565
+ - Expose sensitive data in reports
566
+ `,
567
+
568
+ availableSkills: [
569
+ 'security.nmap',
570
+ 'security.nuclei',
571
+ 'security.scan',
572
+ 'pentest.ctf',
573
+ 'pentest.bugbounty'
574
+ ],
575
+
576
+ defaultOptions: {
577
+ model: 'claude-3-opus',
578
+ temperature: 0.2, // More deterministic for security
579
+ maxTokens: 4000
580
+ }
581
+ };
582
+ ```
583
+
584
+ #### Day 13-14: Report Generation
585
+ ```typescript
586
+ // src/security/report-generator.ts
587
+ export interface SecurityReport {
588
+ id: string;
589
+ target: string;
590
+ scanType: string;
591
+ startTime: Date;
592
+ endTime: Date;
593
+ findings: SecurityFinding[];
594
+ summary: {
595
+ critical: number;
596
+ high: number;
597
+ medium: number;
598
+ low: number;
599
+ info: number;
600
+ };
601
+ recommendations: string[];
602
+ }
603
+
604
+ export class SecurityReportGenerator {
605
+ generate(report: SecurityReport): string {
606
+ return `
607
+ # Security Assessment Report
608
+
609
+ **Target**: ${report.target}
610
+ **Scan Type**: ${report.scanType}
611
+ **Date**: ${report.startTime.toISOString()}
612
+
613
+ ## Executive Summary
614
+
615
+ ${this.generateSummary(report.summary)}
616
+
617
+ ## Findings
618
+
619
+ ${report.findings.map(f => this.formatFinding(f)).join('\n\n')}
620
+
621
+ ## Recommendations
622
+
623
+ ${report.recommendations.map(r => `- ${r}`).join('\n')}
624
+
625
+ ## Methodology
626
+
627
+ This assessment was conducted using automated security tools including:
628
+ - Nmap for network discovery
629
+ - Nuclei for vulnerability scanning
630
+ - Custom security analyzers
631
+
632
+ ---
633
+ *Generated by PoolBot Security Module*
634
+ `;
635
+ }
636
+
637
+ private generateSummary(summary: SecurityReport['summary']): string {
638
+ const total = summary.critical + summary.high + summary.medium + summary.low + summary.info;
639
+
640
+ return `
641
+ | Severity | Count |
642
+ |----------|-------|
643
+ | Critical | ${summary.critical} |
644
+ | High | ${summary.high} |
645
+ | Medium | ${summary.medium} |
646
+ | Low | ${summary.low} |
647
+ | Info | ${summary.info} |
648
+ | **Total** | **${total}** |
649
+ `;
650
+ }
651
+
652
+ private formatFinding(finding: SecurityFinding): string {
653
+ return `
654
+ ### ${finding.title} (${finding.severity})
655
+
656
+ **Description**: ${finding.description}
657
+
658
+ **Evidence**:
659
+ \`\`\`
660
+ ${finding.evidence}
661
+ \`\`\`
662
+
663
+ **Remediation**: ${finding.remediation}
664
+ `;
665
+ }
666
+ }
667
+ ```
668
+
669
+ #### Day 15: Testing & Documentation
670
+ - Unit tests for Python SDK
671
+ - Integration tests with Gateway
672
+ - Security agent tests
673
+ - Documentation
674
+
675
+ ## File Structure
676
+
677
+ ```
678
+ extensions/
679
+ ├── python-sdk/ # Shared Python SDK
680
+ │ ├── poolbot_node/
681
+ │ │ ├── __init__.py
682
+ │ │ ├── node.py
683
+ │ │ ├── types.py
684
+ │ │ └── utils.py
685
+ │ ├── setup.py
686
+ │ └── README.md
687
+ ├── hexstrike-gateway/ # HexStrike integration
688
+ │ ├── src/
689
+ │ │ ├── node.py
690
+ │ │ ├── tools/
691
+ │ │ │ ├── __init__.py
692
+ │ │ │ ├── nmap_tool.py
693
+ │ │ │ ├── nuclei_tool.py
694
+ │ │ │ ├── security_scanner.py
695
+ │ │ │ ├── ctf_solver.py
696
+ │ │ │ └── bug_bounty.py
697
+ │ │ └── utils/
698
+ │ ├── requirements.txt
699
+ │ ├── Dockerfile
700
+ │ └── README.md
701
+ ```
702
+
703
+ ## Usage Examples
704
+
705
+ ### Example 1: Network Scan
706
+ ```typescript
707
+ const agent = await createAgent({ type: 'security' });
708
+
709
+ const result = await agent.execute({
710
+ skill: 'security.nmap',
711
+ params: {
712
+ target: '192.168.1.1',
713
+ ports: '1-1000',
714
+ options: ['-sV', '-sC']
715
+ }
716
+ });
717
+ ```
718
+
719
+ ### Example 2: Comprehensive Security Scan
720
+ ```typescript
721
+ const result = await agent.execute({
722
+ skill: 'security.scan',
723
+ params: {
724
+ target: 'https://example.com',
725
+ scan_type: 'web'
726
+ }
727
+ });
728
+ ```
729
+
730
+ ### Example 3: CTF Challenge
731
+ ```typescript
732
+ const result = await agent.execute({
733
+ skill: 'pentest.ctf',
734
+ params: {
735
+ challenge: `
736
+ We found a file encrypted with AES-256.
737
+ The key is derived from a 4-digit PIN.
738
+ How do we decrypt it?
739
+ `,
740
+ category: 'crypto',
741
+ hints: true
742
+ }
743
+ });
744
+ ```
745
+
746
+ ### Example 4: Bug Bounty
747
+ ```typescript
748
+ const result = await agent.execute({
749
+ skill: 'pentest.bugbounty',
750
+ params: {
751
+ target: 'example.com',
752
+ scope: '*.example.com',
753
+ depth: 'active'
754
+ }
755
+ });
756
+ ```
757
+
758
+ ## Security Considerations
759
+
760
+ 1. **Authorization**: Require explicit scope confirmation
761
+ 2. **Rate Limiting**: Prevent abuse of scanning tools
762
+ 3. **Sandboxing**: Run tools in isolated containers
763
+ 4. **Audit Logging**: Log all security operations
764
+ 5. **Responsible Disclosure**: Guide users on proper disclosure
765
+
766
+ ## Success Criteria
767
+
768
+ - [ ] Python Gateway Node SDK functional
769
+ - [ ] 150+ tools accessible via Gateway
770
+ - [ ] Security agent type implemented
771
+ - [ ] Report generation working
772
+ - [ ] CTF solver functional
773
+ - [ ] Bug bounty workflow working
774
+ - [ ] Tests pass (>80% coverage)
775
+ - [ ] Documentation complete
776
+
777
+ ## Docker Support
778
+
779
+ ```dockerfile
780
+ # extensions/hexstrike-gateway/Dockerfile
781
+ FROM python:3.11-slim
782
+
783
+ RUN apt-get update && apt-get install -y \
784
+ nmap \
785
+ nuclei \
786
+ sqlmap \
787
+ && rm -rf /var/lib/apt/lists/*
788
+
789
+ WORKDIR /app
790
+ COPY requirements.txt .
791
+ RUN pip install -r requirements.txt
792
+
793
+ COPY src/ ./src/
794
+
795
+ CMD ["python", "-m", "src.node"]
796
+ ```