Giter Club home page Giter Club logo

blaustahl's Introduction

Blaustahl Storage Device

The Blaustahl USB dongle provides long-term storage for about 8000 characters of text. Simply plug the device into your computer and open any serial communications program that supports VT100 emulation (PuTTY, Tera Term, Minicom, screen, etc.) in order to access the built-in text editor.

Blaustahl

This repo contains schematics, firmware and a 3D-printable case.

Find usage instructions and more information on the Blaustahl product page.

Connecting Blaustahl

The following sections will describe how to connect to Blaustahl on different operating systems. Once you're connected, press CTRL-G to view the on-device help screen.

Linux

  1. Install screen or minicom:
$ sudo apt install screen
$ sudo apt install minicom
  1. After plugging in Blaustahl, find the device:
$ dmesg | grep ACM
  1. Connect to the device (for example):
$ screen /dev/ttyACM0
or
$ minicom -D /dev/ttyACM0

If the device is already plugged in and you see nothing, you may need to press CTRL-L to refresh the display.

OS X

  1. Open the Terminal application.

  2. After plugging in Blaustahl, find the device:

$ ls /dev/tty.usbmodem*
  1. Connect to the device (for example):
$ screen /dev/tty.usbmodem1234561

Windows

Note: The default firmware isn't currently recognized by Windows, please update your firmware to blaustahl_cdconly.uf2 in order to access Blaustahl from Windows.

After the latest cdconly firmware is installed:

  1. Download and install PuTTY.

  2. After plugging in Blaustahl, find the device by opening Device Manager and looking under "Ports (COM & LPT)" for "USB Serial Device (COMx)".

  3. Open PuTTY and set connection type to Serial. Enter COMx (e.g. COM4) in the serial line box and press the Open button.

Using Blaustahl

Blaustahl includes a built-in text editor with four 80x24 pages of text. The cursor can be moved with the arrow keys. When you'd like to enter or delete text, press CTRL-W to toggle the write mode.

Keypress Action
CTRL-G Help
CTRL-L Refresh screen
CTRL-W Toggle write mode
CTRL-S Toggle status bar
CTRL-Y Enter firmware update mode
PGUP/DN Navigate between pages
CTRL-A or ^ Move to beginning of line
CTRL-E or $ Move to end of line

Software

The 'bs' utility program can be used to read and write the FRAM data. Note that it's not possible to use this utility with the cdconly firmware.

Build and install:

If using OS X:

$ brew install libusb

If using Linux:

$ sudo apt install libusb-1.0-0-dev

Then:

$ cd sw
$ make
$ sudo make install
$ sudo bs -r my-backup.bin

Firmware

The firmware can be updated over USB by pressing CTRL-Y in the text editor to enter the UF2 bootloader mode. You can also enter the bootloader by holding the button while plugging in the device.

Once in bootloader mode, you can update the firmware by dragging and dropping a new UF2 file to the device.

There are two firmware images available:

  • blaustahl.uf2: USB composite device with USB-CDC and vendor interface
  • blaustahl_cdconly.uf2: USB-CDC simple device

The vendor interface allows you to access the 'bs' utility and to develop custom software that interfaces with Blaustahl.

You can build the firmware from source, if you have pico-sdk installed:

$ cd firmware/blaustahl
$ mkdir build
$ cd build
$ cmake ..
$ make

Future data recovery

In the event that the USB interface were to become obsolete or the RP2040 were to become non-functional, it should still be possible to recover the FRAM data using a SOP-8 test clip. The FRAM IC is marked "RS64".

One way to achieve this today is to load the Blaustahl firmware onto a Raspberry Pi Pico using the same SPI GPIOs as shown in the schematics, then hold the Blaustahl boot button while attaching a test clip to the FRAM IC. The text editor or 'bs' utility can then be used to recover the FRAM data.

License

The contents of this repo are released under the Lone Dynamics Open License.

blaustahl's People

Contributors

inc avatar

Stargazers

Wei avatar  avatar pazzazzo avatar Anthael avatar Ursus Nocte avatar Antoine James Tournepiche avatar Gabriel Trabanco avatar Matt avatar  avatar  avatar septs avatar  avatar  avatar  avatar  avatar akrabu ๐“†ซ avatar Jan Ferme avatar Omkara avatar stuffbymax avatar ashkan avatar Vinicius Emidio Bosi avatar  avatar  avatar  avatar Steffen / ampoff avatar  avatar Mike Tsao avatar  avatar  avatar CoSailer avatar molety avatar Samuel avatar Eliah Rusin avatar Thomas Leplus avatar  avatar Antares avatar ptfn avatar IemandDood avatar  avatar  avatar Katia Esposito avatar Aratara_1337 avatar Manuel Imboden avatar David Dias avatar  avatar  avatar  avatar Abe avatar

Watchers

Marco Boehrs avatar akrabu ๐“†ซ avatar  avatar Machdyne UG avatar

blaustahl's Issues

Experimental encryption support

There is now a branch with experimental authenticated encryption support.

There is no firmware image available yet, so you will need to build the branch from source if you want to try this. Please don't use this if you have any valuable information on the device as it is still very experimental and total loss of data is very likely to occur.

I'm making this available now because it will require significant testing and auditing in order to be useful to most users. If you run into any issues or find problems in the code please let me know.

A quick explanation of how it works:

In order to enable encryption, press CTRL-P and enter a password or passphrase.

The device generates a random salt and stores it in FRAM. It appends the salt to your chosen password and then hashes them using SHA256. The result is the encryption key.

Blaustahl then encrypts the current FRAM contents using ChaCha20-Poly1305 and stores the metadata (nonce and authentication tag) and encrypted data in FRAM.

While encryption is enabled, the device uses buffered mode, in which all editing takes place in an SRAM buffer, that can be encrypted and written to FRAM by pressing CTRL-W.

Each time data is written, the nonce is incremented and the authentication tag is updated.

When you remove the device and plug it back in, you will need to press CTRL-P in order to enter your password, before you're able to view or edit text.

It is possible to disable encryption after entering a valid password by using the command line interface (CTRL-C):

Blaustahl> disable_encryption

This causes Blaustahl to disable encryption and write the plaintext to FRAM. It's then possible to use either buffered mode or direct mode (which uses CTRL-W to toggle read-only/read-write).

BS Utility

Okay I'm trying my hand at the BS utility. It compiles just fine. But when I go to use it, this is all I can get. Right now I have 7,668 bytes stored via the regular interface, so I would assume I'd see something more meaningful than this.

Screenshot 2024-06-25 at 8 48 17 PM

Not working with screen

Context:

  • Linux: 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux,
  • Screen version 4.09.00 (GNU) 30-Jan-22

I'm afraid it's not working properly in this context with "screen": after intial connect it scrambles content and freezes. Reconnect doesn't help. Ctrl-W does not toggle back and Ctrl-L, Ctrl-G, are not working.
Are you sure that this configuration is supported?
I switched to minicom as it appears much more stable.

Encryption, compression, and Base64 encoding

This isn't really a feature request. It's more of a tutorial / possible inspiration for whoever comes across it. Wasn't sure where else to put it.

As an experiment to see how much data I could cram onto my Blaustahl, along with encryption... I put everything I wanted into a text file, saved it as "pw.txt", then ran...

brotli pw.txt
openssl enc -aes-256-cbc -salt -in pw.txt -out pw.txt.aes
base64 -b 80 -i pw.txt.aes -o pw.txt.aes.b64

The result was compressed, encrypted, and Base64 encoded... resulting in 2,564 bytes stored in 1,587 bytes.

Then I opened the .b64 file up with a text editor, opened the Blaustahl interface via Screen, switched on write mode, ensured the cursor was at the very beginning, then copied and pasted 24 rows at a time, pasting into the Blaustahl interface. It worked like a charm! (Note: the status bar may get in your way - if you can't hide it, you might try pasting 23 rows at a time instead and leaving the status bar line blank)

For the fun of it, I then copied it all back out a page at a time, ran the process in reverse, and there was all my data. :)

Now it would be cool if this was all built in somehow - but even if it isn't, doing it manually isn't too hard. I wouldn't want to do much more than 8KB, though haha

Feature requests / possible bugs

Hello! Loving my Blaustahl so far.

A few feature suggestions for the built-in text editor...

  • CTRL+A: Go to the beginning of the line
  • CTRL+E: Go to the end of the line
  • CTRL+K: Delete entire line
  • PGUP: Move cursor to top, then if pressed again (or already on bottom), go to the next page up
  • PGDN: Move cursor to bottom, then if pressed again (or already on bottom), go to the next page down
  • When pressing โฌ…๏ธ at the beginning of a line, it would be nice if it would go to the end of the prior line
  • When pasting information, it would be nice if it would erase the entire line. If you have "abcdefg" and paste "123" with the cursor on "a" you'll end up with "123defg". It would be helpful if it would go ahead and nullify the rest of the line as well.

Bugs in the text editor

  • I'm running v0.0.4 and when I press CTRL+S to hide the status bar, it doesn't appear to do anything?
  • When on the last column #80 on any line, if you type a character, you can't backspace it out. Only the delete key will remove it - except a lot of keyboards don't have a delete key.
  • Backspacing out the final line removes one character at the end of the previous line: https://v.usetapes.com/OwkU6QexWE

Firmware needed fro operation

You need to also store the firmware in durable storage, else when the flash holding the firmware forgets it the device is bricked.

Windows doesn't recognize USB composite firmware

Windows fails to recognize the device when running the (default) USB composite firmware.

As a workaround there is now an alternative CDC-only firmware that is successfully recognized by Windows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.