Jump to content

Archived

This topic is now archived and is closed to further replies.

Mr-Protocol

[Version 1] Basic Ducky Code

Recommended Posts

This is what I got done after about an hour of playing. I'm using the Arduino to code it and as a note, you want to put some sort of delay before it starts mashing keys. I figure a 10 second initialization for a "virgin" PC is enough time so I coded a 10 second delay with blink response. Then after that it very quickly opens ipconfig, netstat, tasklist, systeminfo, and a cmd shell with a unique title.

Could be used for a quick stats from a forensic standpoint if you need volatile information such as connection states or tasklist. I have made scripts to do so remotely for my forensic class running from a remote PC so that's why I was just messing around and made this.

/*Programmed By: Mr-Protocol
4-29-2010
Blinks 10 Times (10 second timer)
LED On while working
Opens ipconfig, netstat, tasklist, systeminfo, cmd (with a title change)
LED Off when done
Does NOT loop continuously
*/
int ledPin = 11; //LED is on pin 11
int isDone = 0;
int startdelay = 0;

void setup()
{
  pinMode(ledPin, OUTPUT);
  //Does 10 Sec delay with 10 blinks of LED
    do
    {
     digitalWrite(ledPin,HIGH);
     delay(500);
     digitalWrite(ledPin,LOW);
     delay(500);
     startdelay++;
     }
    while (startdelay < 10);
}

void loop()
{  
  if(isDone < 1)
    {
     CmdCommand("ipconfig");
     delay(250);
     CmdCommand("netstat");
     delay(250);
     CmdCommand("tasklist");
     delay(250);
     CmdCommand("systeminfo");
     delay(250);
     CmdCommand("title I @m h4x0r");
     delay(250);
     Keyboard.print("cls");
     PressAndRelease(KEY_ENTER,1);
     isDone=1;
     pinMode(ledPin,LOW);
    }
}

void CmdCommand(char *Cmd_Command)
{
 CommandAtRunBar("cmd.exe");
 delay(100);
 Keyboard.print(Cmd_Command);
 PressAndRelease(KEY_ENTER,1);
}

void CommandAtRunBar(char  *SomeCommand)
{
digitalWrite(ledPin, HIGH);
Keyboard.set_modifier(128);
Keyboard.set_key1(KEY_R);
Keyboard.send_now();
delay(10);
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
delay(10);
Keyboard.print(SomeCommand);
PressAndRelease(KEY_ENTER,1);
}

void PressAndRelease(int KeyCode,int KeyCount)
{
int KeyCounter=0;
for (KeyCounter=0; KeyCounter!=KeyCount; KeyCounter++)
  {
  Keyboard.set_key1(KeyCode);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.send_now();
  }
}

CommandAtRunBar & PressAndRelease from Irongeek's Code. Why Reinvent the wheel? (Added a delay and lowered initial delay)

Thanks for the Ducky Dev Kit (DDK?) Darren.

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...