This install guide assumes you are running Ubuntu 22.04 on bare metal.
First, we have to install some prerequisites:
sudo apt install libusb-dev arduino arduino-core arduino-mk
Next, setup the user account to allow the dailout:
sudo chmod a+rw /dev/ttyACM0sudo usermod -a -G dialout $USER
Next, disable brltty to keep it from interfering:
sudo systemctl stop brltty-udev.servicesudo systemctl mask brltty-udev.servicesudo systemctl stop brltty.servicesudo systemctl disable brltty.service
Next, update udev rules to not cause issues:
sudo nano /etc/udev/rules.d/49-micronucleus.rules
# UDEV Rules for Micronucleus boards including the Digispark.
# This file must be placed at:
#
# /etc/udev/rules.d/49-micronucleus.rules (preferred location)
# or
# /lib/udev/rules.d/49-micronucleus.rules (req'd on some broken systems)
#
# After this file is copied, physically unplug and reconnect the board.
#
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
#
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
Reload the udev rules:
sudo udevadm control --reload-rules
Next, run Arduino IDE with sudo and go to File menu, and select Preferences. Then in the Additional Boards Manager Urls, put this link:sudo arduinohttp://digistump.com/package_digistump_index.json
Next, go to Tools menu, then the Boards submenu, select Board Manager. In the Type field, digi and install Digistump AVR Boards.
Next, install micronucleus and replace the version that is installed with Digistump AVR Boards so you don't have errors later:
git clone https://github.com/micronucleus/micronucleus.gitcd micronucleus/commandlinemakesudo make installsudo su -cd ~/.arduino15/packages/digistump/tools/micronucleus/2.0a4/mv micronucleus micronucleus.originalcp /usr/local/bin/micronucleus .exit
Next, plug in a fresh Attiny85 and let's flash it with the latest micronucleus t85 firmware to avoid issues with a flash
cd ~/micronucleus/ # or whereever you cloned the foldersudo micronucleus --run firmware/upgrades/upgrade-t85_default.hex
Next, go to Tools menu, then Boards submenu, Click Digistump AVR Board and select Digispark (Default — 16.5mhz).
Then, copy/paste the code below to make sure everything is working:
#include "DigiKeyboard.h"void setup() {
// don't need to set anything up to use DigiKeyboard
}void loop() {
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.println("Haxored!");
DigiKeyboard.delay(5000);
}
Next, click verify and upload next. Done. Happy haxoring! Open a notepad, and plug in the USB. If it types the word, "Haxored" it worked.
References:
http://digistump.com/wiki/digispark/tutorials/connecting
https://infosecwriteups.com/make-usb-rubber-ducky-with-less-than-3-fa72dac9e4de
https://www.amazon.com/gp/product/B0836WXQQR/
https://koen.vervloesem.eu/blog/how-to-upgrade-the-micronucleus-bootloader-on-the-digispark/