mirror of
https://github.com/cecio/USBvalve.git
synced 2025-12-06 03:41:45 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ced8536f8c | ||
|
|
77f995533e | ||
|
|
3b0f285567 | ||
|
|
52af9dabb7 | ||
|
|
94a5d2e8c5 | ||
|
|
ef2ddde66f | ||
|
|
7953e269af | ||
|
|
5aa63c8efe | ||
|
|
39c3145e71 | ||
|
|
7daafb4d41 | ||
|
|
5a7a485aa4 | ||
|
|
08512d5d87 | ||
|
|
1c351f3a7b |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -50,3 +50,5 @@ modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
USBvalve_out
|
||||
|
||||
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# To Build:
|
||||
# docker build -t usbvalve/arduino-cli .
|
||||
#
|
||||
# To Run:
|
||||
# docker run --rm --name usbvalve -v $PWD:/mnt usbvalve/arduino-cli /mnt/USBvalve
|
||||
#
|
||||
|
||||
FROM ubuntu:22.04
|
||||
WORKDIR /app
|
||||
|
||||
# OS setup
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y git wget python3 \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# arduino-cli setup
|
||||
RUN cd /app \
|
||||
&& git clone --recursive https://github.com/arduino/arduino-cli.git \
|
||||
&& cd arduino-cli \
|
||||
&& ./install.sh \
|
||||
&& export PATH=$PATH:/app/arduino-cli/bin \
|
||||
&& arduino-cli --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json core search 2040 \
|
||||
&& arduino-cli --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json core install rp2040:rp2040 \
|
||||
&& arduino-cli lib install "Adafruit TinyUSB Library" \
|
||||
&& arduino-cli lib install "ssd1306" \
|
||||
&& arduino-cli lib install "Pico PIO USB" \
|
||||
&& arduino-cli lib install "SSD1306Ascii"
|
||||
|
||||
# Compilation setup
|
||||
RUN echo "#!/bin/bash" > /app/entrypoint.sh \
|
||||
&& echo "export PATH=\$PATH:/app/arduino-cli/bin" >> /app/entrypoint.sh \
|
||||
&& echo "arduino-cli compile --fqbn rp2040:rp2040:rpipico --board-options \"usbstack=tinyusb\" --board-options \"freq=240\" --output-dir \"/mnt/USBvalve_out\" \"\$1\"" >> /app/entrypoint.sh \
|
||||
&& chmod +x /app/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
26
README.md
26
README.md
@@ -1,5 +1,6 @@
|
||||
# USBvalve
|
||||
*Expose USB activity on the fly*
|
||||
<h1><img width="200" alt="logo, landscape, dark text, transparent background" src="https://github.com/cecio/USBvalve/blob/main/pictures/USBvalve_logo_scaled.png"></a></h1>
|
||||
|
||||
### *Expose USB activity on the fly*
|
||||
|
||||
<img src="https://github.com/cecio/USBvalve/blob/main/pictures/versions.png" alt="The two models" width="30%" height="30%" />
|
||||
|
||||
@@ -131,7 +132,7 @@ It's done!
|
||||
|
||||
I don't know if it will ever be the case, but you may want to customize the firmware in order to avoid detection done by *USBvalve-aware* malware :-)
|
||||
|
||||
I grouped most of the variables you may want to modify in this section
|
||||
I grouped most of the variables you may want to modify in this section ([see Dockerfile below for rebuilding](https://github.com/cecio/USBvalve#dockerfile))
|
||||
|
||||
```C
|
||||
// Anti-Detection settings.
|
||||
@@ -161,12 +162,25 @@ I grouped most of the variables you may want to modify in this section
|
||||
|
||||
Obviously you can also build your own firmware. To build the *standard* one I used:
|
||||
|
||||
- Arduino IDE 2.1.0
|
||||
- Arduino IDE 2.1.1
|
||||
- ~~as board I used `Raspberry Pi Pico - Arduino MBED OS RP2040` version `4.0.2`~~
|
||||
- ~~`Adafruit TinyUSB Library` version `1.14.4`. Newer versions are not working because the RPI SDK of the board is stick to an older version. May be migrate the entire project directly on Raspberry Pi Pico SDK is the solution here.~~
|
||||
- `Adafruit TinyUSB Library` version `2.2.1` and Board `Raspberry Pi RP2040 (2.7.0)` setting clock at 240MHz (overclock)
|
||||
- `Adafruit TinyUSB Library` version `2.2.1` and Board `Raspberry Pi RP2040 (3.3.0)` setting clock at 240MHz (overclock)
|
||||
- `ssd1306` OLED library version `1.8.3`
|
||||
|
||||
If you want to re-create a new fake filesystem, you may want to have a look to the `utils` folder, where I placed some utilities to build a new one.
|
||||
|
||||
**NOTE**: if you have ideas or improvements in your mind, I encourage you to open an issue so that we can improve the project together! Thanks!
|
||||
#### Dockerfile
|
||||
|
||||
If you want to build your own firmware, after you customized it, I provide a `Dockerfile` which builds a complete **Arduino** environment and compile the firmware. Enter the following commands in the main `USBvalve` folder:
|
||||
|
||||
```
|
||||
docker build -t usbvalve/arduino-cli .
|
||||
docker run --rm --name usbvalve -v $PWD:/mnt usbvalve/arduino-cli /mnt/USBvalve
|
||||
```
|
||||
|
||||
The firmware will be placed with extension `uf2` in folder `USBvalve_out`.
|
||||
|
||||
### Contribute
|
||||
|
||||
If you have ideas or improvements in your mind, I encourage you to open an issue so that we can improve the project together! Thanks!
|
||||
|
||||
@@ -42,7 +42,7 @@ Adafruit_USBH_Host USBHost;
|
||||
// Define vars for OLED screen
|
||||
#define I2C_ADDRESS 0x3C // 0X3C+SA0 - 0x3C or 0x3D
|
||||
#define RST_PIN -1 // Define proper RST_PIN if required.
|
||||
#define OLED_HEIGHT 32 // 64 or 32 depending on the OLED
|
||||
#define OLED_HEIGHT 64 // 64 or 32 depending on the OLED
|
||||
#define OLED_LINES (OLED_HEIGHT / 8)
|
||||
SSD1306AsciiWire oled;
|
||||
|
||||
@@ -74,11 +74,13 @@ bool activeState = false;
|
||||
//
|
||||
// USBvalve globals
|
||||
//
|
||||
#define VERSION "USBvalve - 0.10.0"
|
||||
#define VERSION "USBvalve - 0.12.0"
|
||||
boolean readme = false;
|
||||
boolean autorun = false;
|
||||
boolean written = false;
|
||||
boolean written_reported = false;
|
||||
boolean hid_sent = false;
|
||||
boolean hid_reported = false;
|
||||
|
||||
// Anti-Detection settings.
|
||||
//
|
||||
@@ -221,6 +223,17 @@ void loop() {
|
||||
written = false;
|
||||
written_reported = true;
|
||||
}
|
||||
|
||||
if (hid_sent == true && hid_reported == false) {
|
||||
oled.print("\n[!!] HID Sending data");
|
||||
hid_sent = false;
|
||||
hid_reported = true;
|
||||
}
|
||||
|
||||
if (BOOTSEL) {
|
||||
oled.print("\n[+] RESETTING");
|
||||
swreset();
|
||||
}
|
||||
}
|
||||
|
||||
// Main Core1 loop: managing USB Host
|
||||
@@ -351,6 +364,13 @@ void hexDump(unsigned char* data, size_t size) {
|
||||
SerialTinyUSB.println();
|
||||
}
|
||||
|
||||
// Reset the Pico
|
||||
void swreset()
|
||||
{
|
||||
watchdog_enable(1500, 1);
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// BADUSB detector section
|
||||
//
|
||||
@@ -381,6 +401,10 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
|
||||
// Invoked when device with hid interface is un-mounted
|
||||
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) {
|
||||
SerialTinyUSB.printf("HID device address = %d, instance = %d unmounted\r\n", dev_addr, instance);
|
||||
|
||||
// Reset HID sent flag
|
||||
hid_sent = false;
|
||||
hid_reported = false;
|
||||
}
|
||||
|
||||
// Invoked when received report from device
|
||||
@@ -389,8 +413,9 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
|
||||
static bool kbd_printed = false;
|
||||
static bool mouse_printed = false;
|
||||
|
||||
oled.print("\n[!!] HID Sending data");
|
||||
|
||||
// Used in main loop to write output to OLED
|
||||
hid_sent = true;
|
||||
|
||||
// Read the HID protocol
|
||||
uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance);
|
||||
|
||||
@@ -533,4 +558,4 @@ void cursor_movement(int8_t x, int8_t y, int8_t wheel) {
|
||||
SerialTinyUSB.printf("(%d %d %d)\r\n", x, y, wheel);
|
||||
}
|
||||
|
||||
// END of BADUSB detector section
|
||||
// END of BADUSB detector section
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
USBvalve
|
||||
|
||||
RAMDISK file written by Cesare Pizzi
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -607,7 +609,38 @@ DISK_LABEL, 0x08, 0x00, 0x00, 0xaf, 0x60,
|
||||
},
|
||||
{
|
||||
//------------- Block 85: -------------//
|
||||
0x00
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x35, 0xc3, 0x28, 0x56, 0xaa, 0x10, 0x9b, 0xd7, 0xd2, 0x75, 0x6e, 0xcf, 0x1e, 0x1e, 0x21, 0xaf,
|
||||
0xcc, 0x52, 0x04, 0xe4, 0xc3, 0x7d, 0x3e, 0xee, 0xf7, 0xf1, 0x7d, 0xe0, 0x09, 0x95, 0x11, 0x6c,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
//------------- Block 86: -------------//
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
pictures/USBvalve_logo_scaled.png
Normal file
BIN
pictures/USBvalve_logo_scaled.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
Reference in New Issue
Block a user