Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f93f2b8fcb | ||
|
|
5ae2c31403 | ||
|
|
f96689ad6b | ||
|
|
896a9b8e26 | ||
|
|
c9d6a29ae9 | ||
|
|
4b87082395 | ||
|
|
977296e820 | ||
|
|
6b048cfd95 | ||
|
|
a33ffa2411 | ||
|
|
9f4be5b8cd | ||
|
|
27e0285aae | ||
|
|
07a18dadd6 | ||
|
|
805d361da8 | ||
|
|
815b0434c2 |
@@ -25,11 +25,10 @@ RUN cd /app \
|
||||
&& 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 "Adafruit SSD1306" \
|
||||
&& arduino-cli lib install "Pico PIO USB" \
|
||||
&& arduino-cli lib install "XxHash_arduino" \
|
||||
&& arduino-cli lib install "GFX Library for Arduino" \
|
||||
&& arduino-cli lib install "SSD1306Ascii"
|
||||
&& arduino-cli lib install "GFX Library for Arduino"
|
||||
|
||||
# Compilation setup
|
||||
RUN echo "#!/bin/bash" > /app/entrypoint.sh \
|
||||
|
||||
BIN
PCB/USBpipe/BOM_USBpipe_Rev1.ods
Normal file
BIN
PCB/USBpipe/BOM_USBpipe_Rev1.x.xlsx
Normal file
BIN
PCB/USBpipe/Gerber_USBpipe_Rev1.1.zip
Normal file
BIN
PCB/USBpipe/PCB_USBpipe_Rev1.x.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
4754
PCB/USBpipe/PCB_USBpipe_Rev1.x.svg
Normal file
|
After Width: | Height: | Size: 336 KiB |
38
README.md
@@ -5,6 +5,7 @@
|
||||
<p float="left">
|
||||
<img src="https://github.com/cecio/USBvalve/blob/main/pictures/versions.png" alt="The two models" width="30%" height="30%" />
|
||||
<img src="https://github.com/cecio/USBvalve/blob/main/pictures/USBvalve_PIWATCH.png" alt="The Watch" width="26%" height="26%" />
|
||||
<img src="https://github.com/cecio/USBvalve/blob/main/pictures/version1_2.png" alt="1.2" width="26%" height="26%" />
|
||||
</p>
|
||||
|
||||
I'm sure that, like me, you were asked to put your USB drive in an *unknown* device...and then the doubt:
|
||||
@@ -34,7 +35,7 @@ If you prefer videos, you can also have a look to my [Insomni'hack Presentation]
|
||||
|
||||
## USBvalve Watch
|
||||
|
||||
Starting from version `0.15.0` a new *Pi Pico Watch* version is supported. To compile the new version you have to uncomment the `#define PIWATCH` line at the beginning of the code or use the pre-compiled firmware provided. The hardware is a RP2040-based 1.28-inch TFT display and watch board. You can find some more info [here](https://www.raspberrypi.com/news/how-to-build-your-own-raspberry-pi-watch/).
|
||||
Starting from version `0.15.0` a new *Pi Pico Watch* version is supported. To compile the new version you have to uncomment the `#define PIWATCH` line at the beginning of the code. The hardware is a RP2040-based 1.28-inch TFT display and watch board. You can find some more info [here](https://www.raspberrypi.com/news/how-to-build-your-own-raspberry-pi-watch/).
|
||||
This is also fully compatible with the [Waveshare RP2040-LCD-1.28](https://www.waveshare.com/wiki/RP2040-LCD-1.28).
|
||||
|
||||
## Repository Structure
|
||||
@@ -51,7 +52,7 @@ This is also fully compatible with the [Waveshare RP2040-LCD-1.28](https://www.w
|
||||
|
||||
`pictures`: images and resources used in this doc
|
||||
|
||||
`STL`: STL files for enclosure. In `1.1` and `1.2` folders there are full enclosures (thanks to [WhistleMaster](https://github.com/WhistleMaster)). If you want something lighter to protect the LCD you can go with `USBvalve_sliding_cover.stl`.
|
||||
`STL`: STL files for enclosure. In `1.1` and `1.2` folders there are full enclosures (thanks to [WhistleMaster](https://github.com/WhistleMaster)). In folders `1.2_64` and `1.2_64_simple` there are enclosures for the 128x64 screen (thanks to [rtmq0227](https://github.com/rtmq0227)). If you want something lighter to protect the LCD you can go with `USBvalve_sliding_cover.stl`.
|
||||
|
||||
## Build USBvalve
|
||||
|
||||
@@ -66,6 +67,8 @@ If you want to build your own, you need:
|
||||
|
||||
### Building instructions
|
||||
|
||||
> Thanks to [Tz1rf](https://github.com/Tz1rf) we have a great [Video](https://youtu.be/7ymk8hD7-Hc) explaining the building process step-by-step.
|
||||
|
||||
Almost all the job is done directly on the board by the software, so you just need to arrange the connection with the OLED for output.
|
||||
|
||||
Starting from version 0.8.0 of the firmware, **USBvalve** can detect HID devices (used to detect *BADUSB*). This require an additional USB port behaving as Host. If you are not interested in this, you can use the old instructions [in docs folder](https://github.com/cecio/USBvalve/blob/main/docs/BUILDING-1.1.md) and use PCB version `1.1`. Otherwise go ahead with PCB version `1.2` (we have version for USB-A or USB-B, see folder).
|
||||
@@ -124,6 +127,22 @@ The mapping is the following:
|
||||
|
||||
If you want to use the DEBUG functions, you can also place a header on the 3 SWD PINs at the bottom of the board.
|
||||
|
||||
#### With USBpipe PCB
|
||||
|
||||
> [!CAUTION]
|
||||
> This PCB is for experienced electronic makers
|
||||
> **DON'T USE IT IF YOU AREN'T SURE YOU CAN HANDLE IT!**
|
||||
|
||||
<img src="./pictures/USB_pipe_finished_oled.jpg" alt="USBpipe PCB"/>
|
||||
|
||||
[USBpipe](https://github.com/LiPolymer/smartUSBPipe) is a dedicated PCB for this project.
|
||||
|
||||
You can find everything you need in `./PCB/USBpipe/` folder.
|
||||
|
||||
<img src="./pictures/USB_pipe_front.png" alt="Front"/>
|
||||
|
||||
<img src="./pictures/USB_pipe_back.png" alt="Back"/>
|
||||
|
||||
### Flash Firmware
|
||||
|
||||
To flash the firmware, follow these steps:
|
||||
@@ -170,9 +189,9 @@ I grouped most of the variables you may want to modify in this section ([see Doc
|
||||
|
||||
Obviously you can also build your own firmware. To build the *standard* one I used:
|
||||
|
||||
- Arduino IDE `2.2.1`
|
||||
- `Adafruit TinyUSB Library` version `2.4.1`, `Pico-PIO-USB` version `0.5.2`, Board `Raspberry Pi RP2040 (3.6.3)` setting Tools=>CPU Speed at `120MHz` and Tools=>USB Stack to `Adafruit TinyUSB`
|
||||
- `ssd1306` OLED library version `1.8.3`
|
||||
- Arduino IDE `2.3.2`
|
||||
- `Adafruit TinyUSB Library` version `3.1.4`, `Pico-PIO-USB` version `0.5.2`, Board `Raspberry Pi RP2040 (3.8.0)` setting Tools=>CPU Speed at `120MHz` and Tools=>USB Stack to `Adafruit TinyUSB`
|
||||
- `Adafruit_SSD1306` OLED library version `2.5.10`
|
||||
|
||||
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.
|
||||
|
||||
@@ -190,3 +209,12 @@ 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!
|
||||
|
||||
### Support
|
||||
|
||||
If you have question or need support you can open an `Issue` here or reach me out on Twitter/X [@red5heep](https://twitter.com/red5heep)
|
||||
|
||||
## SAFETY WARNING
|
||||
|
||||
> [!WARNING]
|
||||
> I've received a lot of questions about **USBvalve** and *USB killer devices*. **USBvalve** is not built to test these devices, it has not any kind of insulation or protection, so if you have the suspect you are dealing with one of these devices, test it with something else, NOT with **USBvalve** or you may damage the device, yourself or objects near to you.
|
||||
|
||||
BIN
STL/1.2_64/renclosure.stl
Normal file
BIN
STL/1.2_64/renclosure_backplate.stl
Normal file
BIN
STL/1.2_64/renclosure_spacer.stl
Normal file
BIN
STL/1.2_64_simple/SimpleEnclosurex64.stl
Normal file
BIN
STL/1.2_64_simple/SimpleEnclosurex64_backplate.stl
Normal file
BIN
STL/1.2_64_simple/SimpleEnclosurex64_spacer.stl
Normal file
@@ -21,7 +21,7 @@
|
||||
|
||||
// Uncomment the following to compile for the RP2040 based TFT round display
|
||||
// https://www.raspberrypi.com/news/how-to-build-your-own-raspberry-pi-watch/
|
||||
//#define PIWATCH
|
||||
#define PIWATCH
|
||||
|
||||
#include <pio_usb.h>
|
||||
#include "Adafruit_TinyUSB.h"
|
||||
@@ -35,7 +35,13 @@
|
||||
|
||||
#else
|
||||
|
||||
#include "SSD1306AsciiWire.h"
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
|
||||
// LED Pin. If solid GREEN everything is OK, otherwise it will be put OFF
|
||||
#define LED_PIN 25
|
||||
|
||||
#endif
|
||||
|
||||
@@ -76,9 +82,10 @@ Arduino_GFX *gfx = new Arduino_GC9A01(bus, GFX_RST, 1 /* rotation */, true /* IP
|
||||
|
||||
#define I2C_ADDRESS 0x3C // 0X3C+SA0 - 0x3C or 0x3D
|
||||
#define RST_PIN -1 // Define proper RST_PIN if required.
|
||||
#define OLED_WIDTH 128
|
||||
#define OLED_HEIGHT 32 // 64 or 32 depending on the OLED
|
||||
#define OLED_LINES (OLED_HEIGHT / 8)
|
||||
SSD1306AsciiWire display;
|
||||
|
||||
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT, &Wire, RST_PIN);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -109,7 +116,7 @@ bool activeState = false;
|
||||
//
|
||||
// USBvalve globals
|
||||
//
|
||||
#define VERSION "USBvalve - 0.15.0"
|
||||
#define VERSION "USBvalve - 0.18.0"
|
||||
boolean readme = false;
|
||||
boolean autorun = false;
|
||||
boolean written = false;
|
||||
@@ -202,30 +209,18 @@ void setup() {
|
||||
gfx->draw16bitRGBBitmap(10,0,background,210,210); // Draw background
|
||||
delay(2000);
|
||||
#else
|
||||
Wire.begin();
|
||||
Wire.setClock(400000L);
|
||||
#if OLED_HEIGHT == 64
|
||||
#if RST_PIN >= 0
|
||||
display.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN);
|
||||
display.begin(SSD1306_SWITCHCAPVCC, I2C_ADDRESS, RST_PIN);
|
||||
#else
|
||||
display.begin(&Adafruit128x64, I2C_ADDRESS);
|
||||
#endif
|
||||
#else
|
||||
#if RST_PIN >= 0
|
||||
display.begin(&Adafruit128x32, I2C_ADDRESS, RST_PIN);
|
||||
#else
|
||||
display.begin(&Adafruit128x32, I2C_ADDRESS);
|
||||
#endif
|
||||
#endif
|
||||
display.begin(SSD1306_SWITCHCAPVCC, I2C_ADDRESS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PIWATCH)
|
||||
// gfx->setTextSize(tsb);
|
||||
gfx->setTextSize(1);
|
||||
gfx->setTextColor(MAGENTA);
|
||||
#else
|
||||
display.setFont(Adafruit5x7);
|
||||
display.setScrollMode(SCROLL_MODE_AUTO);
|
||||
display.setTextSize(1);
|
||||
#endif
|
||||
|
||||
cls(); // Clear display
|
||||
@@ -240,11 +235,18 @@ void setup() {
|
||||
delay(1000); // Loop forever
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(PIWATCH)
|
||||
// Set up led PIN
|
||||
gpio_init(LED_PIN);
|
||||
gpio_set_dir(LED_PIN, GPIO_OUT);
|
||||
gpio_put(LED_PIN, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Core 1 Setup: will be used for the USB host functions for BADUSB detector
|
||||
void setup1() {
|
||||
// Set a custom clock (multiple of 12Mhz) to achieve maximum compatibility
|
||||
// Set a custom clock (multiple of 12Mhz) to achieve maximum compatibility for HID
|
||||
set_sys_clock_khz(144000, true);
|
||||
|
||||
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
|
||||
@@ -263,6 +265,9 @@ void loop() {
|
||||
if (readme == true) {
|
||||
printout("\n[!] README (R)");
|
||||
readme = false;
|
||||
#if !defined(PIWATCH)
|
||||
gpio_put(LED_PIN, 0); // Turn Off LED
|
||||
#endif
|
||||
}
|
||||
|
||||
if (autorun == true) {
|
||||
@@ -274,18 +279,27 @@ void loop() {
|
||||
printout("\n[!] DELETING");
|
||||
deleted = false;
|
||||
deleted_reported = true;
|
||||
#if !defined(PIWATCH)
|
||||
gpio_put(LED_PIN, 0); // Turn Off LED
|
||||
#endif
|
||||
}
|
||||
|
||||
if (written == true && written_reported == false) {
|
||||
printout("\n[!] WRITING");
|
||||
written = false;
|
||||
written_reported = true;
|
||||
#if !defined(PIWATCH)
|
||||
gpio_put(LED_PIN, 0); // Turn Off LED
|
||||
#endif
|
||||
}
|
||||
|
||||
if (hid_sent == true && hid_reported == false) {
|
||||
printout("\n[!!] HID Sending data");
|
||||
hid_sent = false;
|
||||
hid_reported = true;
|
||||
#if !defined(PIWATCH)
|
||||
gpio_put(LED_PIN, 0); // Turn Off LED
|
||||
#endif
|
||||
}
|
||||
|
||||
if (BOOTSEL) {
|
||||
@@ -411,9 +425,38 @@ void printout(const char *str)
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
void scrollUp(uint8_t pixels) {
|
||||
// Read the current content of the display, shift it up by 'pixels' rows
|
||||
display.startscrollright(0x00, 0x07); // Dummy values to initiate scroll
|
||||
display.stopscroll(); // Immediately stop to manually shift pixels in memory
|
||||
for (int i = 0; i < display.height() - pixels; i++) {
|
||||
for (int j = 0; j < display.width(); j++) {
|
||||
uint8_t color = display.getPixel(j, i + pixels);
|
||||
display.drawPixel(j, i, color);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the freed space after scrolling
|
||||
display.fillRect(0, display.height() - pixels, display.width(), pixels, SSD1306_BLACK);
|
||||
// Refresh the display to show the changes
|
||||
display.display();
|
||||
}
|
||||
|
||||
void checkAndScroll() {
|
||||
// Assumes text height of 8 pixels, but check for 16 because newline is not used
|
||||
if ((display.getCursorY() + 16) > display.height()) {
|
||||
// Scroll up by 8 pixels
|
||||
scrollUp(8);
|
||||
display.setCursor(0, display.getCursorY() - 8);
|
||||
}
|
||||
}
|
||||
|
||||
void printout(const char *str)
|
||||
{
|
||||
display.print(str);
|
||||
checkAndScroll();
|
||||
display.print(str);
|
||||
display.display();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -429,7 +472,9 @@ void cls(void) {
|
||||
#else
|
||||
// Clear display
|
||||
void cls(void) {
|
||||
display.clear();
|
||||
display.clearDisplay();
|
||||
display.setTextColor(SSD1306_WHITE);
|
||||
display.setCursor(0, 0);
|
||||
printout(VERSION);
|
||||
printout("\n-----------------");
|
||||
}
|
||||
@@ -495,6 +540,9 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
|
||||
tuh_vid_pid_get(dev_addr, &vid, &pid);
|
||||
|
||||
printout("\n[!!] HID Device");
|
||||
#if !defined(PIWATCH)
|
||||
gpio_put(LED_PIN, 0); // Turn Off LED
|
||||
#endif
|
||||
|
||||
SerialTinyUSB.printf("HID device address = %d, instance = %d mounted\r\n", dev_addr, instance);
|
||||
SerialTinyUSB.printf("VID = %04x, PID = %04x\r\n", vid, pid);
|
||||
@@ -666,3 +714,31 @@ void cursor_movement(int8_t x, int8_t y, int8_t wheel) {
|
||||
}
|
||||
|
||||
// END of BADUSB detector section
|
||||
|
||||
//
|
||||
// OTHER Host devices detection section
|
||||
//
|
||||
|
||||
// Invoked when a device with MassStorage interface is mounted
|
||||
void tuh_msc_mount_cb(uint8_t dev_addr) {
|
||||
printout("\n[++] Mass Device");
|
||||
SerialTinyUSB.printf("Mass Device attached, address = %d\r\n", dev_addr);
|
||||
}
|
||||
|
||||
// Invoked when a device with MassStorage interface is unmounted
|
||||
void tuh_msc_umount_cb(uint8_t dev_addr) {
|
||||
SerialTinyUSB.printf("Mass Device unmounted, address = %d\r\n", dev_addr);
|
||||
}
|
||||
|
||||
// Invoked when a device with CDC (Communication Device Class) interface is mounted
|
||||
void tuh_cdc_mount_cb(uint8_t idx) {
|
||||
printout("\n[++] CDC Device");
|
||||
SerialTinyUSB.printf("CDC Device attached, idx = %d\r\n", idx);
|
||||
}
|
||||
|
||||
// Invoked when a device with CDC (Communication Device Class) interface is unmounted
|
||||
void tuh_cdc_umount_cb(uint8_t idx) {
|
||||
SerialTinyUSB.printf("CDC Device unmounted, idx = %d\r\n", idx);
|
||||
}
|
||||
|
||||
// END of OTHER Host devices detector section
|
||||
|
||||
BIN
pictures/USB_pipe_back.png
Normal file
|
After Width: | Height: | Size: 124 KiB |
BIN
pictures/USB_pipe_finished.jpg
Normal file
|
After Width: | Height: | Size: 2.0 MiB |
BIN
pictures/USB_pipe_finished_oled.jpg
Normal file
|
After Width: | Height: | Size: 2.0 MiB |
BIN
pictures/USB_pipe_front.png
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
pictures/version1_2.png
Normal file
|
After Width: | Height: | Size: 121 KiB |