Skip to content

Instantly share code, notes, and snippets.

@Pymmdrza
Last active January 8, 2026 21:58
Show Gist options
  • Select an option

  • Save Pymmdrza/88949bb909a395b310b1791a167e490d to your computer and use it in GitHub Desktop.

Select an option

Save Pymmdrza/88949bb909a395b310b1791a167e490d to your computer and use it in GitHub Desktop.
"""
Advanced Multi-Cryptocurrency Wallet Scanner
A professional-grade implementation for scanning blockchain addresses
Author: Professional Development Team
Version: 2.0.0
"""
import os
import sys
import secrets
import logging
import requests
from typing import Dict, Optional, Tuple
from dataclasses import dataclass
from datetime import datetime
from concurrent.futures import ThreadPoolExecutor, as_completed
from libcrypto import Wallet
from colorthon import Colors
# Configuration Constants
API_ENDPOINTS = {
"btc": "https://bitcoin.atomicwallet.io/api/address/{address}?details=basic",
"eth": "https://ethereum.atomicwallet.io/api/address/{address}?details=basic",
"trx": "https://tron.guarda.com/api/accountv2?address={address}",
}
SATOSHI_TO_BTC = 100000000
WEI_TO_ETH = 1e18
SUN_TO_TRX = 1000000
OUTPUT_FILE = "found_wallets.txt"
LOG_FORMAT = f"%(asctime)s - {Colors.GREEN}[%(levelname)s]{Colors.RESET} - %(message)s"
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
# Configure Logging
logging.basicConfig(
format=LOG_FORMAT,
level=logging.INFO,
datefmt=DATE_FORMAT,
handlers=[
logging.StreamHandler(sys.stdout),
logging.FileHandler("scanner.log", mode="a"),
],
)
logger = logging.getLogger(__name__)
@dataclass
class WalletResult:
"""Data class for wallet scan results"""
address: str
balance: float
private_key: str
coin_type: str
address_type: str
timestamp: str
class CryptographicKeyGenerator:
"""
Professional cryptographic key generation using secure methods
Implements CSPRNG (Cryptographically Secure Pseudo-Random Number Generator)
"""
@staticmethod
def generate_private_key() -> str:
"""
Generate a cryptographically secure 256-bit private key
Uses secrets module which is recommended for cryptographic purposes
Returns:
str: 64-character hexadecimal private key
"""
return secrets.token_hex(32)
@staticmethod
def generate_from_entropy(entropy_bits: int = 256) -> str:
"""
Generate private key from specified entropy bits
Args:
entropy_bits: Number of entropy bits (default: 256)
Returns:
str: Hexadecimal private key
"""
if entropy_bits % 8 != 0:
raise ValueError("Entropy bits must be divisible by 8")
entropy_bytes = secrets.token_bytes(entropy_bits // 8)
return entropy_bytes.hex()
class BlockchainAPIClient:
"""Handle all blockchain API interactions with error handling and retry logic"""
def __init__(self, timeout: int = 10, max_retries: int = 3):
self.timeout = timeout
self.max_retries = max_retries
self.session = requests.Session()
self.session.headers.update(
{
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
)
def _make_request(self, url: str) -> Optional[Dict]:
"""
Make HTTP request with retry logic
Args:
url: API endpoint URL
Returns:
Optional[Dict]: JSON response or None on failure
"""
for attempt in range(self.max_retries):
try:
response = self.session.get(url, timeout=self.timeout)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
if attempt == self.max_retries - 1:
logger.error(
f"API request failed after {self.max_retries} attempts: {e}"
)
return None
continue
return None
def get_btc_balance(self, address: str) -> float:
"""Get Bitcoin balance in BTC"""
url = API_ENDPOINTS["btc"].format(address=address)
data = self._make_request(url)
if data and "balance" in data:
return int(data["balance"]) / SATOSHI_TO_BTC
return 0.0
def get_eth_balance(self, address: str) -> float:
"""Get Ethereum balance in ETH"""
url = API_ENDPOINTS["eth"].format(address=address)
data = self._make_request(url)
if data and "balance" in data:
return int(data["balance"]) / WEI_TO_ETH
return 0.0
def get_trx_balance(self, address: str) -> float:
"""Get Tron balance in TRX"""
url = API_ENDPOINTS["trx"].format(address=address)
data = self._make_request(url)
if data and "balance" in data:
return int(data["balance"]) / SUN_TO_TRX
return 0.0
class WalletScanner:
"""Main wallet scanning orchestrator"""
def __init__(self):
self.key_generator = CryptographicKeyGenerator()
self.api_client = BlockchainAPIClient()
self.scan_count = 0
self.found_count = 0
self.results = []
def generate_addresses(self, private_key: str) -> Dict[str, str]:
"""
Generate all address types from a private key
Args:
private_key: 64-character hex string
Returns:
Dict mapping address type to address
"""
wallet = Wallet(private_key)
return {
"btc_p2pkh": wallet.get_address(coin="bitcoin", address_type="p2pkh"),
"btc_p2wpkh": wallet.get_address(coin="bitcoin", address_type="p2wpkh"),
"btc_p2sh_p2wpkh": wallet.get_address(
coin="bitcoin", address_type="p2sh-p2wpkh"
),
"eth": wallet.get_address(coin="ethereum"),
"trx": wallet.get_address(coin="tron"),
}
def check_address_balance(self, address: str, addr_type: str) -> float:
"""Check balance for specific address type"""
if addr_type.startswith("btc"):
return self.api_client.get_btc_balance(address)
elif addr_type == "eth":
return self.api_client.get_eth_balance(address)
elif addr_type == "trx":
return self.api_client.get_trx_balance(address)
return 0.0
def save_result(self, result: WalletResult):
"""Save found wallet to file"""
try:
with open(OUTPUT_FILE, "a", encoding="utf-8") as f:
f.write(
f"{result.timestamp} | "
f"{result.coin_type} | "
f"{result.address_type} | "
f"{result.address} | "
f"Balance: {result.balance} | "
f"PrivateKey: {result.private_key}\n"
)
except IOError as e:
logger.error(f"Failed to save result: {e}")
def scan_wallet(self) -> bool:
"""
Scan a single wallet across all cryptocurrencies
Returns:
bool: True if any balance found
"""
self.scan_count += 1
private_key = self.key_generator.generate_private_key()
addresses = self.generate_addresses(private_key)
found_any = False
for addr_type, address in addresses.items():
balance = self.check_address_balance(address, addr_type)
if balance > 0:
found_any = True
self.found_count += 1
result = WalletResult(
address=address,
balance=balance,
private_key=private_key,
coin_type=addr_type.split("_")[0].upper(),
address_type=addr_type,
timestamp=datetime.utcnow().strftime(DATE_FORMAT),
)
self.save_result(result)
logger.info(
f"{Colors.GREEN}[FOUND!]{Colors.RESET} "
f"{result.coin_type} {result.address_type}: {address} "
f"Balance: {balance} | Key: {private_key}"
)
else:
logger.info(
f"{Colors.WHITE}[{self.scan_count}]{Colors.RESET} "
f"Found: {Colors.CYAN}{self.found_count}{Colors.RESET} | "
f"{Colors.GREY}{addr_type}: {address}{Colors.RESET}"
)
return found_any
def run(self):
"""Main scanning loop"""
logger.info("Starting Advanced Wallet Scanner...")
logger.info(f"Output file: {OUTPUT_FILE}")
try:
while True:
self.scan_wallet()
except KeyboardInterrupt:
logger.info("\n[*] Scanner stopped by user")
logger.info(f"Total scans: {self.scan_count}")
logger.info(f"Wallets found: {self.found_count}")
sys.exit(0)
def main():
"""Entry point"""
scanner = WalletScanner()
scanner.run()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment