mirror of
https://github.com/cecio/USBvalve.git
synced 2025-12-06 03:41:45 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
276edad7e3 | ||
|
|
751465b3a2 | ||
|
|
2c493681cc | ||
|
|
b87b518552 | ||
|
|
385a67144a | ||
|
|
df739adf29 | ||
|
|
5126ce40d7 | ||
|
|
f7a1165cae | ||
|
|
8b3f6d3223 | ||
|
|
2d248742e3 | ||
|
|
9b92c0b97a |
@@ -1,4 +1,4 @@
|
||||
<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>
|
||||
<h1><img width="300" 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*
|
||||
|
||||
@@ -43,7 +43,7 @@ If you prefer videos, you can also have a look to my [Insomni'hack Presentation]
|
||||
|
||||
`pictures`: images and resources used in this doc
|
||||
|
||||
`STL`: STL files for enclosure
|
||||
`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`.
|
||||
|
||||
## Build USBvalve
|
||||
|
||||
@@ -163,7 +163,7 @@ 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.2.3`, Board `Raspberry Pi RP2040 (3.6.0)` setting Tools=>CPU Speed at `120MHz` and Tools=>USB Stack to `Adafruit TinyUSB`
|
||||
- `Adafruit TinyUSB Library` version `2.3.1`, `Pico-PIO-USB` version `0.5.2`, Board `Raspberry Pi RP2040 (3.6.2)` setting Tools=>CPU Speed at `120MHz` and Tools=>USB Stack to `Adafruit TinyUSB`
|
||||
- `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.
|
||||
|
||||
BIN
STL/USBvalve_sliding_cover.stl
Normal file
BIN
STL/USBvalve_sliding_cover.stl
Normal file
Binary file not shown.
@@ -20,7 +20,7 @@
|
||||
#include "Adafruit_TinyUSB.h"
|
||||
#include "SSD1306AsciiWire.h"
|
||||
#include <XxHash_arduino.h>
|
||||
#include <pico/stdlib.h>
|
||||
#include <pico/stdlib.h>
|
||||
|
||||
//
|
||||
// BADUSB detector section
|
||||
@@ -44,7 +44,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;
|
||||
|
||||
@@ -75,11 +75,13 @@ bool activeState = false;
|
||||
//
|
||||
// USBvalve globals
|
||||
//
|
||||
#define VERSION "USBvalve - 0.13.1"
|
||||
#define VERSION "USBvalve - 0.14.3"
|
||||
boolean readme = false;
|
||||
boolean autorun = false;
|
||||
boolean written = false;
|
||||
boolean deleted = false;
|
||||
boolean written_reported = false;
|
||||
boolean deleted_reported = false;
|
||||
boolean hid_sent = false;
|
||||
boolean hid_reported = false;
|
||||
|
||||
@@ -211,6 +213,12 @@ void loop() {
|
||||
autorun = false;
|
||||
}
|
||||
|
||||
if (deleted == true && deleted_reported == false) {
|
||||
oled.print("\n[!] DELETING");
|
||||
deleted = false;
|
||||
deleted_reported = true;
|
||||
}
|
||||
|
||||
if (written == true && written_reported == false) {
|
||||
oled.print("\n[!] WRITING");
|
||||
written = false;
|
||||
@@ -275,14 +283,25 @@ int32_t msc_read_callback(uint32_t lba, void* buffer, uint32_t bufsize) {
|
||||
// This happens only for the "real" size of disk
|
||||
int32_t msc_write_callback(uint32_t lba, uint8_t* buffer, uint32_t bufsize) {
|
||||
|
||||
// Check for file deletion at Block 7
|
||||
// The first char of filename is replaced with 0xE5, we are going
|
||||
// to check for it
|
||||
if (lba == 7) {
|
||||
if (buffer[32] == 0xE5 || buffer[64] == 0xE5 || buffer[160] == 0xE5) {
|
||||
deleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// This check for writing of space. The LBA > 10 is set to avoid some
|
||||
// false positives, in particular on Windows Systems
|
||||
if (lba > 10) {
|
||||
written = true;
|
||||
}
|
||||
|
||||
// We are declaring a bigger size than what is actually allocated, so
|
||||
// this is protecting our memory integrity
|
||||
if (lba < DISK_BLOCK_NUM - 1) {
|
||||
// Writing buffer to "disk"
|
||||
uint8_t* addr = msc_disk[lba];
|
||||
memcpy(addr, buffer, bufsize);
|
||||
}
|
||||
@@ -358,10 +377,10 @@ void hexDump(unsigned char* data, size_t size) {
|
||||
}
|
||||
|
||||
// Reset the Pico
|
||||
void swreset()
|
||||
{
|
||||
watchdog_enable(1500, 1);
|
||||
while(1);
|
||||
void swreset() {
|
||||
watchdog_enable(1500, 1);
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -408,7 +427,7 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
// README.TXT
|
||||
// System Volume Information
|
||||
//
|
||||
// Files information are saved at Block 7
|
||||
//
|
||||
|
||||
// Keep 11 chars
|
||||
#define DISK_LABEL 'M', 'y', 'D', 'r', 'i', 'v', 'e', ' ', ' ', ' ', ' '
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 170 KiB |
Reference in New Issue
Block a user