ALPHACON BBSGość · pl
← Protipy

Protipy / PowerShell

(netsh wlan show profiles)|%{$n=(""+($_ -split ":")[1]).trim(); netsh wlan show profile name="$n" key=clear}|sls "Key Content","SSID name" - hasła WiFi na tacy

(netsh wlan show profiles)|%{$n=(""+($_ -split ":")[1]).trim(); netsh wlan show profile name="$n" key=clear}|sls "Key Content","SSID name"

Wstęp

Ten w sumie przydługway oneliner wyświetli listę sieci WiFi razem z zapisanymi hasłami. Wykorzystuje on Windowsowe polecenie netsh w celu wyświetlenia nazwy wszystkich profili:

netsh wlan show profiles

po których następnie iterujemy i pobieramy z każdego hasło podając key=clear:

netsh wlan show profile name="$_" key=clear

Na samym końcu wybieramy tylko te linijki, które zawierają nazwę sieci (SSID name) oraz hasło (Key Content) dzięki sls, który jest aliasem na Select-String.