s3db.js 13.6.1 → 14.0.2

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 (189) hide show
  1. package/README.md +56 -15
  2. package/dist/s3db.cjs +72446 -39022
  3. package/dist/s3db.cjs.map +1 -1
  4. package/dist/s3db.es.js +72172 -38790
  5. package/dist/s3db.es.js.map +1 -1
  6. package/mcp/lib/base-handler.js +157 -0
  7. package/mcp/lib/handlers/connection-handler.js +280 -0
  8. package/mcp/lib/handlers/query-handler.js +533 -0
  9. package/mcp/lib/handlers/resource-handler.js +428 -0
  10. package/mcp/lib/tool-registry.js +336 -0
  11. package/mcp/lib/tools/connection-tools.js +161 -0
  12. package/mcp/lib/tools/query-tools.js +267 -0
  13. package/mcp/lib/tools/resource-tools.js +404 -0
  14. package/package.json +85 -50
  15. package/src/clients/memory-client.class.js +346 -191
  16. package/src/clients/memory-storage.class.js +300 -84
  17. package/src/clients/s3-client.class.js +7 -6
  18. package/src/concerns/geo-encoding.js +19 -2
  19. package/src/concerns/ip.js +59 -9
  20. package/src/concerns/money.js +8 -1
  21. package/src/concerns/password-hashing.js +49 -8
  22. package/src/concerns/plugin-storage.js +186 -18
  23. package/src/concerns/storage-drivers/filesystem-driver.js +284 -0
  24. package/src/database.class.js +139 -29
  25. package/src/errors.js +332 -42
  26. package/src/plugins/api/auth/oidc-auth.js +66 -17
  27. package/src/plugins/api/auth/strategies/base-strategy.class.js +74 -0
  28. package/src/plugins/api/auth/strategies/factory.class.js +63 -0
  29. package/src/plugins/api/auth/strategies/global-strategy.class.js +44 -0
  30. package/src/plugins/api/auth/strategies/path-based-strategy.class.js +83 -0
  31. package/src/plugins/api/auth/strategies/path-rules-strategy.class.js +118 -0
  32. package/src/plugins/api/concerns/failban-manager.js +106 -57
  33. package/src/plugins/api/concerns/route-context.js +601 -0
  34. package/src/plugins/api/index.js +168 -40
  35. package/src/plugins/api/routes/auth-routes.js +198 -30
  36. package/src/plugins/api/routes/resource-routes.js +19 -4
  37. package/src/plugins/api/server/health-manager.class.js +163 -0
  38. package/src/plugins/api/server/middleware-chain.class.js +310 -0
  39. package/src/plugins/api/server/router.class.js +472 -0
  40. package/src/plugins/api/server.js +280 -1303
  41. package/src/plugins/api/utils/custom-routes.js +17 -5
  42. package/src/plugins/api/utils/guards.js +76 -17
  43. package/src/plugins/api/utils/openapi-generator-cached.class.js +133 -0
  44. package/src/plugins/api/utils/openapi-generator.js +7 -6
  45. package/src/plugins/audit.plugin.js +30 -8
  46. package/src/plugins/backup.plugin.js +110 -14
  47. package/src/plugins/cache/cache.class.js +22 -5
  48. package/src/plugins/cache/filesystem-cache.class.js +116 -19
  49. package/src/plugins/cache/memory-cache.class.js +211 -57
  50. package/src/plugins/cache/multi-tier-cache.class.js +371 -0
  51. package/src/plugins/cache/partition-aware-filesystem-cache.class.js +168 -47
  52. package/src/plugins/cache/redis-cache.class.js +552 -0
  53. package/src/plugins/cache/s3-cache.class.js +17 -8
  54. package/src/plugins/cache.plugin.js +176 -61
  55. package/src/plugins/cloud-inventory/drivers/alibaba-driver.js +8 -1
  56. package/src/plugins/cloud-inventory/drivers/aws-driver.js +60 -29
  57. package/src/plugins/cloud-inventory/drivers/azure-driver.js +8 -1
  58. package/src/plugins/cloud-inventory/drivers/base-driver.js +16 -2
  59. package/src/plugins/cloud-inventory/drivers/cloudflare-driver.js +8 -1
  60. package/src/plugins/cloud-inventory/drivers/digitalocean-driver.js +8 -1
  61. package/src/plugins/cloud-inventory/drivers/hetzner-driver.js +8 -1
  62. package/src/plugins/cloud-inventory/drivers/linode-driver.js +8 -1
  63. package/src/plugins/cloud-inventory/drivers/mongodb-atlas-driver.js +8 -1
  64. package/src/plugins/cloud-inventory/drivers/vultr-driver.js +8 -1
  65. package/src/plugins/cloud-inventory/index.js +29 -8
  66. package/src/plugins/cloud-inventory/registry.js +64 -42
  67. package/src/plugins/cloud-inventory.plugin.js +240 -138
  68. package/src/plugins/concerns/plugin-dependencies.js +54 -0
  69. package/src/plugins/concerns/resource-names.js +100 -0
  70. package/src/plugins/consumers/index.js +10 -2
  71. package/src/plugins/consumers/sqs-consumer.js +12 -2
  72. package/src/plugins/cookie-farm-suite.plugin.js +278 -0
  73. package/src/plugins/cookie-farm.errors.js +73 -0
  74. package/src/plugins/cookie-farm.plugin.js +869 -0
  75. package/src/plugins/costs.plugin.js +7 -1
  76. package/src/plugins/eventual-consistency/analytics.js +94 -19
  77. package/src/plugins/eventual-consistency/config.js +15 -7
  78. package/src/plugins/eventual-consistency/consolidation.js +29 -11
  79. package/src/plugins/eventual-consistency/garbage-collection.js +3 -1
  80. package/src/plugins/eventual-consistency/helpers.js +39 -14
  81. package/src/plugins/eventual-consistency/install.js +21 -2
  82. package/src/plugins/eventual-consistency/utils.js +32 -10
  83. package/src/plugins/fulltext.plugin.js +38 -11
  84. package/src/plugins/geo.plugin.js +61 -9
  85. package/src/plugins/identity/concerns/config.js +61 -0
  86. package/src/plugins/identity/concerns/mfa-manager.js +15 -2
  87. package/src/plugins/identity/concerns/rate-limit.js +124 -0
  88. package/src/plugins/identity/concerns/resource-schemas.js +9 -1
  89. package/src/plugins/identity/concerns/token-generator.js +29 -4
  90. package/src/plugins/identity/drivers/auth-driver.interface.js +76 -0
  91. package/src/plugins/identity/drivers/client-credentials-driver.js +127 -0
  92. package/src/plugins/identity/drivers/index.js +18 -0
  93. package/src/plugins/identity/drivers/password-driver.js +122 -0
  94. package/src/plugins/identity/email-service.js +17 -2
  95. package/src/plugins/identity/index.js +413 -69
  96. package/src/plugins/identity/oauth2-server.js +413 -30
  97. package/src/plugins/identity/oidc-discovery.js +16 -8
  98. package/src/plugins/identity/rsa-keys.js +115 -35
  99. package/src/plugins/identity/server.js +166 -45
  100. package/src/plugins/identity/session-manager.js +53 -7
  101. package/src/plugins/identity/ui/pages/mfa-verification.js +17 -15
  102. package/src/plugins/identity/ui/routes.js +363 -255
  103. package/src/plugins/importer/index.js +153 -20
  104. package/src/plugins/index.js +9 -2
  105. package/src/plugins/kubernetes-inventory/index.js +6 -0
  106. package/src/plugins/kubernetes-inventory/k8s-driver.js +867 -0
  107. package/src/plugins/kubernetes-inventory/resource-types.js +274 -0
  108. package/src/plugins/kubernetes-inventory.plugin.js +980 -0
  109. package/src/plugins/metrics.plugin.js +64 -16
  110. package/src/plugins/ml/base-model.class.js +25 -15
  111. package/src/plugins/ml/regression-model.class.js +1 -1
  112. package/src/plugins/ml.errors.js +57 -25
  113. package/src/plugins/ml.plugin.js +28 -4
  114. package/src/plugins/namespace.js +210 -0
  115. package/src/plugins/plugin.class.js +180 -8
  116. package/src/plugins/puppeteer/console-monitor.js +729 -0
  117. package/src/plugins/puppeteer/cookie-manager.js +492 -0
  118. package/src/plugins/puppeteer/network-monitor.js +816 -0
  119. package/src/plugins/puppeteer/performance-manager.js +746 -0
  120. package/src/plugins/puppeteer/proxy-manager.js +478 -0
  121. package/src/plugins/puppeteer/stealth-manager.js +556 -0
  122. package/src/plugins/puppeteer.errors.js +81 -0
  123. package/src/plugins/puppeteer.plugin.js +1327 -0
  124. package/src/plugins/queue-consumer.plugin.js +69 -14
  125. package/src/plugins/recon/behaviors/uptime-behavior.js +691 -0
  126. package/src/plugins/recon/concerns/command-runner.js +148 -0
  127. package/src/plugins/recon/concerns/diff-detector.js +372 -0
  128. package/src/plugins/recon/concerns/fingerprint-builder.js +307 -0
  129. package/src/plugins/recon/concerns/process-manager.js +338 -0
  130. package/src/plugins/recon/concerns/report-generator.js +478 -0
  131. package/src/plugins/recon/concerns/security-analyzer.js +571 -0
  132. package/src/plugins/recon/concerns/target-normalizer.js +68 -0
  133. package/src/plugins/recon/config/defaults.js +321 -0
  134. package/src/plugins/recon/config/resources.js +370 -0
  135. package/src/plugins/recon/index.js +778 -0
  136. package/src/plugins/recon/managers/dependency-manager.js +174 -0
  137. package/src/plugins/recon/managers/scheduler-manager.js +179 -0
  138. package/src/plugins/recon/managers/storage-manager.js +745 -0
  139. package/src/plugins/recon/managers/target-manager.js +274 -0
  140. package/src/plugins/recon/stages/asn-stage.js +314 -0
  141. package/src/plugins/recon/stages/certificate-stage.js +84 -0
  142. package/src/plugins/recon/stages/dns-stage.js +107 -0
  143. package/src/plugins/recon/stages/dnsdumpster-stage.js +362 -0
  144. package/src/plugins/recon/stages/fingerprint-stage.js +71 -0
  145. package/src/plugins/recon/stages/google-dorks-stage.js +440 -0
  146. package/src/plugins/recon/stages/http-stage.js +89 -0
  147. package/src/plugins/recon/stages/latency-stage.js +148 -0
  148. package/src/plugins/recon/stages/massdns-stage.js +302 -0
  149. package/src/plugins/recon/stages/osint-stage.js +1373 -0
  150. package/src/plugins/recon/stages/ports-stage.js +169 -0
  151. package/src/plugins/recon/stages/screenshot-stage.js +94 -0
  152. package/src/plugins/recon/stages/secrets-stage.js +514 -0
  153. package/src/plugins/recon/stages/subdomains-stage.js +295 -0
  154. package/src/plugins/recon/stages/tls-audit-stage.js +78 -0
  155. package/src/plugins/recon/stages/vulnerability-stage.js +78 -0
  156. package/src/plugins/recon/stages/web-discovery-stage.js +113 -0
  157. package/src/plugins/recon/stages/whois-stage.js +349 -0
  158. package/src/plugins/recon.plugin.js +75 -0
  159. package/src/plugins/recon.plugin.js.backup +2635 -0
  160. package/src/plugins/relation.errors.js +87 -14
  161. package/src/plugins/replicator.plugin.js +514 -137
  162. package/src/plugins/replicators/base-replicator.class.js +89 -1
  163. package/src/plugins/replicators/bigquery-replicator.class.js +66 -22
  164. package/src/plugins/replicators/dynamodb-replicator.class.js +22 -15
  165. package/src/plugins/replicators/mongodb-replicator.class.js +22 -15
  166. package/src/plugins/replicators/mysql-replicator.class.js +52 -17
  167. package/src/plugins/replicators/planetscale-replicator.class.js +30 -4
  168. package/src/plugins/replicators/postgres-replicator.class.js +62 -27
  169. package/src/plugins/replicators/s3db-replicator.class.js +25 -18
  170. package/src/plugins/replicators/schema-sync.helper.js +3 -3
  171. package/src/plugins/replicators/sqs-replicator.class.js +8 -2
  172. package/src/plugins/replicators/turso-replicator.class.js +23 -3
  173. package/src/plugins/replicators/webhook-replicator.class.js +42 -4
  174. package/src/plugins/s3-queue.plugin.js +464 -65
  175. package/src/plugins/scheduler.plugin.js +20 -6
  176. package/src/plugins/state-machine.plugin.js +40 -9
  177. package/src/plugins/tfstate/base-driver.js +28 -4
  178. package/src/plugins/tfstate/errors.js +65 -10
  179. package/src/plugins/tfstate/filesystem-driver.js +52 -8
  180. package/src/plugins/tfstate/index.js +163 -90
  181. package/src/plugins/tfstate/s3-driver.js +64 -6
  182. package/src/plugins/ttl.plugin.js +72 -17
  183. package/src/plugins/vector/distances.js +18 -12
  184. package/src/plugins/vector/kmeans.js +26 -4
  185. package/src/resource.class.js +115 -19
  186. package/src/testing/factory.class.js +20 -3
  187. package/src/testing/seeder.class.js +7 -1
  188. package/src/clients/memory-client.md +0 -917
  189. package/src/plugins/cloud-inventory/drivers/mock-drivers.js +0 -449
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Default configuration for ReconPlugin
3
+ */
4
+
5
+ export const DEFAULT_FEATURES = {
6
+ dns: true,
7
+ certificate: true,
8
+ whois: true,
9
+ http: {
10
+ curl: true
11
+ },
12
+ latency: {
13
+ ping: true,
14
+ traceroute: true
15
+ },
16
+ subdomains: {
17
+ amass: true,
18
+ subfinder: true,
19
+ assetfinder: false,
20
+ crtsh: true,
21
+ checkTakeover: false,
22
+ maxSubdomains: 50
23
+ },
24
+ ports: {
25
+ nmap: true,
26
+ masscan: false
27
+ },
28
+ web: {
29
+ ffuf: false,
30
+ feroxbuster: false,
31
+ gobuster: false,
32
+ wordlist: null,
33
+ threads: 50
34
+ },
35
+ vulnerability: {
36
+ nikto: false,
37
+ wpscan: false,
38
+ droopescan: false
39
+ },
40
+ tlsAudit: {
41
+ sslyze: false,
42
+ testssl: false,
43
+ sslscan: false,
44
+ openssl: true
45
+ },
46
+ fingerprint: {
47
+ whatweb: false
48
+ },
49
+ screenshots: {
50
+ aquatone: false,
51
+ eyewitness: false
52
+ },
53
+ osint: {
54
+ // Username Enumeration
55
+ usernames: false,
56
+ sherlock: false,
57
+ maigret: false,
58
+ whatsmyname: false, // 100% free - API-based, 400+ sites
59
+ maxSites: 50, // Limit sites to check (WhatsMyName)
60
+
61
+ // Email Collection (100% free - theHarvester only)
62
+ emails: false,
63
+ theHarvester: false,
64
+ harvesterSources: ['bing', 'duckduckgo'], // Free search engines only
65
+
66
+ // Leak Detection (100% free - HIBP v2 + Scylla.sh)
67
+ leaks: false,
68
+ hibp: true, // HaveIBeenPwned v2
69
+ scylla: true, // Scylla.sh free API
70
+ maxEmailsToCheck: 5, // Reduced due to strict rate limits on free API
71
+
72
+ // GitHub Reconnaissance (100% free - optional token for higher limits)
73
+ github: false,
74
+ githubToken: null, // Optional: increases rate limit from 60 to 5000 req/hour
75
+ githubRepos: false,
76
+ githubCode: false,
77
+ githubUsers: false,
78
+ maxRepos: 10,
79
+ maxCodeResults: 10,
80
+ maxUsers: 10,
81
+
82
+ // SaaS Footprint Detection (100% free - DNS + HTTP)
83
+ saas: false,
84
+
85
+ // Social Media Mapping (100% free - manual URLs)
86
+ socialMedia: false,
87
+ linkedin: false,
88
+ twitter: false,
89
+ facebook: false
90
+ },
91
+ googleDorks: {
92
+ enabled: false,
93
+ maxResults: 10, // Results per query
94
+ categories: ['github', 'pastebin', 'linkedin', 'documents', 'subdomains', 'loginPages', 'configs', 'errors']
95
+ },
96
+ secrets: {
97
+ gitleaks: true,
98
+ patterns: true,
99
+ maxUrls: 20
100
+ },
101
+ asn: {
102
+ iptoasn: true,
103
+ hackertarget: true
104
+ },
105
+ dnsdumpster: {
106
+ enabled: true,
107
+ fallbackToDig: true
108
+ },
109
+ massdns: {
110
+ enabled: false,
111
+ wordlist: null,
112
+ resolvers: '/etc/resolv.conf',
113
+ rate: 1000,
114
+ maxSubdomains: 1000
115
+ }
116
+ };
117
+
118
+ export const BEHAVIOR_PRESETS = {
119
+ passive: {
120
+ features: {
121
+ dns: true,
122
+ certificate: false,
123
+ whois: true,
124
+ http: { curl: false },
125
+ latency: { ping: false, traceroute: false },
126
+ subdomains: { amass: false, subfinder: false, assetfinder: false, crtsh: true, checkTakeover: false, maxSubdomains: 20 },
127
+ ports: { nmap: false, masscan: false },
128
+ web: { ffuf: false, feroxbuster: false, gobuster: false },
129
+ vulnerability: { nikto: false, wpscan: false, droopescan: false },
130
+ tlsAudit: { openssl: false, sslyze: false, testssl: false, sslscan: false },
131
+ fingerprint: { whatweb: false },
132
+ screenshots: { aquatone: false, eyewitness: false },
133
+ osint: {
134
+ // Only passive OSINT for passive preset (100% free)
135
+ emails: true,
136
+ theHarvester: true,
137
+ harvesterSources: ['bing', 'duckduckgo'],
138
+ saas: true, // DNS-based SaaS detection
139
+ leaks: false, // Skip leaks to avoid rate limits
140
+ github: false,
141
+ usernames: false,
142
+ whatsmyname: false, // Too many requests for passive
143
+ socialMedia: false
144
+ },
145
+ googleDorks: { enabled: false }, // Too aggressive for passive
146
+ secrets: { gitleaks: false, patterns: true, maxUrls: 10 },
147
+ asn: { iptoasn: true, hackertarget: false }, // Only unlimited API for passive
148
+ dnsdumpster: { enabled: true, fallbackToDig: true },
149
+ massdns: { enabled: false } // Too aggressive for passive
150
+ },
151
+ concurrency: 2,
152
+ ping: { count: 3, timeout: 5000 },
153
+ curl: { timeout: 10000 },
154
+ nmap: { topPorts: 0 },
155
+ rateLimit: { enabled: false, delayBetweenStages: 0 }
156
+ },
157
+ stealth: {
158
+ features: {
159
+ dns: true,
160
+ certificate: true,
161
+ whois: true,
162
+ http: { curl: true },
163
+ latency: { ping: true, traceroute: false },
164
+ subdomains: { amass: false, subfinder: true, assetfinder: false, crtsh: true, checkTakeover: true, maxSubdomains: 30 },
165
+ ports: { nmap: true, masscan: false },
166
+ web: { ffuf: false, feroxbuster: false, gobuster: false },
167
+ vulnerability: { nikto: false, wpscan: false, droopescan: false },
168
+ tlsAudit: { openssl: true, sslyze: false, testssl: false, sslscan: false },
169
+ fingerprint: { whatweb: false },
170
+ screenshots: { aquatone: false, eyewitness: false },
171
+ osint: {
172
+ // Balanced OSINT for stealth preset (100% free)
173
+ emails: true,
174
+ theHarvester: true,
175
+ harvesterSources: ['bing', 'duckduckgo'],
176
+ saas: true,
177
+ leaks: true,
178
+ hibp: true,
179
+ scylla: false, // Skip Scylla for stealth (HIBP is enough)
180
+ maxEmailsToCheck: 3, // Conservative due to rate limits
181
+ github: true,
182
+ githubRepos: true,
183
+ githubCode: false,
184
+ maxRepos: 5,
185
+ usernames: false,
186
+ whatsmyname: false, // Too many requests for stealth
187
+ socialMedia: false
188
+ },
189
+ googleDorks: { enabled: false }, // Too noisy for stealth
190
+ secrets: { gitleaks: true, patterns: true, maxUrls: 15 },
191
+ asn: { iptoasn: true, hackertarget: true }, // Both APIs for stealth
192
+ dnsdumpster: { enabled: true, fallbackToDig: true },
193
+ massdns: { enabled: false } // Too aggressive for stealth
194
+ },
195
+ concurrency: 1,
196
+ ping: { count: 3, timeout: 10000 },
197
+ traceroute: { cycles: 3, timeout: 15000 },
198
+ curl: {
199
+ timeout: 15000,
200
+ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
201
+ },
202
+ nmap: { topPorts: 10, extraArgs: ['-T2', '--max-retries', '1'] },
203
+ rateLimit: { enabled: true, requestsPerMinute: 10, delayBetweenStages: 5000 }
204
+ },
205
+ aggressive: {
206
+ features: {
207
+ dns: true,
208
+ certificate: true,
209
+ whois: true,
210
+ http: { curl: true },
211
+ latency: { ping: true, traceroute: true },
212
+ subdomains: { amass: true, subfinder: true, assetfinder: true, crtsh: true, checkTakeover: true, maxSubdomains: 100 },
213
+ ports: { nmap: true, masscan: true },
214
+ web: { ffuf: true, feroxbuster: true, gobuster: true, threads: 100 },
215
+ vulnerability: { nikto: true, wpscan: true, droopescan: true },
216
+ tlsAudit: { openssl: true, sslyze: true, testssl: true, sslscan: true },
217
+ fingerprint: { whatweb: true },
218
+ screenshots: { aquatone: true, eyewitness: false },
219
+ osint: {
220
+ // Full OSINT for aggressive preset (100% free)
221
+ emails: true,
222
+ theHarvester: true,
223
+ harvesterSources: ['bing', 'duckduckgo', 'yahoo'],
224
+ saas: true,
225
+ leaks: true,
226
+ hibp: true,
227
+ scylla: true, // Both leak sources
228
+ maxEmailsToCheck: 10, // Moderate to avoid rate limits
229
+ github: true,
230
+ githubRepos: true,
231
+ githubCode: true,
232
+ githubUsers: true,
233
+ maxRepos: 20,
234
+ maxCodeResults: 20,
235
+ maxUsers: 20,
236
+ usernames: true,
237
+ sherlock: true,
238
+ maigret: false, // Too slow for aggressive
239
+ whatsmyname: true, // API-based, faster than Sherlock
240
+ maxSites: 100, // More sites for aggressive
241
+ socialMedia: true,
242
+ linkedin: true,
243
+ twitter: true,
244
+ facebook: true
245
+ },
246
+ googleDorks: {
247
+ enabled: true,
248
+ maxResults: 20,
249
+ categories: ['github', 'pastebin', 'linkedin', 'documents', 'subdomains', 'loginPages', 'configs', 'errors']
250
+ },
251
+ secrets: { gitleaks: true, patterns: true, maxUrls: 30 },
252
+ asn: { iptoasn: true, hackertarget: true }, // Both APIs for aggressive
253
+ dnsdumpster: { enabled: true, fallbackToDig: true },
254
+ massdns: { enabled: true, rate: 5000, maxSubdomains: 5000 }
255
+ },
256
+ concurrency: 8,
257
+ ping: { count: 4, timeout: 5000 },
258
+ traceroute: { cycles: 3, timeout: 10000 },
259
+ curl: { timeout: 8000 },
260
+ nmap: { topPorts: 100, extraArgs: ['-T4', '-sV', '--version-intensity', '5'] },
261
+ masscan: { ports: '1-65535', rate: 5000 },
262
+ rateLimit: { enabled: false, delayBetweenStages: 0 }
263
+ }
264
+ };
265
+
266
+ /**
267
+ * Default plugin configuration
268
+ */
269
+ export const DEFAULT_CONFIG = {
270
+ features: DEFAULT_FEATURES,
271
+ storage: {
272
+ enabled: true,
273
+ historyLimit: 50
274
+ },
275
+ scheduler: {
276
+ enabled: false,
277
+ defaultCron: '0 2 * * *' // 2 AM daily
278
+ },
279
+ resources: {
280
+ persist: true
281
+ },
282
+ behaviors: {
283
+ uptime: {
284
+ enabled: false,
285
+ checkInterval: 20000, // Check every 20 seconds (3 samples per minute)
286
+ aggregationInterval: 60000, // Aggregate and persist every 60 seconds (1 minute cohorts)
287
+ methods: ['ping', 'http'], // ping, http, dns
288
+ alertOnDowntime: true,
289
+ downtimeThreshold: 3, // 3 failed checks = downtime (60 seconds)
290
+ timeout: 5000, // 5 seconds timeout per check
291
+ retainHistory: 30 * 24 * 60 * 60 * 1000, // 30 days
292
+ persistRawChecks: false // Only persist aggregated minute data (save storage)
293
+ }
294
+ },
295
+ concurrency: 4,
296
+ ping: {
297
+ count: 4,
298
+ timeout: 5000
299
+ },
300
+ traceroute: {
301
+ cycles: 3,
302
+ timeout: 10000
303
+ },
304
+ curl: {
305
+ timeout: 10000,
306
+ userAgent: 'Mozilla/5.0 (compatible; ReconBot/1.0)'
307
+ },
308
+ nmap: {
309
+ topPorts: 20,
310
+ extraArgs: ['-T4']
311
+ },
312
+ masscan: {
313
+ ports: '1-1000',
314
+ rate: 1000
315
+ },
316
+ rateLimit: {
317
+ enabled: false,
318
+ requestsPerMinute: 60,
319
+ delayBetweenStages: 1000
320
+ }
321
+ };
@@ -0,0 +1,370 @@
1
+ /**
2
+ * ReconPlugin Database Resources Configuration
3
+ *
4
+ * Defines 7 database resources for storing reconnaissance data:
5
+ * 1. plg_recon_hosts - Full host profiles with fingerprints
6
+ * 2. plg_recon_reports - Historical scan reports
7
+ * 3. plg_recon_stages - Per-stage execution metadata
8
+ * 4. plg_recon_diffs - Change detection between scans
9
+ * 5. plg_recon_subdomains - Consolidated subdomain lists
10
+ * 6. plg_recon_paths - Discovered web paths/endpoints
11
+ * 7. plg_recon_targets - Dynamic target management
12
+ */
13
+
14
+ export const RESOURCE_CONFIGS = {
15
+ /**
16
+ * Host Profiles Resource
17
+ * Stores complete fingerprint and metadata for each scanned host
18
+ */
19
+ hosts: {
20
+ name: 'plg_recon_hosts',
21
+ attributes: {
22
+ // Host identification
23
+ host: 'string|required',
24
+
25
+ // Infrastructure
26
+ ips: {
27
+ ipv4: 'array|items:ip4|optional',
28
+ ipv6: 'array|items:ip6|optional'
29
+ },
30
+ nameservers: 'array|items:string|optional',
31
+ mailServers: 'array|items:string|optional',
32
+ txtRecords: 'array|items:string|optional',
33
+
34
+ // Certificate info
35
+ certificate: {
36
+ issuer: 'object|optional',
37
+ subject: 'object|optional',
38
+ validFrom: 'string|optional',
39
+ validTo: 'string|optional',
40
+ fingerprint: 'string|optional',
41
+ sans: 'array|items:string|optional'
42
+ },
43
+
44
+ // Attack surface
45
+ openPorts: 'array|items:object|optional',
46
+ subdomains: {
47
+ total: 'number|optional',
48
+ list: 'array|items:string|optional',
49
+ sources: 'array|items:string|optional'
50
+ },
51
+ discoveredPaths: {
52
+ total: 'number|optional',
53
+ list: 'array|items:string|optional'
54
+ },
55
+
56
+ // Technologies
57
+ technologies: {
58
+ server: 'string|optional',
59
+ poweredBy: 'string|optional',
60
+ detected: 'array|items:string|optional',
61
+ cms: 'string|optional',
62
+ frameworks: 'array|items:string|optional'
63
+ },
64
+
65
+ // Security posture
66
+ security: {
67
+ tls: 'object|optional',
68
+ vulnerabilities: 'object|optional',
69
+ headers: 'object|optional'
70
+ },
71
+
72
+ // Metadata
73
+ lastScan: 'string|required',
74
+ scanCount: 'number|default:1',
75
+ firstSeen: 'string|required',
76
+ riskLevel: 'string|enum:low,medium,high,critical|default:low'
77
+ },
78
+ partitions: {
79
+ byHost: {
80
+ fields: {
81
+ host: 'string'
82
+ }
83
+ }
84
+ },
85
+ behavior: 'body-overflow',
86
+ timestamps: true
87
+ },
88
+
89
+ /**
90
+ * Reports Resource
91
+ * Stores complete scan reports with all stage results
92
+ */
93
+ reports: {
94
+ name: 'plg_recon_reports',
95
+ attributes: {
96
+ // Report identification
97
+ reportId: 'string|required',
98
+ target: {
99
+ original: 'string|required',
100
+ host: 'string|required',
101
+ protocol: 'string|optional',
102
+ port: 'number|optional',
103
+ path: 'string|optional'
104
+ },
105
+
106
+ // Scan metadata
107
+ timestamp: 'string|required',
108
+ timestampDay: 'string|required', // "2025-01-01" for efficient partitioning
109
+ duration: 'number|required',
110
+ status: 'string|enum:completed,failed,partial|required',
111
+
112
+ // Stage results (stored in body due to size)
113
+ results: 'object|required',
114
+
115
+ // Consolidated fingerprint
116
+ fingerprint: 'object|required',
117
+
118
+ // Summary statistics (queryable fields in metadata)
119
+ summary: {
120
+ totalIPs: 'number|default:0',
121
+ totalPorts: 'number|default:0',
122
+ totalSubdomains: 'number|default:0',
123
+ totalPaths: 'number|default:0',
124
+ detectedTechnologies: 'number|default:0',
125
+ riskLevel: 'string|optional'
126
+ },
127
+
128
+ // Uptime status at scan time (synergy with uptime behavior)
129
+ uptime: {
130
+ status: 'string|optional', // 'up', 'down', 'unknown'
131
+ uptimePercentage: 'string|optional', // "99.85"
132
+ lastCheck: 'string|optional', // ISO timestamp
133
+ isDown: 'boolean|optional', // Threshold reached
134
+ consecutiveFails: 'number|optional' // Failure count
135
+ }
136
+ },
137
+ partitions: {
138
+ byHost: {
139
+ fields: {
140
+ 'target.host': 'string'
141
+ }
142
+ },
143
+ byDay: {
144
+ fields: {
145
+ timestampDay: 'string' // Partition by day for efficient time-series queries
146
+ }
147
+ }
148
+ },
149
+ behavior: 'body-overflow', // Use overflow instead of body-only for queryable metadata
150
+ timestamps: true
151
+ },
152
+
153
+ /**
154
+ * Stages Resource
155
+ * Stores per-stage execution metadata and performance metrics
156
+ */
157
+ stages: {
158
+ name: 'plg_recon_stages',
159
+ attributes: {
160
+ // Stage identification
161
+ reportId: 'string|required',
162
+ stageName: 'string|required',
163
+ host: 'string|required',
164
+
165
+ // Execution metadata
166
+ timestamp: 'string|required',
167
+ timestampDay: 'string|required', // "2025-01-01" for efficient partitioning
168
+ duration: 'number|required',
169
+ status: 'string|enum:ok,error,skipped,empty,unavailable|required',
170
+
171
+ // Tool usage
172
+ toolsUsed: 'array|items:string|optional',
173
+ toolsSucceeded: 'array|items:string|optional',
174
+ toolsFailed: 'array|items:string|optional',
175
+
176
+ // Results summary
177
+ resultCount: 'number|default:0',
178
+ errorMessage: 'string|optional'
179
+ },
180
+ partitions: {
181
+ byStage: {
182
+ fields: {
183
+ stageName: 'string'
184
+ }
185
+ },
186
+ byDay: {
187
+ fields: {
188
+ timestampDay: 'string' // Partition by day for time-series analysis
189
+ }
190
+ }
191
+ },
192
+ behavior: 'enforce-limits',
193
+ timestamps: true
194
+ },
195
+
196
+ /**
197
+ * Diffs Resource
198
+ * Stores change detection results between scans
199
+ */
200
+ diffs: {
201
+ name: 'plg_recon_diffs',
202
+ attributes: {
203
+ // Diff identification
204
+ host: 'string|required',
205
+ timestamp: 'string|required',
206
+ previousScan: 'string|required',
207
+ currentScan: 'string|required',
208
+
209
+ // Changes by category
210
+ changes: {
211
+ dns: 'object|optional',
212
+ certificate: 'object|optional',
213
+ ports: 'object|optional',
214
+ subdomains: 'object|optional',
215
+ paths: 'object|optional',
216
+ technologies: 'object|optional',
217
+ security: 'object|optional'
218
+ },
219
+
220
+ // Summary
221
+ summary: {
222
+ totalChanges: 'number|required',
223
+ severity: 'string|enum:low,medium,high,critical|required',
224
+ hasInfrastructureChanges: 'boolean|default:false',
225
+ hasAttackSurfaceChanges: 'boolean|default:false',
226
+ hasSecurityChanges: 'boolean|default:false'
227
+ }
228
+ },
229
+ partitions: {
230
+ byHost: {
231
+ fields: {
232
+ host: 'string'
233
+ }
234
+ },
235
+ bySeverity: {
236
+ fields: {
237
+ 'summary.severity': 'string'
238
+ }
239
+ }
240
+ },
241
+ behavior: 'body-overflow',
242
+ timestamps: true
243
+ },
244
+
245
+ /**
246
+ * Subdomains Resource
247
+ * Stores consolidated subdomain lists per host (one record per host)
248
+ */
249
+ subdomains: {
250
+ name: 'plg_recon_subdomains',
251
+ attributes: {
252
+ // Host identification
253
+ host: 'string|required',
254
+
255
+ // Subdomain list (all subdomains for this host)
256
+ subdomains: 'array|items:string|required',
257
+ total: 'number|required',
258
+
259
+ // Discovery metadata
260
+ sources: 'object|optional', // { amass: {...}, subfinder: {...}, ... }
261
+
262
+ // Scan metadata
263
+ lastScanAt: 'string|required'
264
+ },
265
+ partitions: {
266
+ byHost: {
267
+ fields: {
268
+ host: 'string'
269
+ }
270
+ }
271
+ },
272
+ behavior: 'body-overflow', // Subdomain lists can be large
273
+ timestamps: true
274
+ },
275
+
276
+ /**
277
+ * Paths Resource
278
+ * Stores discovered web paths/endpoints per host (one record per host)
279
+ */
280
+ paths: {
281
+ name: 'plg_recon_paths',
282
+ attributes: {
283
+ // Host identification
284
+ host: 'string|required',
285
+
286
+ // Path list (all paths for this host)
287
+ paths: 'array|items:string|required',
288
+ total: 'number|required',
289
+
290
+ // Discovery metadata
291
+ sources: 'object|optional', // { ffuf: {...}, feroxbuster: {...}, ... }
292
+
293
+ // Scan metadata
294
+ lastScanAt: 'string|required'
295
+ },
296
+ partitions: {
297
+ byHost: {
298
+ fields: {
299
+ host: 'string'
300
+ }
301
+ }
302
+ },
303
+ behavior: 'body-overflow', // Path lists can be large
304
+ timestamps: true
305
+ },
306
+
307
+ /**
308
+ * Targets Resource
309
+ * Stores dynamic targets for scheduled scanning
310
+ */
311
+ targets: {
312
+ name: 'plg_recon_targets',
313
+ attributes: {
314
+ // Target identification
315
+ target: 'string|required',
316
+
317
+ // Normalized fields
318
+ host: 'string|required',
319
+ protocol: 'string|optional',
320
+ port: 'number|optional',
321
+ path: 'string|optional',
322
+
323
+ // Scheduling
324
+ schedule: 'string|optional', // Cron expression
325
+ enabled: 'boolean|default:true',
326
+
327
+ // Scan configuration
328
+ scanConfig: 'object|optional',
329
+
330
+ // Metadata
331
+ lastScan: 'string|optional',
332
+ nextScan: 'string|optional',
333
+ scanCount: 'number|default:0',
334
+
335
+ // Tags for organization
336
+ tags: 'array|items:string|optional',
337
+ description: 'string|optional'
338
+ },
339
+ partitions: {
340
+ byHost: {
341
+ fields: {
342
+ host: 'string'
343
+ }
344
+ }
345
+ },
346
+ behavior: 'enforce-limits',
347
+ timestamps: true
348
+ }
349
+ };
350
+
351
+ /**
352
+ * Get resource config by name
353
+ */
354
+ export function getResourceConfig(resourceName) {
355
+ return RESOURCE_CONFIGS[resourceName];
356
+ }
357
+
358
+ /**
359
+ * Get all resource names
360
+ */
361
+ export function getResourceNames() {
362
+ return Object.keys(RESOURCE_CONFIGS);
363
+ }
364
+
365
+ /**
366
+ * Get all resource configs as array
367
+ */
368
+ export function getAllResourceConfigs() {
369
+ return Object.values(RESOURCE_CONFIGS);
370
+ }