Guest User

Updated unfactor.py for TeslaCrack

a guest
Dec 14th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from Crypto.Cipher import AES
  2. import binascii
  3.  
  4. primes = [  # these are example values, replace them with the primes you get from msieve!
  5.      1,
  6.      2,
  7.      3,
  8.      4,
  9.      5,
  10.      6,
  11.      7,
  12.      8,
  13.      9,
  14.      10,
  15. ]
  16.  
  17. magic = '%PDF'  # for a pdf file - change to the correct file magic if your sample.vvv is not a pdf
  18.  
  19. iv = b'\x27\x51\x0A\xBF\x31\x8D\x69\x26\x17\x78\x97\x2B\x98\x7D\xF6\x9F'
  20.  
  21. with open("sample.vvv", "rb") as f:
  22.         header = f.read(414)
  23.     data = f.read(16)
  24.     for i in xrange(1<<len(primes)):
  25.         x = 1
  26.         for j in xrange(len(primes)):
  27.             if i & 1<<j:
  28.                 x *= primes[j]
  29.         if 1<<224 < x < 1<<256 and AES.new(binascii.unhexlify('%064x' % x), AES.MODE_CBC, iv).decrypt(data).startswith(magic):
  30.             print hex(x).upper() + " " + AES.new(binascii.unhexlify('%064x' % x), AES.MODE_CBC, iv).decrypt(data)
Add Comment
Please, Sign In to add comment