-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdb_solve.py
15 lines (13 loc) · 2.42 KB
/
gdb_solve.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fractions import gcd
import binascii
def solve_private_keys(e, s, m, n):
p = gcd(pow(s, e)-m,n)
q = n//p
private_keys = [hex(p), hex(q)]
return private_keys
e = int("010001", 16)
# s = int("7BAFF51CA54182F5A70181B0EC1F8603C1A39324D5A2CB49422886AE1FFDB49E009AF19ABD7D772E199BEC3046690494134B75E1201E6856D99887DCA32DBB403CF99553678D458748AA43C90A387AD3FF767F7314BF05FC1880347072706809BF3BCBDB59EA54032E5485869E7063B3EFDA8C5A6D19D1A5B3B279F2E70AF90B4C2FE485856639273539EEE50B6232EFC9D75903884F315FC377D842F948088F7E259F36BD4FECD1EB770D8FB24CE66E945E57DDE29E3EF1FB327C675940BCEE04A70D18BDC74BDE31CC32894280E2722A19B7D5FE15474E9ED5DCD51C264C7F8FA13A5372698752AB0658D857181435B430D58746FA64BE492E8D3D7D9F33A2", 16) #you get this when you replace *0x6df4e0 with 0x8
m = int("0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff003031300d0609608648016503040201050004207e6bb673f061cfd23cba009e648143fb07ac77dcd1681f6a9af9d5fe7c0f7f4b", 16)
n = int("AE1EC41FDD978C18CB43F9587F9B85DF804603100611497DCB445D157E44E717C78D53FAC3644DEA302645F6CFF852A785C3DAEA525BE01A4B1960D6512D97C677436ED17D03A55DDD8E41D737456C2B1512D533806EB048C5570269CBDFABB5E335821CE69C892A825A3896FC46990A8F6FECC759DAD9D6FD76BBF55BAA34B0789CACE898B6CC8CDBB50A0BFE7073A31DAF0B67845F76B71D42942B03FC02D6D68789C6CEF502C39AA0FB392E5E84BD1581E7295BDF6C45463FEA20A5220413381B82A72F95B1BB29AC6E833B70EB5B9F9D43B4D56A94ECBD02C1CBC8C8EED903485BD2A379A8B81B8FE20216EE6019A5F19656A483CCD9C23EB3B17678050B", 16)
s = 6048232529457686177969401376962400063488041459930742448126231921318453589145846339827069795957707377356412190497632836672816328283714718415294819576013619263879841352328010372912925465209907456953989483858757672210769816523246879164723239381245653557154552120163093908794122262583131028503001069686925962426349725592661789866623160094320357088289341235485105905669688756982242410093060179910400723331349348672915725053901326111357414683377518577468409852678785581993823179469415205155815051079056437992185567931628547889050213840949568660812720371721600684362005874949231746113990353404990088831774533787440546993474
print solve_private_keys(e, s, m, n)