The Digispark is an Arduino-compatible development board based on the ATtiny85 microcontroller. Unlike a standard Arduino (ATmega328P), the ATtiny85 is incredibly small and cheap. It doesn't have a dedicated USB chip. Instead, it uses a clever firmware trick called "Micronucleus" to emulate USB signals using software (Bit-banging).
This capability allows it to act as a Human Interface Device (HID)—specifically, a keyboard. This is exactly what we need for a BadUSB attack.
14. Digispark හඳුනාගැනීම (පුංචි මොළකරු)
Digispark කියන්නේ ATtiny85 කියන මයික්රොකන්ට්රෝලර් එකෙන් දුවන හරිම පුංචි බෝඩ් එකක්. සාමාන්ය Arduino එකක USB පාලනය කරන්න වෙනම චිප් එකක් තිබුණට, මේකේ එහෙම නෑ. මේකේ තියෙන්නේ සොෆ්ට්වෙයාර් මගින් USB සිග්නල් හදන තාක්ෂණයක් (Bit-banging).
අපිට වැදගත්ම දේ තමයි, මේ පොඩි බෝඩ් එකට පුළුවන් කම්පියුටර් එකට බොරු කරලා "මම කීබෝඩ් එකක්" කියලා හඳුන්වා දෙන්න. රුපියල් 500-600 කට ගන්න පුළුවන් මේ ගැජට් එකෙන් රුපියල් 20,000ක Rubber Ducky එකක වැඩ ගන්න පුළුවන්.
| Feature | Digispark (Clone) | USB Rubber Ducky (Pro) |
|---|---|---|
| Processor | ATtiny85 (8-bit) | AT32UC3B (32-bit) |
| Memory (Flash) | ~6 KB (Very Small) | SD Card Support (Huge) |
| Scripting | Arduino C++ | Ducky Script (Simple) |
| Price | ~$2.00 (Cheap) | ~$50.00 (Expensive) |
Before you plug the device in, you MUST install the drivers. Since Digispark uses a non-standard USB implementation, Windows won't recognize it automatically. We need the Micronucleus Driver.
Installation Steps:
1. Download the Digispark Drivers (Zadig or Official Micronucleus).
2. Install the drivers BEFORE plugging the device.
3. If using Zadig, select `libusb-win32` driver for the unknown device.
15. ඩ්රයිවර්ස් ඉන්ස්ටෝල් කිරීම (Micronucleus)
වැදගත්ම දේ: බෝඩ් එක ප්ලග් කරන්න එපා! ඊට කලින් ඩ්රයිවර්ස් දාන්න ඕනේ. Digispark එකේ USB සිස්ටම් එක ටිකක් අමුතු නිසා වින්ඩෝස් එකට නිකන්ම මේක අඳුරගන්න බෑ.
පියවර:
1. ඉන්ටර්නෙට් එකෙන් `Digispark Drivers` ඩවුන්ලෝඩ් කරන්න.
2. `DPinst64.exe` (64-bit නම්) රන් කරන්න.
3. ඩ්රයිවර්ස් ඉන්ස්ටෝල් වුණාට පස්සේ තමයි අපි Arduino IDE එක හදන්නේ.
The Digispark is programmed using the standard Arduino IDE, but we need to add the board manager URL first.
Step-by-Step Configuration:
1. Open Arduino IDE > File > Preferences.
2. In "Additional Boards Manager URLs", paste:
http://digistump.com/package_digistump_index.json
3. Go to Tools > Board > Boards Manager.
4. Search for "Digistump AVR Boards" and install it.
5. Select Board: Digispark (Default - 16.5mhz).
16. Arduino IDE සකසා ගැනීම
අපි කෝඩ් ලියන්නේ Arduino සොෆ්ට්වෙයාර් එකේ. හැබැයි ඒකේ මුලින්ම Digispark බෝඩ් එක නෑ. ඒක එකතු කරගන්න ඕනේ.
1. Arduino IDE ඕපන් කරලා `File > Preferences` යන්න.
2. `Additional Boards Manager URLs` කියන තැනට Digistump URL එක දාන්න.
3. `Tools > Board > Boards Manager` ගිහින් "Digistump" කියලා සර්ච් කරලා ඉන්ස්ටෝල් කරන්න.
4. දැන් බෝඩ් ලිස්ට් එකෙන් `Digispark (Default - 16.5mhz)` තෝරන්න.
Now for the exciting part. We will write a script that opens "Notepad" and types a message. This confirms that the Digispark is successfully acting as a keyboard.
Important: Digispark works differently than other Arduinos. You must click UPLOAD first, and plug the USB in ONLY when the console says "Plug in device now".
17. පළමු ප්රහාරය: "Hello World"
දැන් අපි පොඩි ස්ක්රිප්ට් එකක් ලියමු. මේකෙන් වෙන්නේ Digispark එක ගැහුවම, ඔටෝමැටික් "Notepad" ඕපන් වෙලා මැසේජ් එකක් ටයිප් වෙන එක. මේක සාර්ථක වුණොත්, අපේ BadUSB එක වැඩ!
විශේෂ අවවාදයයි: සාමාන්ය Arduino වගේ නෙවෙයි, මේකෙදි මුලින්ම කොම්පියුටර් එකට ගහලා තියන්න එපා. මුලින්ම කෝඩ් එක ලියලා `Upload` බට්න් එක ඔබන්න. ඊට පස්සේ පල්ලෙහා කළු පාට තිරේ "Plug in device now" කියලා වැටුනම විතරක් Digispark එක ප්ලග් කරන්න.
#include "DigiKeyboard.h" // HID Library එක ඇතුළත් කිරීම void setup() { // ආරම්භයේදී යම් කාලයක් බලා සිටීම අනිවාර්යයි (Driver Load වීමට) DigiKeyboard.delay(2000); // 1. Run Dialog එක ඕපන් කිරීම (Windows Key + R) DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT | KEY_R); DigiKeyboard.delay(500); // 2. 'notepad' ලෙස ටයිප් කිරීම DigiKeyboard.print("notepad"); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.delay(1000); // 3. මැසේජ් එක ටයිප් කිරීම DigiKeyboard.print("Hello! This is a BadUSB Attack using Digispark."); DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.print("Your PC is now hacked... just kidding!"); } void loop() { // BadUSB එකකදී අපි Loop එකේ මුකුත් ලියන්නේ නෑ. // නැත්නම් මේක මැෂින් එක ඕෆ් කරනකම්ම දිගටම ටයිප් කරයි! }
Working with Digispark can be frustrating. Here are common errors and fixes:
18. ගැටළු විසඳීම (Troubleshooting)
Digispark එකත් එක්ක වැඩ කරද්දී පොඩි පොඩි ලෙඩ එනවා. මෙන්න විසඳුම්: