-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.py
More file actions
457 lines (362 loc) · 15.4 KB
/
Copy pathmain.py
File metadata and controls
457 lines (362 loc) · 15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
#!/usr/bin/env python3
"""
LulzSec ULTIMATE Forensic Scanner V9.0 - MODULAR EDITION
Advanced cryptocurrency wallet and credential scanner
Author: LulzSec1337
Version: 9.0 MODULAR
Date: 2025-10-27
FULLY FUNCTIONAL & ADVANCED:
- All modules extracted and tested ✅
- 14+ blockchain networks supported ✅
- Multi-format private key extraction ✅
- SMS API detection (Twilio, Nexmo, etc.) ✅
- Email validation (SMTP/IMAP) ✅
- Comprehensive database management ✅
- Real-time balance checking ✅
"""
import sys
import os
import logging
from pathlib import Path
# Add project root to path
PROJECT_ROOT = Path(__file__).parent
sys.path.insert(0, str(PROJECT_ROOT))
# Import all modules
from config.api_config import APIConfig
from core.crypto_utils import EnhancedCryptoUtils
from core.balance_checker import AdvancedBalanceChecker
from database.db_manager import EnhancedDatabaseManager
from validators.email_validator import EmailValidator
from validators.sms_detector import SMSAPIDetector
from extractors.private_key_extractor import ComprehensivePrivateKeyExtractor
# Setup logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('lulzsec_scanner.log'),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
class LulzSecForensicScanner:
"""
Main forensic scanner class - integrates all modules
Features:
- Modular architecture
- All extractors functional
- All validators working
- Multi-network support
- Database persistence
- Advanced reporting
"""
def __init__(self):
"""Initialize all scanner components"""
logger.info("=" * 60)
logger.info("LulzSec ULTIMATE Forensic Scanner V9.0 - STARTING")
logger.info("=" * 60)
# Initialize core modules
self.api_config = APIConfig()
self.crypto_utils = EnhancedCryptoUtils()
self.balance_checker = AdvancedBalanceChecker(self.api_config)
self.database = EnhancedDatabaseManager()
# Initialize validators
self.email_validator = EmailValidator()
self.sms_detector = SMSAPIDetector()
# Initialize extractors
self.key_extractor = ComprehensivePrivateKeyExtractor(
self.crypto_utils,
self.balance_checker,
self.status_callback
)
logger.info("✅ All modules initialized successfully")
def status_callback(self, message: str, level: str = "info"):
"""Status callback for extractors"""
if level == "success":
logger.info(f"✅ {message}")
elif level == "error":
logger.error(f"❌ {message}")
elif level == "warning":
logger.warning(f"⚠️ {message}")
else:
logger.info(message)
def scan_directory(self, directory_path: str):
"""
Scan directory for wallets and credentials
Args:
directory_path: Path to directory to scan
"""
logger.info(f"🔍 Scanning directory: {directory_path}")
if not os.path.exists(directory_path):
logger.error(f"Directory not found: {directory_path}")
return
# Scan all files
file_count = 0
for root, dirs, files in os.walk(directory_path):
for file in files:
file_path = os.path.join(root, file)
file_count += 1
logger.info(f"📄 Scanning file {file_count}: {file}")
# Extract private keys
self.key_extractor.extract_all_key_formats(file_path)
# Scan for SMS APIs
sms_apis = self.sms_detector.scan_file_for_apis(file_path)
if sms_apis:
logger.info(f" Found {len(sms_apis)} SMS API credential(s)")
for api in sms_apis:
self.database.add_sms_api({
'provider': api['provider'],
'api_key': str(api['credentials']),
'source_file': file_path
})
logger.info(f"✅ Scanned {file_count} file(s)")
def scan_file(self, file_path: str):
"""
Scan single file for wallets and credentials
Args:
file_path: Path to file to scan
"""
logger.info(f"🔍 Scanning file: {file_path}")
if not os.path.exists(file_path):
logger.error(f"File not found: {file_path}")
return
# Extract private keys
self.key_extractor.extract_all_key_formats(file_path)
# Scan for SMS APIs
sms_apis = self.sms_detector.scan_file_for_apis(file_path)
if sms_apis:
logger.info(f"Found {len(sms_apis)} SMS API credential(s)")
logger.info("✅ Scan complete")
def validate_seed_phrase(self, seed_phrase: str):
"""
Validate and derive addresses from seed phrase
Args:
seed_phrase: BIP39 seed phrase
Returns:
Dictionary with validation results
"""
logger.info("🔄 Validating seed phrase...")
is_valid = self.crypto_utils.validate_seed_phrase(seed_phrase)
if not is_valid:
logger.error("❌ Invalid seed phrase")
return {'valid': False}
logger.info("✅ Valid seed phrase")
# Extract private keys
private_keys = self.crypto_utils.extract_private_keys_from_text(seed_phrase)
result = {
'valid': True,
'word_count': len(seed_phrase.split()),
'private_keys': private_keys
}
# Derive addresses for each network
if private_keys:
pk = private_keys[0]
addresses = {}
networks = ['ETH', 'BTC', 'TRX', 'SOL', 'LTC', 'DOGE']
for network in networks:
try:
addr = self.crypto_utils.private_key_to_address(pk, network)
if addr:
addresses[network] = addr
except Exception as e:
logger.debug(f"Address derivation error for {network}: {e}")
result['addresses'] = addresses
return result
def check_balance(self, address: str, network: str):
"""
Check balance for address
Args:
address: Cryptocurrency address
network: Network type (ETH, BTC, etc.)
Returns:
Dictionary with balance information
"""
logger.info(f"💰 Checking balance for {network} address...")
info = self.balance_checker.get_comprehensive_balance(address, network)
logger.info(f"Balance: {info['balance']:.8f} {network}")
logger.info(f"Value: ${info['value_usd']:.2f} USD")
return info
def validate_email(self, email: str):
"""
Get email information
Args:
email: Email address
Returns:
Dictionary with email details
"""
logger.info(f"📧 Analyzing email: {email}")
info = self.email_validator.get_email_info(email)
if info.get('is_premium'):
logger.info("✅ Premium ISP email detected")
if info.get('has_sms_gateway'):
logger.info("✅ SMS gateway available")
return info
def get_statistics(self):
"""Get comprehensive scanner statistics"""
logger.info("📊 Gathering statistics...")
# Database stats
db_stats = self.database.get_statistics()
# Extractor stats
extractor_stats = self.key_extractor.get_summary()
# Balance checker stats
balance_stats = self.balance_checker.get_cache_stats()
stats = {
'database': db_stats,
'extractor': extractor_stats,
'balance_cache': balance_stats
}
# Print summary
logger.info("=" * 60)
logger.info("SCANNER STATISTICS")
logger.info("=" * 60)
logger.info(f"Total Keys Found: {extractor_stats['total_keys_found']}")
logger.info(f"Total Addresses: {extractor_stats['total_addresses_derived']}")
logger.info(f"Total Wallets in DB: {db_stats['total_wallets']}")
logger.info(f"Total Credentials: {db_stats['total_credentials']}")
logger.info(f"Valid SMS APIs: {db_stats['valid_sms_apis']}")
logger.info("=" * 60)
return stats
def export_results(self, output_dir: str = "."):
"""
Export all results to files
Args:
output_dir: Output directory path
"""
logger.info("📤 Exporting results...")
os.makedirs(output_dir, exist_ok=True)
# Export private keys
keys_path = os.path.join(output_dir, "found_private_keys.txt")
self.key_extractor.export_found_keys(keys_path)
logger.info(f"✅ Keys exported to: {keys_path}")
# Backup database
db_path = os.path.join(output_dir, "lulzsec_backup.db")
success, path = self.database.backup_database(db_path)
if success:
logger.info(f"✅ Database backed up to: {path}")
logger.info("✅ Export complete")
def run_interactive(self):
"""Run interactive mode"""
logger.info("🎮 Interactive mode - Type 'help' for commands")
while True:
try:
cmd = input("\nlulzsec> ").strip().lower()
if cmd == 'help':
print("""
Available Commands:
scan <path> - Scan file or directory
seed <phrase> - Validate seed phrase
balance <addr> <net> - Check balance (e.g., balance 0x123... ETH)
email <address> - Analyze email
stats - Show statistics
export [dir] - Export results
quit - Exit scanner
""")
elif cmd.startswith('scan '):
path = cmd[5:].strip()
if os.path.isdir(path):
self.scan_directory(path)
else:
self.scan_file(path)
elif cmd.startswith('seed '):
seed = cmd[5:].strip()
result = self.validate_seed_phrase(seed)
print(f"Valid: {result.get('valid')}")
if result.get('addresses'):
print("\nDerived Addresses:")
for net, addr in result['addresses'].items():
print(f" {net}: {addr}")
elif cmd.startswith('balance '):
parts = cmd.split()
if len(parts) >= 3:
address = parts[1]
network = parts[2].upper()
info = self.check_balance(address, network)
elif cmd.startswith('email '):
email = cmd[6:].strip()
info = self.validate_email(email)
elif cmd == 'stats':
self.get_statistics()
elif cmd.startswith('export'):
parts = cmd.split()
output_dir = parts[1] if len(parts) > 1 else "."
self.export_results(output_dir)
elif cmd in ['quit', 'exit', 'q']:
logger.info("👋 Exiting scanner...")
break
else:
print("Unknown command. Type 'help' for available commands.")
except KeyboardInterrupt:
print("\nUse 'quit' to exit")
except Exception as e:
logger.error(f"Command error: {e}")
def main():
"""Main entry point"""
print("""
╔═══════════════════════════════════════════════════════╗
║ ║
║ LulzSec ULTIMATE Forensic Scanner V9.0 MODULAR ║
║ ║
║ ✅ Fully Functional & Advanced ║
║ ✅ All Modules Tested & Working ║
║ ✅ 14+ Blockchain Networks ║
║ ✅ Multi-Format Key Extraction ║
║ ✅ SMS API Detection ║
║ ✅ Email Validation ║
║ ║
╚═══════════════════════════════════════════════════════╝
""")
# Initialize scanner
scanner = LulzSecForensicScanner()
# Check command line arguments
if len(sys.argv) > 1:
command = sys.argv[1].lower()
if command == 'scan' and len(sys.argv) > 2:
path = sys.argv[2]
if os.path.isdir(path):
scanner.scan_directory(path)
else:
scanner.scan_file(path)
scanner.get_statistics()
scanner.export_results()
elif command == 'seed' and len(sys.argv) > 2:
seed = ' '.join(sys.argv[2:])
result = scanner.validate_seed_phrase(seed)
if result.get('addresses'):
print("\nDerived Addresses:")
for net, addr in result['addresses'].items():
print(f"{net}: {addr}")
elif command == 'balance' and len(sys.argv) > 3:
address = sys.argv[2]
network = sys.argv[3].upper()
scanner.check_balance(address, network)
elif command == 'stats':
scanner.get_statistics()
elif command == 'help':
print("""
Usage: python main.py [command] [arguments]
Commands:
scan <path> - Scan file or directory for wallets
seed <phrase> - Validate BIP39 seed phrase
balance <address> <net> - Check balance (ETH, BTC, etc.)
stats - Show scanner statistics
interactive - Enter interactive mode
help - Show this help message
Examples:
python main.py scan /path/to/directory
python main.py seed "word1 word2 ... word12"
python main.py balance 0x123... ETH
python main.py interactive
""")
else:
print("Unknown command. Use 'python main.py help' for usage.")
else:
# No arguments - run interactive mode
scanner.run_interactive()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n\n👋 Scanner terminated by user")
except Exception as e:
logger.error(f"Fatal error: {e}", exc_info=True)
sys.exit(1)