How to grab Wifi passwords with only 2 commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • techsxge
    Senior Tech

    Site Contributor
    500+ Posts
    • Jan 2022
    • 660

    #31
    Re: How to grab Wifi passwords with only 2 commands

    So to wrap it up since i uploaded multiple script versions here that you could use:

    For Linux Distros using NetworkManager (Ubuntu, Debian etc.)
    Run as .py or .txt file (lol)

    Code:
    import subprocess
    
    
    try:
        # Get a list of active Wi-Fi connections
        wifi_profiles_info = subprocess.check_output(['nmcli', '-t', '-f', 'NAME', 'connection', 'show', '--active']).decode('utf-8')
        wifi_profiles = wifi_profiles_info.strip().split('\n')
    
    
        if wifi_profiles:
            print("Available Wi-Fi networks:")
            for index, profile in enumerate(wifi_profiles, start=1):
                print(f"{index}. {profile}")
    
    
            selection = int(input("Select a Wi-Fi network (enter the number): ")) - 1
            selected_profile = wifi_profiles[selection]
    
    
            wifi_password_info = subprocess.check_output(['nmcli', '-s', '-g', '802-11-wireless-security.psk', 'connection', 'show', selected_profile]).decode('utf-8')
            wifi_password = wifi_password_info.strip()
    
    
            print(f"Wi-Fi network: {selected_profile}")
            print(f"Password: {wifi_password}")
    
    
        else:
            print("No Wi-Fi networks found.")
    except (ValueError, IndexError):
        print("Invalid selection or no Wi-Fi network selected.")
    For Windows Users (Win 7, 10, 11)

    Code:
    $wifiProfiles = netsh wlan show profiles | Select-String "All User Profile" | ForEach-Object { $_ -replace "All User Profile\s+:\s+" }
    
    
    $selectedProfile = $wifiProfiles | Out-GridView -Title "Select a Wi-Fi network" -OutputMode Single
    
    
    if ($selectedProfile) {
        $wifiPassword = (netsh wlan show profile name="$selectedProfile" key=clear | Select-String "Key Content").ToString() -replace "Key Content\s+:\s+"
        
        Write-Host "Wi-Fi network: $selectedProfile"
        Write-Host "Password: $wifiPassword"
    } else {
        Write-Host "No Wi-Fi network selected."
    }
    Compiled as .exe:
    Release wifiPassword.ps1 compiled to .exe * vlc3n/FuckUrBatch * GitHub



    Comment

    • Tricky
      Field Supervisor

      Site Contributor
      2,500+ Posts
      • Apr 2009
      • 2620

      #32
      Re: How to grab Wifi passwords with only 2 commands

      Originally posted by techsxge
      Run as .py or .txt file (lol)
      If it works, why fix it?
      File extensions are not as critical as on Windows

      Comment

      • techsxge
        Senior Tech

        Site Contributor
        500+ Posts
        • Jan 2022
        • 660

        #33
        Re: How to grab Wifi passwords with only 2 commands

        Originally posted by skynet
        If it works, why fix it?
        File extensions are not as critical as on Windows
        i just find this funny for some reason, leave me alone

        Comment

        • Tricky
          Field Supervisor

          Site Contributor
          2,500+ Posts
          • Apr 2009
          • 2620

          #34
          Re: How to grab Wifi passwords with only 2 commands

          Originally posted by techsxge
          i just find this funny for some reason, leave me alone
          Well you learnt something, my laptop was a budget one 15 years ago, so you can imagine what Firefox is like now.
          So I copied the script in windows and transferred it to the laptop. So thats how it ended up .txt

          Comment

          Working...