tobozo / WUD-Ducky

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

Uploading files to SD card #6

Closed Ciph3rCat closed 7 months ago

Ciph3rCat commented 2 years ago

Although I'm having problem in mounting SD card which is explained in other ticket. The upload functionality works fine for internal storage. We can upload files from the device which is connected using wifi.

My question is, how can we upload files from the system where this device is connected?

Hopefully question is clear but let me know, if you want an example or more elaboration.

tobozo commented 2 years ago

I've disabled uploading to the SD Card, it worked but isn't stable as it creates two copies of the file allocation table and marks the partition as dirty.

Uploading is temporarily limited to SPIFFS until I find a way to solve that.

The SD Card can still be written to from the ESP as long as the pendrive isn't mounted on the OS side, however the USB driver doesn't offer a soft-restart option for USBMSC and espressif's SD Card driver does not implement the repair option :wink:.

Uploading from the system:

1) HTTP upload from a client using WiFi AP, STA or USB RNDIS (work in progress). Note: limited to SPIFFS. 2) Ducky sh/PowerShell command to write from OS to mounted USBPendrive. Note: requires to know the volume name and/or drive letter. 3) USBSerial encoded transfer. Note: requires to know the com port and implement a decoder.

Points 1) and 2) are already achievable provided SetSSID_STA your-router-ssid and SetPassword_STA your-router-password are set, or the target OS can join the WiFiAP, thus making the upload endpoint reachable.

No security whatsoever is implemented on the webserver though, using WiFi STA option also opens access to all WUD functionalities for anyone on the network.

Ciph3rCat commented 2 years ago

As you mentioned, SD card can still be written directly from esp without mounting. Any direction for that?

I tried to set ssid and password using the way you specified but results in error.

SetSSID_STA "router-ssid" 
SetPASSWORD_STA "password" 

I tried to pass within () like method parameters on two locations, inside InitWifiAP method and right above this function. What I'm missing?

tobozo commented 2 years ago

Quotes aren't necessary when setting the ssid/password.

Also the WUD needs to be restarted after setting those because all SetSSID_STA / SetPASSWORD_STA do is saving the information in NVS.

As you mentioned, SD card can still be written directly from esp without mounting. Any direction for that?

Well don't mount the SD card from the OS, and use SD.open, SD.read, SD.write as usual.

Ciph3rCat commented 2 years ago

Thanks for the SD card tip, I'll try that.

I'm getting error: "SetSSID_STA does not name a type" when try to set without quotes. I added two lines on line 173 in WUD-Ducky.ino.

tobozo commented 2 years ago

oh you're trying to edit the variables in the .h file; but those are only the default values for the access point and aren't meant to be edited.

You should leave the code unchanged and use a ducky command from the serial window or the web ui instead.

The SSID/pass to your router will persist in NVS, there's no need to edit anything.

Ciph3rCat commented 2 years ago

I'm still unable to establish serial connection, I've created ticket on espressif gitter channel and waiting for some response. So, I've only web-ui option available. I don't see admin or any appropriate endpoint for that?

tobozo commented 2 years ago

Since the WUD uses ducky commands for everything including system operations, it seemed legit to use the quack form to administer it.

image

tobozo commented 7 months ago

closing this as inactive, feel free to reopen if the problem persists