@deepbounty/sdk 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ import { HttpTraffic } from "./types/burpsuite";
2
+ /**
3
+ * Predefined core events emitted by the server
4
+ * Modules can also emit custom events for inter-module communication
5
+ */
6
+ export interface CoreEvents {
7
+ "http:traffic": HttpTraffic;
8
+ }
9
+ /**
10
+ * Event handler function signature
11
+ */
12
+ export type EventHandler<T = any> = (data: T) => void | Promise<void>;
13
+ /**
14
+ * Subscription object returned when subscribing to events
15
+ */
16
+ export interface EventSubscription {
17
+ unsubscribe: () => void;
18
+ }
19
+ export interface IEventBus {
20
+ /**
21
+ * Subscribe to an event
22
+ * @param event - Event name (type-safe for CoreEvents, flexible for custom events)
23
+ * @param handler - Async handler function called when event is emitted
24
+ * @returns Subscription object with unsubscribe method
25
+ */
26
+ subscribe<K extends keyof CoreEvents>(event: K, handler: EventHandler<CoreEvents[K]>): EventSubscription;
27
+ subscribe<T = any>(event: string, handler: EventHandler<T>): EventSubscription;
28
+ /**
29
+ * Emit an event with data
30
+ * Non-blocking, async execution with rate limiting and error isolation
31
+ * @param event - Event name
32
+ * @param data - Event data
33
+ */
34
+ emit<K extends keyof CoreEvents>(event: K, data: CoreEvents[K]): void;
35
+ emit<T = any>(event: string, data: T): void;
36
+ /**
37
+ * Clear all listeners for a specific event or all events
38
+ * @param event - Optional event name to clear (clears all if not provided)
39
+ */
40
+ clear(event?: string): void;
41
+ }
package/dist/events.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ModuleSetting, TaskContent, TaskResult, Tool } from "./types";
1
+ import { Alert, ModuleSetting, TaskContent, TaskResult, Tool } from "./types";
2
+ import { IEventBus } from "./events";
2
3
  export interface Logger {
3
4
  info: (...args: any[]) => void;
4
5
  warn: (...args: any[]) => void;
@@ -81,6 +82,7 @@ export interface ServerAPI {
81
82
  logger: Logger;
82
83
  config: ConfigAPI;
83
84
  storage: StorageAPI;
85
+ events: IEventBus;
84
86
  /**
85
87
  * Register a task template that can be scheduled for all targets
86
88
  * @param uniqueKey Unique identifier for this task within the module (e.g., "subdomain-scan")
@@ -102,11 +104,24 @@ export interface ServerAPI {
102
104
  * @param tool The tool to register
103
105
  */
104
106
  registerTool(tool: Tool): void;
107
+ /**
108
+ * Create a new alert for a target
109
+ * @param targetId The ID of the target
110
+ * @param name The title of the alert
111
+ * @param subdomain The subdomain where the vulnerability was found
112
+ * @param score The severity score (0=Informational, 1=Low, 2=Medium, 3=High, 4=Critical)
113
+ * @param description Detailed description of the alert
114
+ * @param endpoint Specific endpoint/path where the vulnerability was found
115
+ * @param confirmed Whether the vulnerability has been confirmed (default: false)
116
+ * @returns The created alert ID
117
+ */
118
+ createAlert(targetId: number, name: string, subdomain: string, score: number, description: string, endpoint: string, confirmed?: boolean): Promise<Alert>;
105
119
  }
106
120
  export interface PluginLifecycle {
107
121
  run?(api: ServerAPI): Promise<void> | void;
108
122
  stop?(): Promise<void> | void;
109
123
  }
110
124
  export type PluginFactory = (api: ServerAPI) => PluginLifecycle | Promise<PluginLifecycle>;
125
+ export { IEventBus, EventSubscription, CoreEvents, EventHandler, } from "./events";
111
126
  declare const _default: any;
112
127
  export default _default;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * HTTP traffic data from Burp Suite
3
+ */
4
+ export interface HttpTraffic {
5
+ url: string;
6
+ method: string;
7
+ statusCode: number;
8
+ requestHeaders: Record<string, string>;
9
+ responseHeaders: Record<string, string>;
10
+ requestBody: string;
11
+ responseBody: string;
12
+ mimeType: string;
13
+ timestamp: Date;
14
+ targetId?: number;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -5,3 +5,4 @@ export * from "./workers.js";
5
5
  export * from "./websockets.js";
6
6
  export * from "./tasks.js";
7
7
  export * from "./tools.js";
8
+ export * from "./notifications.js";
@@ -5,3 +5,4 @@ export * from "./workers.js";
5
5
  export * from "./websockets.js";
6
6
  export * from "./tasks.js";
7
7
  export * from "./tools.js";
8
+ export * from "./notifications.js";
@@ -0,0 +1,30 @@
1
+ export type NotificationService = {
2
+ provider: "discord";
3
+ config: DiscordConfig;
4
+ enabled: boolean;
5
+ } | {
6
+ provider: "ntfysh";
7
+ config: ntfyshConfig;
8
+ enabled: boolean;
9
+ };
10
+ export interface DiscordConfig {
11
+ webhookUrl: string;
12
+ notificationRoleID?: string;
13
+ }
14
+ export interface ntfyshConfig {
15
+ serverRootUrl: string;
16
+ topic: string;
17
+ username?: string;
18
+ password?: string;
19
+ token?: string;
20
+ }
21
+ export interface NotificationConfigField {
22
+ name: string;
23
+ type: "text" | "password";
24
+ placeholder?: string;
25
+ required?: boolean;
26
+ }
27
+ export interface NotificationProvider {
28
+ label: string;
29
+ fields: NotificationConfigField[];
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -2,6 +2,8 @@ import { TaskExecution } from "./tasks";
2
2
  import { Tool } from "./tools";
3
3
  export interface Worker {
4
4
  id: number;
5
+ ip?: string;
5
6
  currentTasks: TaskExecution[];
6
7
  availableTools: Tool[];
8
+ connectedAt: Date;
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepbounty/sdk",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "DeepBounty SDK for module development",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",