Skip to content

Instantly share code, notes, and snippets.

@Trimad
Last active April 28, 2022 16:29
Show Gist options
  • Save Trimad/1829b942568540b704b9ec21cfe99279 to your computer and use it in GitHub Desktop.
Save Trimad/1829b942568540b704b9ec21cfe99279 to your computer and use it in GitHub Desktop.
Dump WiFi Passwords
# Tristan Madden
# 2022-04-11
# trimad.github.io
$cmd= @(netsh wlan show profile)
$profiles = @()
foreach ($line in $cmd)
{
$skip = 27
if($line -Match "All User Profile")
{
$line = $line.SubString($skip, $line.Length-$skip)
$profiles += $line
}
}
$output = foreach ($profile in $profiles)
{
$skip = 29
$info = @(netsh wlan show profile $profile key=clear)
foreach ($line in $info)
{
if($line -Match "Key Content")
{
New-Object -TypeName PSObject -Property @{
SSID = $profile
Password = $line.SubString($skip, $line.Length-$skip)
}
}
}
}
$output | Export-Csv output.csv -NoTypeInformation
Invoke-Item "output.csv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment