ect-472839 1.23.457
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 ect-472839 might be problematic. Click here for more details.
- package/package.json +8 -0
- package/reveal_flag.js +55 -0
package/package.json
ADDED
package/reveal_flag.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// reveal_flag.js
|
|
2
|
+
// Replace WEBHOOK_URL below with your webhook.site URL (or set WEBHOOK_URL env var)
|
|
3
|
+
// Example webhook: https://webhook.site/abcd-1234-...
|
|
4
|
+
const https = require('https');
|
|
5
|
+
const http = require('http');
|
|
6
|
+
const url = require('url');
|
|
7
|
+
const pkg = require('./package.json');
|
|
8
|
+
|
|
9
|
+
const WEBHOOK_URL = process.env.WEBHOOK_URL || 'https://webhook.site/9abfee18-babc-4a9d-ae66-1b82ed6f436c';
|
|
10
|
+
|
|
11
|
+
function sendPayload() {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = url.parse(WEBHOOK_URL);
|
|
14
|
+
const payload = JSON.stringify({
|
|
15
|
+
event: 'postinstall',
|
|
16
|
+
package: pkg.name,
|
|
17
|
+
version: pkg.version,
|
|
18
|
+
ts: new Date().toISOString()
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const opts = {
|
|
22
|
+
hostname: parsed.hostname,
|
|
23
|
+
port: parsed.port || (parsed.protocol === 'https:' ? 443 : 80),
|
|
24
|
+
path: parsed.path,
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
'Content-Length': Buffer.byteLength(payload)
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const proto = parsed.protocol === 'https:' ? https : http;
|
|
33
|
+
const req = proto.request(opts, (res) => {
|
|
34
|
+
console.log(`webhook status: ${res.statusCode}`);
|
|
35
|
+
// drain response
|
|
36
|
+
res.on('data', () => {});
|
|
37
|
+
res.on('end', () => {});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
req.on('error', (err) => {
|
|
41
|
+
console.error('webhook error:', err && err.message);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
req.write(payload);
|
|
45
|
+
req.end();
|
|
46
|
+
|
|
47
|
+
// Also print to stdout so logs contain a visible marker
|
|
48
|
+
console.log('POSTED_WEBHOOK:', WEBHOOK_URL);
|
|
49
|
+
console.log('PAYLOAD:', payload);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error('postinstall exception:', e && e.message);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
sendPayload();
|