About PotatoParser

PotatoParser is a converter from Ducky Script to Arduino sketches

Prehistory

Once, wandering through the Internet, I came across an unusual device - Rubber Ducky from Hak5, the main function of which was an imitation of the keyboard (BadUSB attack). It cost quite a lot (50$!), so I decided to order a slightly different Rubber Ducky - from Aliexpress. Inside there was a trimmed Arduino Micro SS board. I found only one Ducky Script converter to Arduino sketch on the Internet, but I couldn’t use it because of problems with the dependent HID-Keyboard.h library. As a result, I wrote various scripts with my hands and found that the text being printed depends on the current layout of the user’s keyboard, and if it is different from English, the whole attack could have failed (I have a Russian one). This prompted me to write my own parser with many additional functions

Advantages

Unfortunately nothing is perfect, just like my parser

Pros

  • Uses pre-installed Keyboard.h library at background which eliminates the excruciating problem of installing dependencies

  • Parser supports Alt codes, thanks to which you can print text regardless of the current victim keyboard layout

  • The output sketch is well optimized in memory. This allows you to convert large enough scripts with long texts without fear of overflowing your microcontroller’s memory

Cons

  • I tried to implement almost all the keyboard commands of the original Ducky Script language, but as unnecessary, I omitted the mouse commands

  • Unfortunately, the Keyboard.h library does not support all boards, but only those

    These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer [1]