{"id":399,"date":"2024-10-20T01:39:32","date_gmt":"2024-10-19T17:39:32","guid":{"rendered":"http:\/\/39.104.51.85\/?p=399"},"modified":"2024-10-20T01:39:33","modified_gmt":"2024-10-19T17:39:33","slug":"misc%e8%84%9a%e6%9c%ac%e6%94%b6%e9%9b%86-%e7%88%86%e7%a0%b4%e7%af%87","status":"publish","type":"post","link":"http:\/\/blogbo.cn\/index.php\/2024\/10\/20\/misc%e8%84%9a%e6%9c%ac%e6%94%b6%e9%9b%86-%e7%88%86%e7%a0%b4%e7%af%87\/","title":{"rendered":"MISC\u811a\u672c\u6536\u96c6\u2014\u2014\u7206\u7834\u7bc7"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u751f\u6210\u5bc6\u7801\u5b57\u5178\u7684\u811a\u672c<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import itertools as its\n\n# words = 'abcdefghijklmnopqrstuvwxyz1234567890'\nwords='1234567890'\nr = its.product(words, repeat=6)  # repeat\u8981\u751f\u6210\u591a\u5c11\u4f4d\u7684\u5b57\u5178\nwith open(\"pwd.txt\", \"a\")as f:\n\tfor i in r:\n\t\tf.write(\"\".join(i))\n\t\tf.write(\"\".join(\"\\r\"))\nprint(\"\u5df2\u4fdd\u5b58\u4e3apwd.txt\")<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u7206\u7834zip\u5bc6\u7801\u7684\u811a\u672c<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import zipfile\n# from unrar import rarfile\nimport threading\n\n# \u5224\u65ad\u7ebf\u7a0b\u662f\u5426\u9700\u8981\u7ec8\u6b62\nflag = True\n\n\ndef extract(password, file):\n    try:\n        password = str(password)\n        file.extractall(pwd=password.encode('utf-8'))  # zip\u89e3\u538b\u7f29\n        # file.extractall(pwd=password)#rar\u89e3\u538b\u7f29\n        print(\"\u538b\u7f29\u5305\u7684\u5bc6\u7801\u662f\uff1a{}\".format(password))\n        global flag\n        flag = False\n    except Exception:\n        pass  # \u5bc6\u7801\u9519\u8bef\u5219\u8df3\u8fc7\n\n\ndef main():\n    file = zipfile.ZipFile(\".\/\u5b66\u4e60\u8d44\u6599\u554a.zip\")  # \u538b\u7f29\u6587\u4ef6\n    # file = rarfile.RarFile(\"pwd.rar\")\n    passwords = open('pwd.txt')  # \u5bc6\u7801\u5b57\u5178\n    for line in passwords.readlines():  # \u9010\u884c\u8bfb\u53d6\u5bc6\u7801\n        if flag is True:\n            password = line.strip('\\n')  # \u53bb\u6389\u56de\u8f66\n            print(line, end=\"\")  # \u9010\u4e2a\u67e5\u770b\u5f53\u524d\u5bc6\u7801\n            t = threading.Thread(target=extract, args=(password, file))\n            t.start()  # \u5f00\u59cb\n            t.join()  # Parent\u7236\u7ebf\u7a0b\u4f1a\u7b49\u5f85child\u5b50\u7ebf\u7a0b\u8fd0\u884c\u5b8c\u518d\u7ee7\u7eed\u8fd0\u884c\n\n\nif __name__ == '__main__':\n    main()\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u751f\u6210\u5bc6\u7801\u5b57\u5178\u7684\u811a\u672c \u7206\u7834zip\u5bc6\u7801\u7684\u811a\u672c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-399","post","type-post","status-publish","format-standard","hentry","category-misc"],"_links":{"self":[{"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/posts\/399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/comments?post=399"}],"version-history":[{"count":1,"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":400,"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/posts\/399\/revisions\/400"}],"wp:attachment":[{"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/media?parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/categories?post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blogbo.cn\/index.php\/wp-json\/wp\/v2\/tags?post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}