dp leaking
0x01 Calculation idea
0x02 What about “p”
ergodic x
got (p-1)
got p
d = gmpy2.invert(e,phi)%phi
0x03 Examples
e = 65537
n = 156808343598578774957375696815188980682166740609302831099696492068246337198792510898818496239166339015207305102101431634283168544492984586566799996471150252382144148257236707247267506165670877506370253127695314163987084076462560095456635833650720606337852199362362120808707925913897956527780930423574343287847
c = 108542078809057774666748066235473292495343753790443966020636060807418393737258696352569345621488958094856305865603100885838672591764072157183336139243588435583104423268921439473113244493821692560960443688048994557463526099985303667243623711454841573922233051289561865599722004107134302070301237345400354257869
dp = 734763139918837027274765680404546851353356952885439663987181004382601658386317353877499122276686150509151221546249750373865024485652349719427182780275825
#!/usr/bin/python
# -*- coding:utf-8 -*-
import gmpy2
import rsa
import binascii
e = 65537
n = 156808343598578774957375696815188980682166740609302831099696492068246337198792510898818496239166339015207305102101431634283168544492984586566799996471150252382144148257236707247267506165670877506370253127695314163987084076462560095456635833650720606337852199362362120808707925913897956527780930423574343287847
c = 108542078809057774666748066235473292495343753790443966020636060807418393737258696352569345621488958094856305865603100885838672591764072157183336139243588435583104423268921439473113244493821692560960443688048994557463526099985303667243623711454841573922233051289561865599722004107134302070301237345400354257869
dp = 734763139918837027274765680404546851353356952885439663987181004382601658386317353877499122276686150509151221546249750373865024485652349719427182780275825
temp = dp*e
for i in range(1,e) :
if (temp-1)%i==0:
x = (temp-1)//i+1
y = n%x
if y==0:
p=x
break
q = n//p #'//'代表向下取整,'/'得到的是浮点数
d = gmpy2.invert(e,(p-1)*(q-1))
key = rsa.PrivateKey(n,e,d,p,q)
flag = pow(c,d,n)
print(binascii.unhexlify(hex(flag)[2:])) #unhexlify()的作用是返回16进制数对应的字符串