Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch wifi password recover  (Read 13429 times)

0 Members and 1 Guest are viewing this topic.

zask

    Topic Starter


    Intermediate

    • Experience: Experienced
    • OS: Other
    Batch wifi password recover
    « on: December 10, 2015, 01:59:02 PM »
    i took this command to grab a profile and place its name in a variable

    for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do set "profile=%%A"
    now i added this to the next line;

    netsh wlan show profiles "%profile%" key=clear
    then something that says "key content" (must be administrator) should appear with a wifi password next to it, how do i get that password to also go into a variable? i tried doing something like this but it just displays the word "such" for some strange reason...

    for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do set "profile=%%A
    for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles "%profile%" key=clear') do set "profile2=%%A"

    echo %profile2%
    thanks... :)

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Batch wifi password recover
    « Reply #1 on: December 10, 2015, 03:58:29 PM »
    zask, please read over the forum rules.

    The forum will not help with batch files that find passwords of other people on a local network.

    Also, if you are indeed the administrator of a domain server, you already have tools to implement a policy that would let you have the passwords.

    NOTE: to moderator. This topic should be closed.


    zask

      Topic Starter


      Intermediate

      • Experience: Experienced
      • OS: Other
      Re: Batch wifi password recover
      « Reply #2 on: December 10, 2015, 04:18:13 PM »
      I know this, look everyone keeps saying that blah blah blah rules and such but i actually need this code for my own personal use, the question doesn't even imply anything to do with stealing a password, it's obvious that i already know you can steal a password just by saying "netsh wlan show profiles <profile> key=clear. im not asking how to steal a password, im asking how do i place the that password in a text file. 

      zask

        Topic Starter


        Intermediate

        • Experience: Experienced
        • OS: Other
        Re: Batch wifi password recover
        « Reply #3 on: December 10, 2015, 04:30:22 PM »
        okay lets say with was with any random command that when typed in it displayed content in a prompt, how do i put that content in a text file. does that sound less malicious? the question im asking can imply with any command, not just stealing some password, even if it did grab a password, in order for the profile that has that password to even appear you would have to type its password in anyway the first place, eliminating the possibilities for someone to hack. trust me if you just used the command you would understand that its not intended to steal random peoples passwords

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Batch wifi password recover
        « Reply #4 on: December 10, 2015, 04:33:17 PM »
        I agree that's it's merely an issue of parsing the text in a for /f command.

        The problem will be in the delims= and tokens= items.

        To give you accurate commands I'd need to see the form that the screen output takes.
        Not any passwords but the spaces and number of words and special characters etc.

        I get this here as i don't have wireless so I can't test it - and the OS version can change the output.

        c:\>netsh wlan show profiles
        The Wireless AutoConfig Service (wlansvc) is not running.


        zask

          Topic Starter


          Intermediate

          • Experience: Experienced
          • OS: Other
          Re: Batch wifi password recover
          « Reply #5 on: December 10, 2015, 05:00:48 PM »
          okay i will try to explain,  when i type "netsh wlan show profiles" i get an output stating this~

          Profiles on interface Wi-Fi:

          Group policy profiles (read only)
          ---------------------------------
              <None>

          User profiles
          -------------
              All User Profile     : Zask.router

          I created a command that took the current context (which is "Zask.router"; only works in administrator mode) and puts it in a variable named %profile%. that command looks like this~

          for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do set "profile=%%A

          when you type this command you get a output thats similar to this~

          Profile Zask.router on interface Wi-Fi:
          =======================================================================

          Applied: All User Profile   

          Profile information
          -------------------
              Version                : 1
              Type                   : Wireless LAN
              Name                   : Zask.router
              Control options        :
                  Connection mode    : Connect automatically
                  Network broadcast  : Connect only if this network is broadcasting
                  AutoSwitch         : Do not switch to other networks
                  MAC Randomization  : Disabled

          Connectivity settings
          ---------------------
              Number of SSIDs        : 1
              SSID name              : "Zask.router"
              Network type           : Infrastructure
              Radio type             : [ Any Radio Type ]
              Vendor extension          : Not present

          Security settings
          -----------------
              Authentication         : WPA2-Personal
              Cipher                 : CCMP
              Security key           : Present
              Key Content            : Pokemonblack

          CONTENT      ^      PASSWORD ^^^^^^^^^^^^
          (LOOK HERE!) |_______________||||||||||||
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX

          Cost settings
          -------------
              Cost                   : Unrestricted
              Congested              : No
              Approaching Data Limit : No
              Over Data Limit        : No
              Roaming                : No
              Cost Source            : Default


          Profile Zask.router on interface Wi-Fi:
          =======================================================================

          Applied: All User Profile   

          Profile information
          -------------------
              Version                : 1
              Type                   : Wireless LAN
              Name                   : Zask.router
              Control options        :
                  Connection mode    : Connect automatically
                  Network broadcast  : Connect only if this network is broadcasting
                  AutoSwitch         : Do not switch to other networks
                  MAC Randomization  : Disabled

          Connectivity settings
          ---------------------
              Number of SSIDs        : 1
              SSID name              : "Zask.router"
              Network type           : Infrastructure
              Radio type             : [ Any Radio Type ]
              Vendor extension          : Not present

          Security settings
          -----------------
              Authentication         : WPA2-Personal
              Cipher                 : CCMP
              Security key           : Present

          Cost settings
          -------------
              Cost                   : Unrestricted
              Congested              : No
              Approaching Data Limit : No
              Over Data Limit        : No
              Roaming                : No
              Cost Source            : Default

          Notice the context named Key Content? see where it shows the password in the prompt beside it? how do i grab that password and put it in a variable like when i grabbed the current Profile and put it in a variable from the last command? thank you. :P and no this isn't my real password or router profile~ lol that would be dumb



          « Last Edit: December 10, 2015, 05:14:59 PM by zask »

          zask

            Topic Starter


            Intermediate

            • Experience: Experienced
            • OS: Other
            Re: Batch wifi password recover
            « Reply #6 on: December 10, 2015, 05:02:53 PM »
            is this what your asking for?

            zask

              Topic Starter


              Intermediate

              • Experience: Experienced
              • OS: Other
              Re: Batch wifi password recover
              « Reply #7 on: December 10, 2015, 05:06:13 PM »
              I agree that's it's merely an issue of parsing the text in a for /f command.

              The problem will be in the delims= and tokens= items.

              To give you accurate commands I'd need to see the form that the screen output takes.
              Not any passwords but the spaces and number of words and special characters etc.

              I get this here as i don't have wireless so I can't test it - and the OS version can change the output.

              c:\>netsh wlan show profiles

              The Wireless AutoConfig Service (wlansvc) is not running.


              can you be more specific of what your looking for?  do you mean the output of the command i typed in, because that's stated in the comment above.

              foxidrive



                Specialist
              • Thanked: 268
              • Experience: Experienced
              • OS: Windows 8
              Re: Batch wifi password recover
              « Reply #8 on: December 12, 2015, 03:45:33 AM »
              Apologies, I didn't return until now. Thanks for the sample data,
              and based on that then this should work, give it a test.

              If there are TAB characters in the output then TAB will need to be added to the "delims=: " section in the 3rd line.

              The equals sign needs an escape character as it is treated as whitespace in an unquoted command line, and your attempt may have been showing a word from the error message rather than from the command output.

              This can be unreliable as the text you are searching for can contain % characters, which is a poison character for batch scripts.

              Code: [Select]
              @echo off
              for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do (
                 for /f "tokens=2,* delims=: " %%B in ('netsh wlan show profiles "%%A" key^=clear ^| find /i "Key Content" ') do set "pw=%%C"
              )
              echo "%pw%"
              pause

              foxidrive



                Specialist
              • Thanked: 268
              • Experience: Experienced
              • OS: Windows 8
              Re: Batch wifi password recover
              « Reply #9 on: December 12, 2015, 04:05:34 AM »
              please read over the forum rules.

              Apologies Geek,

              Looking at the forum rules, it says "No help with stealing or otherwise obtaining another user's password."

              It's not up to me to interpret the aim of this thread, or how it can be misused by future readers, so I'll leave it to the mods to do as they feel is right.

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: Batch wifi password recover
              « Reply #10 on: December 12, 2015, 05:19:09 AM »
              The commands the OP is requesting assistance with do none of the things Geek erroneously described it as doing. The common request for help with a script deleting files and folders is probably worthy of more consideration when it comes to wondering how something may be misused. it provides no user passwords whatsoever.

              The commands listed do not feature a security risk because they do not give the user any more information than they could easily get with the Windows UI.

              Basically, what it does is let you see saved profile information. For example, when you connect to a wireless network, you can select to have Windows Remember the wifi passphrase. This is stored locally, and it is this saved passphrase that is made available via this command- if the passphrase is not saved, it cannot be retrieved in this manner even if the system is actively connected to the access point. This functionality can also be accessed via the Network and Sharing Center (click the Access point, choose Wireless properties, and check off the "Show passphrase" checkbox).
              I was trying to dereference Null Pointers before it was cool.

              zask

                Topic Starter


                Intermediate

                • Experience: Experienced
                • OS: Other
                Re: Batch wifi password recover
                « Reply #11 on: December 12, 2015, 04:15:53 PM »
                The commands the OP is requesting assistance with do none of the things Geek erroneously described it as doing. The common request for help with a script deleting files and folders is probably worthy of more consideration when it comes to wondering how something may be misused. it provides no user passwords whatsoever.

                The commands listed do not feature a security risk because they do not give the user any more information than they could easily get with the Windows UI.

                Basically, what it does is let you see saved profile information. For example, when you connect to a wireless network, you can select to have Windows Remember the wifi passphrase. This is stored locally, and it is this saved passphrase that is made available via this command- if the passphrase is not saved, it cannot be retrieved in this manner even if the system is actively connected to the access point. This functionality can also be accessed via the Network and Sharing Center (click the Access point, choose Wireless properties, and check off the "Show passphrase" checkbox).

                Thank you for the support :P

                zask

                  Topic Starter


                  Intermediate

                  • Experience: Experienced
                  • OS: Other
                  Re: Batch wifi password recover
                  « Reply #12 on: December 12, 2015, 04:19:30 PM »
                  Apologies, I didn't return until now. Thanks for the sample data,
                  and based on that then this should work, give it a test.

                  If there are TAB characters in the output then TAB will need to be added to the "delims=: " section in the 3rd line.

                  The equals sign needs an escape character as it is treated as whitespace in an unquoted command line, and your attempt may have been showing a word from the error message rather than from the command output.

                  This can be unreliable as the text you are searching for can contain % characters, which is a poison character for batch scripts.

                  Code: [Select]
                  @echo off
                  for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do (
                     for /f "tokens=2,* delims=: " %%B in ('netsh wlan show profiles "%%A" key^=clear ^| find /i "Key Content" ') do set "pw=%%C"
                  )
                  echo "%pw%"
                  pause
                  d

                  do I Add TAB before the delims? Thank you.

                  zask

                    Topic Starter


                    Intermediate

                    • Experience: Experienced
                    • OS: Other
                    Re: Batch wifi password recover
                    « Reply #13 on: December 12, 2015, 04:28:03 PM »

                    patio

                    • Moderator


                    • Genius
                    • Maud' Dib
                    • Thanked: 1769
                      • Yes
                    • Experience: Beginner
                    • OS: Windows 7
                    Re: Batch wifi password recover
                    « Reply #14 on: December 12, 2015, 05:14:17 PM »
                    Perfect...
                    " Anyone who goes to a psychiatrist should have his head examined. "