Created
June 22, 2025 14:11
-
-
Save maycuatroi1/183266c91d33b1d341f4c55e256285b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comprehensive malware analysis script | |
const fs = require('fs'); | |
console.log('=== VIRUS.JS MALWARE ANALYSIS ===\n'); | |
// Read the file | |
const code = fs.readFileSync('virus.js', 'utf8'); | |
// Analysis results | |
const analysis = { | |
obfuscationTechniques: [], | |
suspiciousPatterns: [], | |
targetedData: [], | |
networkActivity: [], | |
fileOperations: [] | |
}; | |
// 1. Identify obfuscation techniques | |
if (code.match(/_0x[a-f0-9]+/g)) { | |
analysis.obfuscationTechniques.push('Hexadecimal function/variable naming'); | |
} | |
if (code.match(/\[0x[a-f0-9]+\]/g)) { | |
analysis.obfuscationTechniques.push('Hexadecimal array indexing'); | |
} | |
if (code.match(/parseInt\([^)]+\)\s*[+\-*/]/g)) { | |
analysis.obfuscationTechniques.push('Complex arithmetic operations for control flow'); | |
} | |
if (code.match(/!!\[\]/)) { | |
analysis.obfuscationTechniques.push('Boolean obfuscation (!![] = true)'); | |
} | |
// 2. Extract suspicious patterns | |
const patterns = { | |
fileReading: /fs\.(readFile|readFileSync|createReadStream)/g, | |
fileCopying: /fs\.(copyFile|copyFileSync)/g, | |
networking: /(require\(['"]request['"]|http|https|axios)/g, | |
systemInfo: /(hostname|platform|homedir|tmpdir)/g, | |
browserPaths: /(chrome|brave|opera|firefox|edge)/gi, | |
cryptoWallets: /(wallet|solana|metamask|phantom|bitcoin|ethereum)/gi, | |
extensions: /\.(ldb|log|sqlite|json)/g | |
}; | |
for (const [category, pattern] of Object.entries(patterns)) { | |
const matches = code.match(pattern); | |
if (matches) { | |
analysis.suspiciousPatterns.push({ | |
category, | |
count: matches.length, | |
samples: [...new Set(matches)].slice(0, 3) | |
}); | |
} | |
} | |
// 3. Extract visible strings that might indicate targets | |
const browserTargets = code.match(/(Local Storage|Login Data|Cookies|Web Data|History)/g); | |
if (browserTargets) { | |
analysis.targetedData.push('Browser data: ' + [...new Set(browserTargets)].join(', ')); | |
} | |
const walletTargets = code.match(/(id\.json|wallet\.dat|keystore)/g); | |
if (walletTargets) { | |
analysis.targetedData.push('Cryptocurrency wallets: ' + [...new Set(walletTargets)].join(', ')); | |
} | |
// 4. Look for base64 encoded content | |
const base64Pattern = /[A-Za-z0-9+/]{20,}={0,2}/g; | |
const base64Matches = code.match(base64Pattern); | |
if (base64Matches) { | |
analysis.suspiciousPatterns.push({ | |
category: 'Base64 encoded content', | |
count: base64Matches.length, | |
note: 'May contain encoded payloads or URLs' | |
}); | |
} | |
// 5. Extract visible IPs or domains | |
const urlPattern = /https?:\/\/[^\s'"]+|[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}/g; | |
const urls = code.match(urlPattern); | |
if (urls) { | |
analysis.networkActivity = [...new Set(urls)]; | |
} | |
// Print analysis results | |
console.log('1. OBFUSCATION TECHNIQUES:'); | |
analysis.obfuscationTechniques.forEach(tech => console.log(` - ${tech}`)); | |
console.log('\n2. SUSPICIOUS PATTERNS:'); | |
analysis.suspiciousPatterns.forEach(({category, count, samples}) => { | |
console.log(` - ${category}: ${count} occurrences`); | |
if (samples) { | |
samples.forEach(s => console.log(` • ${s}`)); | |
} | |
}); | |
console.log('\n3. TARGETED DATA:'); | |
analysis.targetedData.forEach(target => console.log(` - ${target}`)); | |
console.log('\n4. NETWORK ACTIVITY:'); | |
analysis.networkActivity.forEach(url => console.log(` - ${url}`)); | |
// 6. Behavioral analysis | |
console.log('\n5. BEHAVIORAL ANALYSIS:'); | |
console.log(' Based on the code patterns, this malware appears to:'); | |
console.log(' - Steal browser data (passwords, cookies, history)'); | |
console.log(' - Target cryptocurrency wallets'); | |
console.log(' - Collect system information'); | |
console.log(' - Exfiltrate data to remote servers'); | |
console.log(' - Use heavy obfuscation to evade detection'); | |
// 7. Known extension IDs (crypto wallets) | |
const knownExtensions = [ | |
'nkbihfbeogaeaoehlefnkodbefgpgknn', // MetaMask | |
'aeachknmefphepccionboohckonoeemg', // Coin98 | |
'fhbohimaelbohpjbbldcngcnapndodjp', // Binance Chain | |
'odbfpeeihdkbihmopkbjmoonfanlbfcl', // Brave Wallet | |
'hpglfhgfnhbgpjdenjgmdgoeiappafln', // Guarda | |
'blnieiiffboillknjnepogjhkgnoapac', // MEW CX | |
'nanjmdknhkinifnkgdcggcfnhdaammmj', // GuildWallet | |
'nphplpgoakhhjchkkhmiggakijnkhfnd', // Ton Crystal | |
'cgeeodpfagjceefieflmdfphplkenlfk', // EVER Wallet | |
'pdadjkfkgcafgbceimcpbkalnfnepbnk', // KardiaChain | |
]; | |
const foundExtensions = knownExtensions.filter(ext => code.includes(ext)); | |
if (foundExtensions.length > 0) { | |
console.log('\n6. DETECTED CRYPTO WALLET EXTENSIONS:'); | |
foundExtensions.forEach(ext => { | |
const walletName = { | |
'nkbihfbeogaeaoehlefnkodbefgpgknn': 'MetaMask', | |
'aeachknmefphepccionboohckonoeemg': 'Coin98', | |
'fhbohimaelbohpjbbldcngcnapndodjp': 'Binance Chain Wallet', | |
'odbfpeeihdkbihmopkbjmoonfanlbfcl': 'Brave Wallet', | |
'hpglfhgfnhbgpjdenjgmdgoeiappafln': 'Guarda', | |
'blnieiiffboillknjnepogjhkgnoapac': 'MEW CX', | |
'nanjmdknhkinifnkgdcggcfnhdaammmj': 'GuildWallet', | |
'nphplpgoakhhjchkkhmiggakijnkhfnd': 'Ton Crystal Wallet', | |
'cgeeodpfagjceefieflmdfphplkenlfk': 'EVER Wallet', | |
'pdadjkfkgcafgbceimcpbkalnfnepbnk': 'KardiaChain' | |
}; | |
console.log(` - ${ext} (${walletName[ext] || 'Unknown wallet'})`); | |
}); | |
} | |
// Save detailed analysis | |
fs.writeFileSync('malware_analysis.json', JSON.stringify(analysis, null, 2)); | |
console.log('\n\nDetailed analysis saved to malware_analysis.json'); | |
console.log('\n=== IMPACT ASSESSMENT ==='); | |
console.log('This malware is designed to:'); | |
console.log('1. Steal sensitive browser data including:'); | |
console.log(' - Saved passwords'); | |
console.log(' - Cookies and session tokens'); | |
console.log(' - Browsing history'); | |
console.log(' - Autofill data'); | |
console.log(''); | |
console.log('2. Target cryptocurrency assets by:'); | |
console.log(' - Stealing wallet files'); | |
console.log(' - Extracting browser extension data'); | |
console.log(' - Looking for private keys and seed phrases'); | |
console.log(''); | |
console.log('3. Gather system information for:'); | |
console.log(' - Victim identification'); | |
console.log(' - Further targeted attacks'); | |
console.log(''); | |
console.log('4. Data exfiltration through:'); | |
console.log(' - HTTP/HTTPS requests to C&C servers'); | |
console.log(' - Potential use of legitimate services as proxies'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment