-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdb_solve_tq.py
15 lines (12 loc) · 1.41 KB
/
gdb_solve_tq.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 = [p, q]
return private_keys
e = int("010001", 16)
s = int("0C30066CB66F445BBA940D4A3A5B835081753177408B1A2F02CDE96349783EADEA0FB3C0B0F8F8B6B9BB50303690F6AC07EC34FDA5CB6D0095D4A13B38BBF3947194195764271ED1670C3395A550AB41D471A3BDC3219A4805A145BA524E6146FA266E53D4075AC6892357ACD9F96AC1A7851B162423BADE11D7F2B7AA78E93AEED58D2A97E68B7C6B329A3D40256DA86220057FBA09CBCD9357396B855F420CD1560DACEF0FAFD8B383EAFE9B204BF65FA7E55E872D7AE0AD4FD347D8CDA57BF69AEA5B5ABC6654A21C005591A765E1CE5D8C60DA21C5836497C231B25D49393ACB1169DB0E4A3FDE50FD328A88757B4C15F7AC9B3DE9B55D03D797166A81C2", 16) #you get this when you replace *0x6df4e0 with 0x8
m = int("3031300d0609608648016503040201050004207e6bb673f061cfd23cba009e648143fb07ac77dcd1681f6a9af9d5fe7c0f7f4b", 16)
n = int("AE1EC41FDD978C18CB43F9587F9B85DF804603100611497DCB445D157E44E717C78D53FAC3644DEA302645F6CFF852A785C3DAEA525BE01A4B1960D6512D97C677436ED17D03A55DDD8E41D737456C2B1512D533806EB048C5570269CBDFABB5E335821CE69C892A825A3896FC46990A8F6FECC759DAD9D6FD76BBF55BAA34B0789CACE898B6CC8CDBB50A0BFE7073A31DAF0B67845F76B71D42942B03FC02D6D68789C6CEF502C39AA0FB392E5E84BD1581E7295BDF6C45463FEA20A5220413381B82A72F95B1BB29AC6E833B70EB5B9F9D43B4D56A94ECBD02C1CBC8C8EED903485BD2A379A8B81B8FE20216EE6019A5F19656A483CCD9C23EB3B17678050B", 16)
print solve_private_keys(e, s, m, n)