这题算得上是python的使用
破解压缩包:
from threading import Thread from unrar import rarfile def CreatePwd(): f = open('passdict.txt', 'w') for id in range(10000): password = str(id).zfill(4) + ' ' f.write(password) f.close() def get_pwd(dict_path): with open(dict_path, 'r') as f: for pwd in f: yield pwd.strip() def decode_rar(fp, pwd, extract_path): try: fp.extractall(extract_path, pwd=pwd) except: pass # print('【ERROR】', pwd) else: print('the pwd is>', pwd) def main(): extract_path = './flag.txt' dict_path = './passdict.txt' filename = './1.rar' fp = rarfile.RarFile(filename) pwds = get_pwd(dict_path) '''使用多线程可提高速度''' # for pwd in pwds: # decode_rar(fp, pwd, extract_path) for pwd in pwds: t = Thread(target=decode_rar, args=(fp, pwd, extract_path)) t.start() if __name__ == '__main__': main()
解码:
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 >>>import base64 >>>a='ZmxhZ3s3MDM1NDMwMGE1MTAwYmE3ODA2ODgwNTY2MWI5M2E1Y30=' >>>v = base64.b64decode(a.encode('utf-8')).decode('utf-8') >>>v 'flag{70354300a5100ba78068805661b93a5c}'
参考:
https://blog.csdn.net/weixin_43873887/article/details/87862831