Skip to content

Commit

Permalink
Merge pull request #15 from i-am-shodan
Browse files Browse the repository at this point in the history
Adds support for ESP32-S2 devices
  • Loading branch information
i-am-shodan authored Oct 16, 2024
2 parents 9e2dd8a + 08d3d22 commit e256ffc
Show file tree
Hide file tree
Showing 25 changed files with 310 additions and 94 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ jobs:
run: pip install --upgrade platformio

- name: Build PlatformIO Project
run: pio run
- name: Upload artifact
run: pio run --environment LILYGO-T-Dongle-S3

- name: Upload LILYGO-T-Dongle-S3 artifacts
uses: actions/upload-artifact@v4
with:
name: Firmware binaries
name: LILYGO-T-Dongle-S3 Firmware binaries
path: .pio/build/LILYGO-T-Dongle-S3/*.bin

- name: Build PlatformIO Project
run: pio run --environment Generic-ESP32-S2

- name: Upload Generic-ESP32-S2 artifact
uses: actions/upload-artifact@v4
with:
name: Generic-ESP32-S2 Firmware binaries
path: .pio/build/Generic-ESP32-S2/*.bin
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ This project implements a variety of attacks based around an easily concealable

## Supported Hardware

| **LilyGo T-Dongle S3** | Supported |
| Hardware | Supported |
| ------------- | ------------- |
| ![screenshot](./docs/images/t-dongle-s3.png) | The LilyGo T-Dongle S3 is a USB pen drive shaped ESP32-S3 development board. It features a colour LCD screen, physical button, hidden/covert micro SD card adapter (inside the USB-A connector) as well as a SPI adapter. It has 16MB of flash. It is based on the ESP32-S3 chipset which enables it to host a WiFi station as well as support a range of WiFi and Bluetooth attacks. *It is incredibly cheap!* There are two versions of this device with and without the screen. Only the version with the screen has been tested. |


| **LilyGo T-Dongle S3** (Recommended)![screenshot](./docs/images/t-dongle-s3.png) | The LilyGo T-Dongle S3 is a USB pen drive shaped ESP32-S3 development board. It features a colour LCD screen, physical button, hidden/covert micro SD card adapter (inside the USB-A connector) as well as a SPI adapter. It has 16MB of flash. It is based on the ESP32-S3 chipset which enables it to host a WiFi station as well as support a range of WiFi and Bluetooth attacks. *It is incredibly cheap!* There are two versions of this device with and without the screen. Only the version with the screen has been tested. |
| **Pure ESP32-S2** ![screenshot](./docs/images/esp32-udisk.png) | The most basic device that can run the USB Army Knife code is a ESP32-S2 chip connected to a USB port. Often you can find these sold in a very similar enclosures to the T-Dongle S3 and tend to advertised on sites like AliExpress as Playstation 4 jailbreaks under the name 'USB Dongle Udisk for P4'. These devices lack RAM, a screen, SD card, Bluetooth, LEDs and a good hardware button. Instead of an SD card, flash memory is used to store tiny files. These devices are incredibly cheap and are often good at running HID+WiFi payloads (like the rick roll). **Warning** They are too underpowered to run the webserver. When buying these **beware** that they can often be confused with a very similar looking device that includes a CH343P chipset and no reset button. **Make sure the device you buy has a button that can be pushed with a paperclip.** |

## Getting Started

### Prerequisites

- **Hardware**:
* LilyGo T-Dongle S3 with screen (or compatible hardware).
* FAT32 formatted micro SD card. For large cards this should have *at most* a single 32GB partition.
* A supported device, ideally the LilyGo T-Dongle S3 with screen.
* For device with an SD card you'll need a FAT32 formatted micro SD card.
* For large cards this should have *at most* a single 32GB partition.
- **Software**:
* [Visual Studio Code](https://code.visualstudio.com/Download)
* [PlatformIO Visual Studio Code extension](https://platformio.org/platformio-ide)
Expand Down Expand Up @@ -112,11 +112,22 @@ The USB Army Knife may not run correctly with large SD cards or those with newer

1. Click the PlatformIO icon (Alien icon)

1. (Remove the dongle if it was inserted) **Press and hold the hardware button**, insert the LilyGo dongle, wait 1s and **release the button**.
1. (Remove the dongle if it was inserted) **Press and hold the hardware button**, insert the device, wait 1s and **release the button**.
* You should now seen a new COM port/serial device attached to your machine

1. In the menu expand the device you want to flash.
* For the T-Dongle S3 you should expand 'LILYGO-T-Dongle-S3'
* For a generic ESP32-S2 you should expand 'Generic-ESP32-S2'
* It may take a few seconds to populate the build menu after you've selected your device
1. Under 'LILYGO-T-Dongle-S3' Select upload
1. Press 'Upload'
1. When the upload has finished successfully, remove the dongle and insert the micro SD card
1. *Only if your device does NOT have an SD card.*
1. *Edit the files for the flash filesystem, these are stored in the 'data' directory.*
1. *Expand the Platform folder in the build menu from the previous step.*
1. *Click 'Upload Filesystem Image'.*
1. When the upload has finished successfully, remove the dongle and insert the micro SD card if you have one
### Updating the codebase to the latest version
Expand All @@ -129,11 +140,13 @@ At this point all your code and dependencies will be up to date and you can cont
### Usage
1. Connect the USB dongle to your computer.
1. Connect to the WiF access point (iPhone14) with the password of 'password'
1. Connect to the WiFi access point (iPhone14) with the password of 'password'
1. Access the web interface (http://4.3.2.1:8080) by navigating to the URL with your browser.
1. Ensure the web interface has correctly loaded. You should see thr currently running status and uptime. If not refresh the page.
1. Use the web interface to create and manage your attacks using DuckyScript.
*ESP-S2 based devices have WiFi support but do not have a web interface. Attacks are managed via DuckyScript files.*
### Future plans
#### USB Host Mode / Mobile device support
Expand Down
2 changes: 2 additions & 0 deletions data/autorun.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REM This file is only used by platforms without an SD card
REM Replace this file with your own content
Binary file added docs/images/esp32-udisk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/ESP32Marauder
64 changes: 58 additions & 6 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,18 @@ build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-D DISABLE_ALL_LIBRARY_WARNINGS
-D USER_SETUP_LOADED
-D GENERIC_ESP32
-D HAS_SD
-Wnarrowing
-Wno-deprecated
-Wwrite-strings
-Wreturn-type
-Wl,-z,muldefs
-D USE_SD_MMC_INTERFACE
-D DISABLE_STATUS_LED
-D ENABLE_NONSERIAL_COMMAND_EXECUTION
-D CFG_TUD_NCM
-D CFG_TUD_ENABLED
-D MIN_HEAP_SIZE=8192
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1
-D ELEGANTOTA_USE_ASYNC_WEBSERVER=1
-D CONFIG_ASYNC_TCP_QUEUE_SIZE=128
-D WS_MAX_QUEUED_MESSAGES=64
-D CONFIG_ASYNC_TCP_MAX_ACK_TIME=3000
;-D DUCKY_CUSTOM_LOG
Expand All @@ -92,7 +88,6 @@ lib_deps_core =
ESPAsyncWebServer=https://github.com/mathieucarbou/ESPAsyncWebServer
https://github.com/i-am-shodan/DuckScriptInterpreter
bblanchon/ArduinoJson@^7.0.3
h2zero/NimBLE-Arduino@^1.4.2
ivanseidel/[email protected]+sha.dac3874d28
yiannisbourkelis/Uptime Library@^1.0.0
ayushsharma82/[email protected]
Expand All @@ -112,10 +107,67 @@ board_build.partitions = default_8MB.csv
monitor_speed = 115200
build_flags =
${common.build_flags}
-DARDUINO_ARCH_ESP32S3
-D ARDUINO_ARCH_ESP32S3
-D HAS_SD ; ESP32 Maurader
-D USE_SD_MMC_INTERFACE ; ESP32 Maurader
-D GENERIC_ESP32 ; ESP32 Maurader
-D CONFIG_ASYNC_TCP_QUEUE_SIZE=128
; Button config
-D BTN_PIN=0
; LED config
-D NUM_LEDS=1
-D LED_DI_PIN=40
-D LED_CI_PIN=39
; SD port config
-D SD_MMC_D0_PIN=14
-D SD_MMC_D1_PIN=17
-D SD_MMC_D2_PIN=21
-D SD_MMC_D3_PIN=18
-D SD_MMC_CLK_PIN=12
-D SD_MMC_CMD_PIN=16
; Display (ST7735s) hardware configuration:
-D DISPLAY_RST=1
-D DISPLAY_DC=2
-D DISPLAY_MOSI=3
-D DISPLAY_CS=4
-D DISPLAY_SCLK=5
-D DISPLAY_LEDA=38
-D DISPLAY_MISO=-1
-D DISPLAY_BUSY=-1
-D DISPLAY_WIDTH=160
-D DISPLAY_HEIGHT=80
-D TFT_WIDTH=80
-D TFT_HEIGHT=160

lib_deps =
${common.lib_deps_core}
h2zero/NimBLE-Arduino@^1.4.2 ; ESP32 Maurader
mathertel/OneButton
bitbank2/PNGdec@^1.0.1
lovyan03/LovyanGFX@^1.1.16
https://github.com/pololu/apa102-arduino

[env:Generic-ESP32-S2]
platform = ${common.platform}
platform_packages = ${common.platform_packages}
framework = ${common.framework}
extra_scripts = ${common.extra_scripts}
monitor_filters = ${common.monitor_filters}
build_src_filter = ${common.build_src_filter}
build_unflags = ${common.build_unflags}

board = esp32-s2-kaluga-1 ; close enough
board_build.partitions = min_spiffs.csv
monitor_speed = 115200
build_flags =
${common.build_flags}
-D ARDUINO_ARCH_ESP32S3
-D NO_TFT
-D NO_LED
-D NO_BUTTON
-D NO_SD
-D NO_WEB ; These device have such low free heap that the webserver just doesn't work
-D USE_SPIFFS_INTERFACE ; ESP32 Maurader
-D MEM_LOWER_LIM=20000 ; ESP32 Maurader
lib_deps =
${common.lib_deps_core}
18 changes: 14 additions & 4 deletions src/Attacks/Marauder/Marauder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
#include <esp32_marauder/settings.h>
#include <esp32_marauder/Buffer.h>

#include "../../Devices/Storage/SDMMCFS2.h"
using namespace fs;
#ifndef NO_SD
#include "../../Devices/Storage/SDMMCFS2.h"
using namespace fs;
#else
#include <sd_defines.h>
#endif

#include "Marauder.h"

Expand Down Expand Up @@ -43,9 +47,15 @@ void ESP32Marauder::begin(Preferences &prefs)
buffer_obj = Buffer();
sd_obj.initSD();
sd_obj.supported = true;
#ifndef NO_SD // todo this should prob be an API call
sd_obj.cardType = SD_MMC_2.cardType();
sd_obj.cardSizeMB = SD_MMC_2.cardSize();
sd_obj.card_sz = std::to_string(SD_MMC_2.cardSize() / 1024 / 1024).c_str();
sd_obj.cardSizeMB = SD_MMC_2.cardSize() / 1024 / 1024;
#else
sd_obj.cardType = CARD_SD;
sd_obj.cardSizeMB = SPIFFS.totalBytes() / 1024 / 1024;
#endif
sd_obj.card_sz = std::to_string(sd_obj.cardSizeMB).c_str();

sd_obj.sd_files = new LinkedList<String>();
sd_obj.sd_files->add("Back");

Expand Down
22 changes: 22 additions & 0 deletions src/Comms/Web/NoWebServer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifdef NO_WEB
#include "WebServer.h"

namespace Comms
{
WebSite Web;
}

WebSite::WebSite()
{
}

void WebSite::begin(Preferences &prefs)
{
}

void WebSite::loop(Preferences &prefs)
{

}

#endif
4 changes: 3 additions & 1 deletion src/Comms/Web/WebServer.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef NO_WEB
#include "WebServer.h"

#include <AsyncTCP.h>
Expand Down Expand Up @@ -322,4 +323,5 @@ void WebSite::loop(Preferences &prefs)
{
ws.cleanupClients();
ElegantOTA.loop();
}
}
#endif
5 changes: 3 additions & 2 deletions src/Devices/Button/HardwareButton.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef NO_BUTTON
#include <OneButton.h>

#include "HardwareButton.h"
#include "../../Debug/Logging.h"
#include "../../pin_config.h"

static OneButton button(BTN_PIN, true);

Expand All @@ -29,4 +29,5 @@ void HardwareButton::begin(Preferences &prefs)
button.attachLongPressStop([] {
Devices::Button.setButtonPressState(true, true);
});
}
}
#endif
21 changes: 21 additions & 0 deletions src/Devices/Button/NoHardwareButton.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifdef NO_BUTTON
#include "HardwareButton.h"

namespace Devices
{
HardwareButton Button;
}

HardwareButton::HardwareButton()
{
}

void HardwareButton::loop(Preferences& prefs)
{
}

void HardwareButton::begin(Preferences &prefs)
{
}

#endif
6 changes: 3 additions & 3 deletions src/Devices/LED/HardwareLED.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#ifndef NO_LED
#include "HardwareLED.h"
#include <APA102.h>

#include "../../pin_config.h"

namespace Devices
{
HardwareLED LED;
Expand Down Expand Up @@ -62,4 +61,5 @@ void HardwareLED::loop(Preferences& prefs)
void HardwareLED::begin(Preferences &prefs)
{
changeLEDState(true, 100, 100, 100, 200);
}
}
#endif
24 changes: 24 additions & 0 deletions src/Devices/LED/NoHardwareLED.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifdef NO_LED
#include "HardwareLED.h"

namespace Devices
{
HardwareLED LED;
}

void HardwareLED::changeLEDState(bool on, uint8_t hue, uint8_t saturation, uint8_t lum, uint8_t brightness)
{
}

HardwareLED::HardwareLED()
{
}

void HardwareLED::loop(Preferences& prefs)
{
}

void HardwareLED::begin(Preferences &prefs)
{
}
#endif
Loading

0 comments on commit e256ffc

Please sign in to comment.