How to grab Wifi passwords with only 2 commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slimslob
    Retired

    Site Contributor
    25,000+ Posts
    • May 2013
    • 37240

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

    Got a question, can either of them be used on a Mac?

    Comment

    • techsxge
      Senior Tech

      Site Contributor
      500+ Posts
      • Jan 2022
      • 660

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

      Originally posted by slimslob
      Got a question, can either of them be used on a Mac?
      nope.

      Comment

      • Tricky
        Field Supervisor

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

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

        Originally posted by techsxge
        yep, i updated my script to not use netsh. Saw this myself after uploading it... Now it uses nmcli
        I will try it, but my desktop doesn't have Wi-Fi, my laptop does, but I cleaned the keyboard last week, and now it just repeats a certain key, kind of difficult putting the password in. Ordered a new one last week.

        Comment

        • slimslob
          Retired

          Site Contributor
          25,000+ Posts
          • May 2013
          • 37240

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

          Originally posted by skynet
          I will try it, but my desktop doesn't have Wi-Fi, my laptop does, but I cleaned the keyboard last week, and now it just repeats a certain key, kind of difficult putting the password in. Ordered a new one last week.
          Win + Ctrl + O (the letter not the number) will turn on the On Screen Keyboard. It is a lot more convenient than an external key board. I have been using it for some time now because the i, y, l, the 0 on the ten key and the Enter key of the main key board quit working.

          Comment

          • techsxge
            Senior Tech

            Site Contributor
            500+ Posts
            • Jan 2022
            • 660

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

            Originally posted by slimslob
            Win + Ctrl + O (the letter not the number) will turn on the On Screen Keyboard. It is a lot more convenient than an external key board. I have been using it for some time now because the i, y, l, the 0 on the ten key and the Enter key of the main key board quit working.
            why dont you buy a bluetooth keyboard for like 10-15$? Thats even more convienent than clicking all the keys xD

            Comment

            • slimslob
              Retired

              Site Contributor
              25,000+ Posts
              • May 2013
              • 37240

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

              Originally posted by techsxge
              why dont you buy a bluetooth keyboard for like 10-15$? Thats even more convienent than clicking all the keys xD
              Not when you don't have room and setting it on top of the laptop keyboard often clicks the keys that are still working. Also the mouse pointer doesn't fat finger things like my hands do.

              Comment

              • Tricky
                Field Supervisor

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

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

                Originally posted by techsxge
                Updated this code as netsh is not available on linux, my bad
                Well my laptop keyboard turned up, Royal mail is a bit fucked up atm
                This is your script from page 2

                Code:
                skynet@ubuntu:~/Desktop$ python3 script.txt
                Error: invalid field 'SSID'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH,SLAVE.
                Traceback (most recent call last):
                  File "script.txt", line 4, in <module>
                    wifi_profiles_info = subprocess.check_output(['nmcli', '-t', '-f', 'SSID', 'connection', 'show', '--active']).decode('utf-8')
                  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
                    **kwargs).stdout
                  File "/usr/lib/python3.6/subprocess.py", line 438, in run
                    output=stdout, stderr=stderr)
                subprocess.CalledProcessError: Command '['nmcli', '-t', '-f', 'SSID', 'connection', 'show', '--active']' returned non-zero exit status 2.

                Comment

                • techsxge
                  Senior Tech

                  Site Contributor
                  500+ Posts
                  • Jan 2022
                  • 660

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

                  Originally posted by skynet
                  Well my laptop keyboard turned up, Royal mail is a bit fucked up atm
                  This is your script from page 2

                  Code:
                  skynet@ubuntu:~/Desktop$ python3 script.txt
                  Error: invalid field 'SSID'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH,SLAVE.
                  Traceback (most recent call last):
                    File "script.txt", line 4, in <module>
                      wifi_profiles_info = subprocess.check_output(['nmcli', '-t', '-f', 'SSID', 'connection', 'show', '--active']).decode('utf-8')
                    File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
                      **kwargs).stdout
                    File "/usr/lib/python3.6/subprocess.py", line 438, in run
                      output=stdout, stderr=stderr)
                  subprocess.CalledProcessError: Command '['nmcli', '-t', '-f', 'SSID', 'connection', 'show', '--active']' returned non-zero exit status 2.
                  Ok, i tried to fix this without being able to test it so please if you have some spare time try this one:

                  Code:
                  import subprocess
                  
                  
                  wifi_profiles_info = subprocess.check_output(['nmcli', '-t', '-f', 'NAME', 'connection', 'show', '--active']).decode('utf-8')
                  wifi_profiles = [line.strip() for line in wifi_profiles_info.split('\n')]
                  
                  
                  print("Available Wi-Fi networks:")
                  for index, profile in enumerate(wifi_profiles):
                      print(f"{index + 1}. {profile}")
                  
                  
                  selection = input("Select a Wi-Fi network (enter the number): ")
                  try:
                      selected_profile = wifi_profiles[int(selection) - 1]
                  except (ValueError, IndexError):
                      selected_profile = None
                  
                  
                  if selected_profile:
                      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 network selected.")

                  By the way, i did not knew that you can run .txt files as a python programm lol

                  Comment

                  • Tricky
                    Field Supervisor

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

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

                    Yes that works as expected.
                    Last edited by Tricky; 10-23-2023, 07:31 PM.

                    Comment

                    • techsxge
                      Senior Tech

                      Site Contributor
                      500+ Posts
                      • Jan 2022
                      • 660

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

                      Originally posted by skynet
                      Yes that works as expected.
                      Alright thank you for testing it out!

                      Comment

                      • Samir
                        Self-Taught
                        • Oct 2023
                        • 31

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

                        My solution to this problem has always been to just plug the machine into an ethernet jack. 50ft and 100ft ethernet cables are sold almost everywhere now, even the grocery store!

                        Comment

                        • slimslob
                          Retired

                          Site Contributor
                          25,000+ Posts
                          • May 2013
                          • 37240

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

                          Originally posted by Samir
                          My solution to this problem has always been to just plug the machine into an ethernet jack. 50ft and 100ft ethernet cables are sold almost everywhere now, even the grocery store!
                          And they are a major tripping hazard. Or do you like getting sued?

                          Comment

                          • Samir
                            Self-Taught
                            • Oct 2023
                            • 31

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

                            Originally posted by slimslob
                            And they are a major tripping hazard. Or do you like getting sued?
                            Not if you route them correctly.

                            Besides this was for our own businesses, so we always went with wired solutions. I always had my staple gun handy to route the wires.

                            Comment

                            • Tricky
                              Field Supervisor

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

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

                              Originally posted by techsxge
                              By the way, i did not knew that you can run .txt files as a python programm lol
                              I'm lazy

                              BTW I uploaded your code to ChatGPT, and it told me what it does, which I had an idea of anyway.

                              Comment

                              • techsxge
                                Senior Tech

                                Site Contributor
                                500+ Posts
                                • Jan 2022
                                • 660

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

                                Originally posted by skynet
                                I'm lazy

                                BTW I uploaded your code to ChatGPT, and it told me what it does, which I had an idea of anyway.
                                lmfao when you said the code does not work i turned to chatgpt and asked what arguments nmcli would take in regards to wlan networks and just replaced what sounded right without reading much xD

                                Comment

                                Working...