tobozo / WUD-Ducky

An ESP32-S2 RubberDucky script parser, with Mouse/PenDrive support 🦆
MIT License
116 stars 15 forks source link

Help needed - SD card, Bootloader mode & run payload #15

Open j0mand opened 2 years ago

j0mand commented 2 years ago

Hi, I don't know if it is an issue or just my limited understanding. But, as there is no other help available, I would like to ask for your support here.

I use Cactus WHID and inserted SD card. I use WUD-Ducky for esp32-3.0.2-RC1.

  1. SD Card Even though reading through all articles here, I don't find a way to get SD card working in visible in Windows Explorer as USB drive. What am I missing / doing wrong? Do I need to adapt the code even?
  2. Bootloader mode I put WHID in Bootloader mode using magnet for hall sensor and reset button. I manage to upload the sketch. However, whenever I put the USB stick in any PC, it starts in bootloader mode. I have to press reset button before it starts correctly. How could I change?
  3. Run Payload automatically I would like to simulate autostart functionality. What do I need to do to provide a payload that starts automatically?

Please apologize if the topics would be misplaced here. Happy to get in contact with you (i.e., anybody who could support me) otherwise.

tobozo commented 2 years ago

hey @j0mand

  1. SD Card not visible in Windows Explorer

SD may fail on some Windows laptops, but I suspect it's more a consequence of another USB descriptor failing to load. Since USB-CDC is supposedly disabled it can either be the keyboard or the mouse conflicting with an existing hybrid HID device (e.g. touchpad).

USBView may help identify the conflict.

whenever I put the USB stick in any PC, it starts in bootloader mode. I have to press reset button before it starts correctly.

Sounds like you did not remove the magnet from the hall sensor after flashing?

If you have to flash the WUD repeatedly I suggest you setup a ssid/pwd for the STA mode and use Arduino OTA update methode instead.

Setting up the ssid/pass can be done as a Ducky command:

SetSSID_STA your_router_ssid SetPassword_STA your_router_pass

Run Payload automatically

This is in the roadmap and needs a few problems solved (logging race condition, SD mount/unmount detection) before implementation starts.

If you want to experiment, you can add this at the end of the setup() function:

   runpayload( SPIFFS, "/your_payload_file.quack.txt" );
bomberman8 commented 7 months ago

'SPIFFS' was not declared in this scope :S

Sorry, I'm sure the solution is obvious, but I swear I've been trying to figure it out for a while.

tobozo commented 7 months ago

@bomberman8 try LittleFS instead of SPIFFS

tobozo commented 7 months ago

@bomberman8

Is there a way to set the default keyboard language so you don't have to change it every time?

a quick&dirty solution is to add this at the end of setup():

duckparser::parse( "LOCALE ES" ); // available language codes are in WiFiDuck/keyboard.cpp

a more comprehensive integration is to make the locale persistent using prefs::set() and prefs::get()

// called from setup()
char locale[8];
prefs::get( "locale", locale, 7, "US" ); // "US" is default if no pref exists, max 7 letters
String command = String("LOCALE ") + String(locale);
duckparser::parse( command.c_str() );
// WiFiDuck/keyboard.cpp
#include "keyboard.hpp"
#include "prefs.hpp" // <<<< add this include

namespace keyboard
{
  // modify setLocale() 
  void setLocale( hid_layout_t* layout )
  {
    locale     = layout->locale;
    localecode = layout->code;
    prefs::set("locale", layout->locale ); // <<< add this line
  }

  // ......

}