Edit (04-27-10): Lots of changes from the proof of concept
http://www.craigwill.com/Downloads/Fun_With_Base64_v2.zip
Summary:
- Apply LZW compression (~30% size reduction)
- LZW decompression done via VBScript
- Automatic Teensy source file generation (IE, it should be easy to use)
- Program and script the script code is now stored in the Flash memory
Current Goals:
- Port Base64 Library to Teensy, so the compressed binary can be stored
- Optimized/Tweak the LZW library
- Linux Build
- Flat binary file, rather then a ton of global variables
Know Issues
- Current LZW compression will increase the size of already compressed files
(via UPX and similar). Compression should be disabled if the file
grows in size.
- Script file is now a lot larger, since it must handle LZW decompression
- LZW compressor is slow. I was mainly targeting correctness and simplicity.
The best this about this update is the automatic code generation. Namely, you only have to drop a executable on the included program and it'll do nearly all the work for you, including the generation of the Teensy code. It will produce a header file and a source file with everything already compiled into it. Simply add the source to your project, call the provided helper function, and your off!
-- Initial Proof of Concept --
Well, I received my Ducky in the mail yesterday, and I decided to play with it a bit.
Instead of having the Ducky download a file from the web, I wanted to focus on executable uploading from the ducky. This was accomplished by converting the executable to base64 and then back again on the target computer.
I've attached to proof of concept that should run on Windows (only tested on Windows XP). It uses a vbs script with Microsoft.XMLDOM to perform the actual conversion. The program that is encoded was written in assembly. It simply hangs around in the background until you hit the 'z' key. In which case it'll pop up a message box and then terminate.
The same concept can be applied to linux if a program like base64 is installed.
Full project with test program, encode/decode scripts, and the teensy project
http://www.craigwill.com/Downloads/Fun_With_Base64.zip