chrysanthemum

这题算得上是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) + \'\n\'
        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

分类:

技术点:

相关文章:

  • 2019-08-12
  • 2021-11-26
  • 2022-01-17
  • 2021-05-25
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
猜你喜欢
  • 2021-10-14
  • 2021-10-23
  • 2022-01-23
  • 2021-08-28
  • 2021-12-20
  • 2022-12-23
  • 2021-12-23
相关资源
相似解决方案