from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time
# ===== 从文件读取密码字典 ===== defload_passwords(file_path): """从txt文件读取密码列表""" try: withopen(file_path, 'r', encoding='utf-8') as f: # 读取所有行,去除空行和前后空格 passwords = [line.strip() for line in f if line.strip()] print(f"✅ 成功加载 {len(passwords)} 个密码") return passwords except FileNotFoundError: print(f"❌ 错误: 找不到文件 {file_path}") return [] except Exception as e: print(f"❌ 读取文件时出错: {e}") return []
n = 14070754234209585800232634546325624819982185952673905053702891604674100339022883248944477908133810472748877029408864634701590339742452010000798957135872412483891523031580735317558166390805963001389999673532396972009696089072742463405543527845901369617515343242940788986578427709036923957774197805224415531570285914497828532354144069019482248200179658346673726866641476722431602154777272137461817946690611413973565446874772983684785869431957078489177937408583077761820157276339873500082526060431619271198751378603409721518832711634990892781578484012381667814631979944383411800101335129369193315802989383955827098934489 e = 65537 c = 12312807681090775663449755503116041117407837995529562718510452391461356192258329776159493018768087453289696353524051692157990247921285844615014418841030154700106173452384129940303909074742769886414052488853604191654590458187680183616318236293852380899979151260836670423218871805674446000309373481725774969422672736229527525591328471860345983778028010745586148340546463680818388894336222353977838015397994043740268968888435671821802946193800752173055888706754526261663215087248329005557071106096518012133237897251421810710854712833248875972001538173403966229724632452895508035768462851571544231619079557987628227178358
k = 485723311775451084490131424696603828503121391558424003875128327297219030209620409301965720801386755451211861235029553063690749071961769290228672699730274712790110328643361418488523850331864608239660637323505924467595552293954200495174815985511827027913668477355984099228100469167128884236364008368230807336455721259701674165150959031166621381089213574626382643770012299575625039962530813909883594225301664728207560469046767485067146540498028505317113631970909809355823386324477936590351860786770580377775431764048693195017557432320430650328751116174124989038139756718362090105378540643587230129563930454260456320785629555493541609065309679709263733546183441765688806201058755252368942465271917663774868678682736973621371451440269201543952580232165981094719134791956854961433894740133317928275468758142862373593473875148862015695758191730229010960894713851228770656646728682145295722403096813082295018446712479920173040974429645523244575300611492359684052455691388127306813958610152185716611576776736342210195290674162667807163446158064125000445084485749597675094544031166691527647433823855652513968545236726519051559119550903995500324781631036492013723999955841701455597918532359171203698303815049834141108746893552928431581707889710001424400
# y = 2*u + 1, u is 16-bit prime → y is odd, 2^16 < y < 2^17+something
# 我们枚举所有合理的 y (可以从 2^16+3 到 2^17+100 左右的所有奇数都试也行,但效率低) # 更高效:生成所有 16 bit 素数
defis_square(n): if n < 0: returnFalse s = int(gmpy2.isqrt(n)) return s*s == n
found = False
# 粗暴枚举 y 在合理范围内 (你可以优化成只枚举 2*prime +1) for yy inrange(2**16 + 1, 2**17 + 200, 2): # 所有奇数 y = yy A = (y - 1)**2 B = 2*y**2 - 4*y + 2 C = (y - 1)**2 - 4*k disc = B**2 - 4*A*C ifnot is_square(disc): continue sqrt_d = int(gmpy2.isqrt(disc)) if sqrt_d**2 != disc: continue # 两个可能的 x for sign in [1, -1]: numerator = -B + sign * sqrt_d if numerator % (2 * A) != 0: continue x = numerator // (2 * A) if x <= 0: continue phi = x + 1 if phi >= n: continue # 检查 phi 是否合理 s = n - phi + 1# p + q disc_pq = s**2 - 4*n ifnot is_square(disc_pq): continue dd = int(gmpy2.isqrt(disc_pq)) if dd**2 != disc_pq: continue p = (s + dd) // 2 q = (s - dd) // 2 if p * q == n and isPrime(p) and isPrime(q): print(f"找到!p = {p}") print(f"q = {q}") d = inverse(e, phi) m = pow(c, d, n) flag = long_to_bytes(m) print("flag =", flag) found = True break if found: break