@deepbounty/sdk 1.2.0 → 1.2.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Alert, ModuleSetting, TaskContent, TaskResult, Tool } from "./types";
1
+ import { Alert, ModuleSetting, TaskContent, TaskResult, Tool, ModuleCallback, CallbackHandler, CreateCallbackOptions } from "./types";
2
2
  import { IEventBus } from "./events";
3
3
  export interface Logger {
4
4
  info: (...args: any[]) => void;
@@ -148,6 +148,52 @@ export interface FilesAPI {
148
148
  */
149
149
  getDirectory(directoryPath: string): ScopedDirectory;
150
150
  }
151
+ /**
152
+ * CallbackAPI provides external callback functionality for modules.
153
+ * Used for out-of-band exfiltration detection.
154
+ */
155
+ export interface CallbackAPI {
156
+ /**
157
+ * Create a new callback with auto-generated UUID
158
+ * @param name Human-readable name for the callback
159
+ * @param metadata Arbitrary data to associate with this callback (e.g., target info)
160
+ * @param options Optional configuration (expiration, multiple triggers)
161
+ * @returns Object containing the UUID and full callback URL
162
+ */
163
+ create(name: string, metadata?: Record<string, any>, options?: CreateCallbackOptions): Promise<{
164
+ uuid: string;
165
+ url: string;
166
+ }>;
167
+ /**
168
+ * Register a handler for when callbacks are triggered
169
+ * Only one handler per module - calling again replaces the previous handler
170
+ * @param handler Function called when any callback for this module is triggered
171
+ */
172
+ onTrigger(handler: CallbackHandler): void;
173
+ /**
174
+ * Get a callback by UUID
175
+ * @param uuid The callback UUID
176
+ * @returns The callback data or null if not found
177
+ */
178
+ get(uuid: string): Promise<ModuleCallback | null>;
179
+ /**
180
+ * List all callbacks registered by this module
181
+ * @param includeExpired Include expired callbacks (default: false)
182
+ * @returns Array of callbacks
183
+ */
184
+ list(includeExpired?: boolean): Promise<ModuleCallback[]>;
185
+ /**
186
+ * Delete a callback by UUID
187
+ * @param uuid The callback UUID
188
+ * @returns true if deleted, false if not found
189
+ */
190
+ delete(uuid: string): Promise<boolean>;
191
+ /**
192
+ * Delete all callbacks for this module
193
+ * @returns Number of callbacks deleted
194
+ */
195
+ deleteAll(): Promise<number>;
196
+ }
151
197
  export interface ServerAPI {
152
198
  version: string;
153
199
  logger: Logger;
@@ -155,6 +201,7 @@ export interface ServerAPI {
155
201
  storage: StorageAPI;
156
202
  files: FilesAPI;
157
203
  events: IEventBus;
204
+ callbacks: CallbackAPI;
158
205
  /** Check if a hostname is in scope based on targets_subdomains */
159
206
  isHostnameInScope(hostname: string): Promise<boolean>;
160
207
  /**
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Callback types for external exfiltration detection
3
+ * Used by modules to register callbacks that can be triggered by external HTTP requests
4
+ */
5
+ /**
6
+ * Options for creating a callback
7
+ */
8
+ export interface CreateCallbackOptions {
9
+ /** Time-to-live in seconds. If not set, the callback never expires */
10
+ expiresIn?: number;
11
+ /** Delay before the callback becomes active, in seconds (default: 0 = active immediately) */
12
+ effectiveIn?: number;
13
+ /** Whether the callback can be triggered multiple times (default: true) */
14
+ allowMultipleTriggers?: boolean;
15
+ }
16
+ /**
17
+ * Data stored with a callback
18
+ */
19
+ export interface ModuleCallback {
20
+ /** Unique identifier (UUID) for the callback */
21
+ uuid: string;
22
+ /** Module that registered this callback */
23
+ moduleId: string;
24
+ /** Human-readable name for the callback */
25
+ name: string;
26
+ /** Arbitrary metadata associated with this callback (e.g., target info) */
27
+ metadata: Record<string, any>;
28
+ /** When the callback was created */
29
+ createdAt: string;
30
+ /** When the callback becomes active (callbacks before this time are ignored) */
31
+ effectiveAt: string;
32
+ /** When the callback expires (null = never) */
33
+ expiresAt: string | null;
34
+ /** Whether multiple triggers are allowed */
35
+ allowMultipleTriggers: boolean;
36
+ /** Number of times this callback has been triggered */
37
+ triggerCount: number;
38
+ /** When the callback was last triggered (null = never) */
39
+ lastTriggeredAt: string | null;
40
+ }
41
+ /**
42
+ * Data received when a callback is triggered
43
+ */
44
+ export interface CallbackTriggerData {
45
+ /** The request body sent by the external caller */
46
+ body: Record<string, any>;
47
+ /** HTTP headers from the request */
48
+ headers: Record<string, string>;
49
+ /** IP address of the caller */
50
+ remoteIp: string;
51
+ /** User agent of the caller */
52
+ userAgent: string;
53
+ /** When this trigger occurred */
54
+ triggeredAt: string;
55
+ }
56
+ /**
57
+ * Handler function called when a callback is triggered
58
+ */
59
+ export type CallbackHandler = (callback: ModuleCallback, triggerData: CallbackTriggerData) => void | Promise<void>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Callback types for external exfiltration detection
3
+ * Used by modules to register callbacks that can be triggered by external HTTP requests
4
+ */
5
+ export {};
@@ -6,3 +6,4 @@ export * from "./websockets.js";
6
6
  export * from "./tasks.js";
7
7
  export * from "./tools.js";
8
8
  export * from "./notifications.js";
9
+ export * from "./callbacks.js";
@@ -6,3 +6,4 @@ export * from "./websockets.js";
6
6
  export * from "./tasks.js";
7
7
  export * from "./tools.js";
8
8
  export * from "./notifications.js";
9
+ export * from "./callbacks.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepbounty/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "DeepBounty SDK for module development",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",