代码:
import zipfile
def zipfileExtract(loadzip, passwd):
try:
loadzip.extractall(pwd=passwd.encode())
except Exception as e:
pass
else:
return 1
def main(rangeN, bit):
loadzip = zipfile.ZipFile('banner.zip')
for passwd in range(rangeN + 1):
passwd = str(passwd)
if zipfileExtract(loadzip, passwd):
print("You find pwd, {}".format(passwd))
exit(0)
if __name__ == '__main__':
main(1000000, 6)
只是说明zipfile怎么用