Wi-Fi SSID详细信息 [英] Wi-Fi SSID detail

查看:1476
本文介绍了Wi-Fi SSID详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

netsh wlan show profiles > profile.txt
for /f "skip=9" token=2 delims=:" %i in (profile.txt) do set "var=%i"
netsh wlan show profile name=%var% key=clear

现在,如果仅存在一个SSID,此命令将起作用,它将显示该SSID的所有详细信息.但是,如果有多个SSID,则它将显示最后一个SSID的详细信息.

now this command works if only one SSID is there, it shows all the details of that SSID. But if more than one SSID is there than it shows the detail of the last one SSID.

如何更改代码以一次获取所有SSID详细信息.

How to change the code to get all the SSID detail at once.

推荐答案

首先,您应该在管理员权限下执行此批处理,以在清除模式下显示所有密码.

First of all, you should execute this batch under admin rights to show all the passwords in clear mode.

第二个解决您的问题的方法,您应该像下面的代码一样将数据填充到数组中:

Second to solve your issue , you should populate your data into array like this code below :

@echo off & setlocal enabledelayedexpansion & color 0A
Title %~n0 to get SSID With details
::::::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights ::
::::::::::::::::::::::::::::::::::::::::::::
Set TmpLogFile=%tmp%\TmpLog.txt
If Exist %TmpLogFile% Del %TmpLogFile%
REM  --> Check for permissions
Reg query "HKU\S-1-5-19\Environment" >%TmpLogFile% 2>&1
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
Echo.
ECHO                      ****************************************
ECHO                      ^| Running Admin shell... Please wait...^|
ECHO                      ****************************************

    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
Set "TmpLog=%~dp0%~n0_Tmp.txt"
Set "Log=%~dp0%~n0.txt"
If Exist "%TmpLog%" Del "%TmpLog%"
If Exist "%Log%" Del "%Log%"
rem Populate the array
Set i=0
for /f "skip=1 tokens=2 delims=:" %%a in ('netsh wlan show profiles ^|find /i "Profil"') do (
    set /A i+=1
    set "list[!i!]=%%a"
)
set SSID=%i%
rem Display array elements for SSID List
cls
for /L %%i in (1,1,%SSID%) do (
    echo(
    echo SSID number %%i: "!list[%%i]:~1!!" 
    echo(
)
pause
rem Display array elements for SSID List with details
cls
for /L %%i in (1,1,%SSID%) do (
    echo(
    echo SSID number %%i: "!list[%%i]:~1!!" 
    echo(
    netsh wlan show profiles "!list[%%i]:~1!!" key=clear
    netsh wlan show profiles "!list[%%i]:~1!!" key=clear >> "%TmpLog%"
)
Cmd /U /C Type "%TmpLog%" > "%Log%"
If Exist "%TmpLog%" Del "%TmpLog%"
Start "" "%Log%"
pause
exit /b

另一个批处理文件,显示所有SSID及其密码:

Another batch file to show all your SSID with their passwords :

@echo off & setlocal enabledelayedexpansion
Title  WiFi Password Recovery
Mode con cols=70 lines=20
cls & color 0A & echo.
ECHO                  **************************************
echo                         WiFi Password Recovery
ECHO                  **************************************
echo.
if _%1_==_payload_  goto :payload

:getadmin
    echo                    %~nx0: elevating self
    set vbs=%temp%\getadmin.vbs
    echo Set UAC = CreateObject^("Shell.Application"^)                >> "%vbs%"
    echo UAC.ShellExecute "%~s0", "payload %~sdp0 %*", "", "runas", 1 >> "%vbs%"
    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
goto :eof

:payload
echo                        "SSID" ====^> "Password"
echo "SSID" ====^> "Password" > "%~dp0PassWifi.txt"
for /f "delims=: tokens=1,2" %%a in ('netsh wlan show profiles') do (
    if not "%%b"=="" (
        set ssid=%%b
        set ssid=!ssid:~1!
        call :getpass "!ssid!"
    )
)
del %temp%\tmp.txt
echo.
echo.
echo Done
If Exist "%~dp0PassWifi.txt" start "" "%~dp0PassWifi.txt"
pause>nul
exit /b

:getpass %1
set name=%1
set name=!name:"=!
netsh wlan show profiles %1 key=clear |find ":" > %temp%\tmp.txt
for /f "delims=: tokens=1,2" %%a in (%temp%\tmp.txt) do set passwd=%%b
set passwd=!passwd:~1!
echo                 "!name!" ====^> "!passwd!"
echo "!name!" ====^> "!passwd!" >> "%~dp0PassWifi.txt"
exit /b

这篇关于Wi-Fi SSID详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆