我正在嘗試做這個功課https://www.root-me.org/en/Challenges/Cryptanalysis/File-PKZIP當我寫一個函數來破解它。爲什麼pkzip接受兩個密碼?
import subprocess from time import sleep
file = open('/home/begood/Downloads/SecLists-master/Passwords/'
'rockyou-75.txt', 'r') lines = file.readlines() file.close() for line in lines:
command = 'unzip -P ' + line.strip() + ' /home/begood/Downloads/ch5.zip'
print command
p = subprocess.Popen(
command,
stdout=subprocess.PIPE, shell=True).communicate()[0]
if 'replace' in p:
print 'y\n'
sleep(1)
它停在密碼= scooter
:
unzip -P scooter /home/begood/Downloads/ch5.zip replace readme.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename:
,但是當我用它來解壓縮它說:
inflating: /home/begood/readme.txt
error: invalid compressed data to inflate
它真正的密碼是:14535
。爲什麼pkzip接受兩個密碼?
看起來像是在RSA的填充Oracle攻擊! – Mr2uang