Slide 28
Slide 28 text
全候補について復号を試行
28
import base64
from Crypto.Cipher import AES
def decrypt(SID, ciphertext):
IV = SID[:16]
KEY = SID[len(SID)-16:]*2
return AES.new(KEY, AES.MODE_CBC, IV).decrypt(ciphertext)
if __name__=='__main__':
sid = 0x0105000000000005150000009a54b0afcd26c4824b70f4b0e8030000
sid = sid.to_bytes(28, 'big')
iv = sid[:16]
key = sid[28 - 16 :28] * 2
aes = AES.new(key, AES.MODE_CBC, iv)
f = open('base64_all_filtered.txt', 'r')
g = open(‘decrypt.txt’, 'wb')
while True:
cipher_base64 = f.readline()[:-1] # remove '¥n'
if cipher_base64 == ‘’:
break
try:
cipher = base64.b64decode(cipher_base64)
plaintext = aes.decrypt(cipher)
g.write(plaintext)
except:
continue
f.close()
g.close()
input('[end]')