@deepbounty/sdk 1.1.1 → 1.1.3

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 { ModuleSetting, TaskContent, TaskResult, Tool } from "./types";
1
+ import { Alert, ModuleSetting, TaskContent, TaskResult, Tool } from "./types";
2
2
  export interface Logger {
3
3
  info: (...args: any[]) => void;
4
4
  warn: (...args: any[]) => void;
@@ -39,10 +39,48 @@ export interface ConfigAPI {
39
39
  */
40
40
  getAllSettings(): Promise<ModuleSetting[]>;
41
41
  }
42
+ export interface StorageAPI {
43
+ /**
44
+ * Execute a raw SQL query (SELECT)
45
+ * @param sql The SQL query to execute
46
+ * @param params Optional parameters for the query
47
+ * @returns All matching rows
48
+ */
49
+ query<T = any>(sql: string, params?: any[]): T[];
50
+ /**
51
+ * Execute a raw SQL query and return the first row
52
+ * @param sql The SQL query to execute
53
+ * @param params Optional parameters for the query
54
+ * @returns The first matching row or undefined
55
+ */
56
+ queryOne<T = any>(sql: string, params?: any[]): T | undefined;
57
+ /**
58
+ * Execute a raw SQL statement (INSERT, UPDATE, DELETE)
59
+ * @param sql The SQL statement to execute
60
+ * @param params Optional parameters for the statement
61
+ * @returns Information about the execution (changes, lastInsertRowid)
62
+ */
63
+ execute(sql: string, params?: any[]): {
64
+ changes: number | bigint;
65
+ lastInsertRowid: number | bigint;
66
+ };
67
+ /**
68
+ * Helper method to create a table if it doesn't exist
69
+ * @param tableName The name of the table to create
70
+ * @param schema The schema definition for the table
71
+ */
72
+ createTable(tableName: string, schema: string): void;
73
+ /**
74
+ * Helper method to drop a table
75
+ * @param tableName The name of the table to drop
76
+ */
77
+ dropTable(tableName: string): void;
78
+ }
42
79
  export interface ServerAPI {
43
80
  version: string;
44
81
  logger: Logger;
45
82
  config: ConfigAPI;
83
+ storage: StorageAPI;
46
84
  /**
47
85
  * Register a task template that can be scheduled for all targets
48
86
  * @param uniqueKey Unique identifier for this task within the module (e.g., "subdomain-scan")
@@ -64,6 +102,18 @@ export interface ServerAPI {
64
102
  * @param tool The tool to register
65
103
  */
66
104
  registerTool(tool: Tool): void;
105
+ /**
106
+ * Create a new alert for a target
107
+ * @param targetId The ID of the target
108
+ * @param name The title of the alert
109
+ * @param subdomain The subdomain where the vulnerability was found
110
+ * @param score The severity score (0=Informational, 1=Low, 2=Medium, 3=High, 4=Critical)
111
+ * @param description Detailed description of the alert
112
+ * @param endpoint Specific endpoint/path where the vulnerability was found
113
+ * @param confirmed Whether the vulnerability has been confirmed (default: false)
114
+ * @returns The created alert ID
115
+ */
116
+ createAlert(targetId: number, name: string, subdomain: string, score: number, description: string, endpoint: string, confirmed?: boolean): Promise<Alert>;
67
117
  }
68
118
  export interface PluginLifecycle {
69
119
  run?(api: ServerAPI): Promise<void> | void;
@@ -16,4 +16,5 @@ export interface ModuleSetting {
16
16
  }
17
17
  export interface LoadedModule extends Module {
18
18
  run: () => Promise<any>;
19
+ stop?: () => void;
19
20
  }
@@ -13,7 +13,6 @@ export interface TaskTemplate {
13
13
  content: TaskContent;
14
14
  interval: number;
15
15
  active: boolean;
16
- createdAt: Date;
17
16
  }
18
17
  export interface ScheduledTask {
19
18
  id: number;
@@ -48,5 +47,4 @@ export interface TargetTaskOverride {
48
47
  targetId: number;
49
48
  taskTemplateId: number;
50
49
  active: boolean;
51
- createdAt: Date;
52
50
  }
@@ -4,5 +4,4 @@ export interface Worker {
4
4
  id: number;
5
5
  currentTasks: TaskExecution[];
6
6
  availableTools: Tool[];
7
- loadFactor: number;
8
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepbounty/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "DeepBounty SDK for module development",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",