Jump to content

Dаrren Kitchen

Active Members
  • Posts

    107
  • Joined

  • Last visited

Posts posted by Dаrren Kitchen

  1. I've got some of my code, and notes, here:

    http://www.irongeek.com/i.php?page=securit...eystroke-dongle

    Also, I'm working on a basic library of functions, but to give you an idea of how simple it is to code for the Teensy, here is some source (note, it does a lot of stuff, including driving an RGB LED):

    /*
      The following is Irongeek's diag code
     To learn more about Teensyduino see:
    http://www.pjrc.com/teensy/teensyduino.html
     Look in arduino-xxxx\hardware\teensy\cores\tensy_hid\usb_api.h for key definitions
     Edit arduino-xxxx\hardware\teensy\cores\tensy_hid\usb_private.h to change USB Vendor and Product ID
     */
    
    // The setup() method runs once, when the sketch starts
    int thispin;
    int PhotoRead = analogRead(0);
    int OldPhotoRead = PhotoRead;
    int ledPin =  11;   
    int redPin =  15;
    int greenPin =  12;
    int bluePin =  14;
    int redIntensity = 0;
    int greenIntensity = 128;
    int blueIntensity = 128;
    int rRate = 1;
    int gRate = -1;
    int bRate = 1;
    
    int DIP_0 = 2;
    int DIP_1 = 3;
    int DIP_2 = 4;
    int DIP_3 = 5;
    int DIP_4 = 6;
    int DIP_5 = 7;
    int DIP_6 = 8;
    int DIP_7 = 9;
    int DIP_8 = 10;
    
    
    void setup()   {                
      // initialize the digital pin as an output:
      for (int thispin=0; thispin <=10;thispin++){
        pinMode(thispin, INPUT_PULLUP); // Dip
      }
      pinMode(ledPin, OUTPUT);     
    }
    
    // the loop() method runs over and over again,
    // as long as the Arduino has power
    
    void loop()                     
    {
      //delay(250);
      if (!digitalRead(0)) {
        ShowDiag();
        RGBLEDOff();
      }
    
      //Please note: I use negative logic here, when a pin goes to ground the code us run.
      PhotoRead = analogRead(0);
      if (!digitalRead(DIP_1)) {
        if (abs(PhotoRead - OldPhotoRead) > 50 ) {
          LightDiag();
        }
      }
    
      /* This section sends a command to the run bar, finds the drive letter by its volume name (MYTHUMB in
       this example, and case sensitive), then runs your script. Thanks to Tim Medin for this more
       elegant command line then what I had for finding the
       thumbdrive by volume name.
       */
      if (!digitalRead(DIP_2)) {
        if (abs(PhotoRead - OldPhotoRead) > 50 ) {
          CommandAtRunBar("cmd /c for /F %i in ('WMIC logicaldisk where \"DriveType=2\" list brief ^| find \"MYTHUMB\"') do %i\\myscript.bat");
          delay(2000);
          ShrinkCurWin();
        }  
      }
    
      if (!digitalRead(DIP_3)) {    
        WindowsLockStation();
      }
    
      if (!digitalRead(DIP_4)) {    
        MouseWiggle();
      }
    
      if (!digitalRead(DIP_5)) {    
        WebIG();
      }
        if (!digitalRead(DIP_6)) {    
        FacebookPost("Test from Phukd device, more info at http://www.irongeek.com/i.php?page=securit...-dongle");
      }
      if (!digitalRead(DIP_7)) {    
        DoRGBStuff();
      }
    
      if (!digitalRead(DIP_8)) {
        DoCOPStuff();
      }
    
      digitalWrite(ledPin, LOW);  
    
    }
    
    //********************************************************************
    //********************************************************************
    void CommandAtRunBar(char *SomeCommand){
      //digitalWrite(ledPin, HIGH);   // set the LED on
      Keyboard.set_modifier(128); //Windows key
      Keyboard.set_key1(KEY_R); // use r key
      Keyboard.send_now(); // send strokes
      Keyboard.set_modifier(0); //prep release of  control keys
      Keyboard.set_key1(0); //have to do this to keep it from hitting key multiple times.
      Keyboard.send_now(); //Send the key changes
      delay(1500);
      Keyboard.print(SomeCommand);
      Keyboard.set_key1(KEY_ENTER);
      Keyboard.send_now();    
      Keyboard.set_key1(0);
      Keyboard.send_now();  
    }
    //********************************************************************
    
    //********************************************************************
    void ShrinkCurWin(){
      Keyboard.set_modifier(MODIFIERKEY_ALT);
      Keyboard.set_key1(KEY_SPACE);
      Keyboard.send_now();
      Keyboard.set_modifier(0);
      Keyboard.set_key1(0);
      Keyboard.send_now();  
      Keyboard.print("n");
    }
    //********************************************************************
    
    //********************************************************************
    void PressAndRelease(int KeyCode,int KeyCount){
      int KeyCounter=0;
      for (KeyCounter=0;  KeyCounter!=KeyCount; KeyCounter++){
        Keyboard.set_key1(KeyCode); // use r key
        Keyboard.send_now(); // send strokes
        Keyboard.set_key1(0);
        Keyboard.send_now(); // send strokes
      }
    }
    //********************************************************************
    
    //********************************************************************
    void ShowDiag(){
      //digitalWrite(ledPin, HIGH);
      for (int thispin=0; thispin <11;thispin++){
    
        if (!digitalRead(thispin)) {
          //digitalWrite(ledPin, HIGH);   // set the LED on
    
            Keyboard.print(thispin);
          Keyboard.println(" is low");
        }
        else{
          //Keyboard.print(thispin);
          //Keyboard.println(" is high");
        }
      }
      Keyboard.print("analog pin 8 is: ");
      Keyboard.println(PhotoRead);
    }
    //********************************************************************
    
    //********************************************************************
    void DoRGBStuff(){
      // Begin RGB Code   
      analogWrite(redPin, redIntensity);
      analogWrite(greenPin,greenIntensity);
      analogWrite(bluePin, blueIntensity);
      // remain at this color, but not for very long
      delay(10);
      redIntensity = redIntensity + rRate;
      greenIntensity = greenIntensity + gRate;
      blueIntensity = blueIntensity + bRate;
      if (redIntensity == 255) {
        rRate = -1;
      }
      if (redIntensity == 0) {
        rRate = 1;
      }
      if (greenIntensity == 255) {
        gRate = -1;
      }
      if (greenIntensity == 0) {
        gRate = 1;
      }
      if (blueIntensity == 255) {
        bRate = -1;
      }
      if (blueIntensity == 0) {
        bRate = 1;
      }
      // End RGB Code
    }
    //********************************************************************
    
    //********************************************************************
    void DoCOPStuff(){
      // Begin RGB Code   
      analogWrite(redPin, 255);
      analogWrite(greenPin,0);
      analogWrite(bluePin, 0);
      delay(50);
      analogWrite(redPin, 0);
      analogWrite(greenPin,255);
      analogWrite(bluePin, 0);
      delay(50);
      analogWrite(redPin, 0);
      analogWrite(greenPin,0);
      analogWrite(bluePin, 255);
      delay(50);
      // End RGB Code
    }
    //********************************************************************
    
    //********************************************************************
    void RGBLEDOff(){
      analogWrite(redPin, 0);
      analogWrite(greenPin,0);
      analogWrite(bluePin, 0);
    }
    //********************************************************************
    
    //********************************************************************
    void LightDiag(){
      digitalWrite(ledPin, HIGH);   // set the LED on
      CommandAtRunBar("notepad.exe");
      delay(1000);
      Keyboard.print("Movement! Current light: ");
      Keyboard.print(PhotoRead);
      Keyboard.print(" Old light: ");
      Keyboard.println(OldPhotoRead);
      PressAndRelease(KEY_F5,1);
      OldPhotoRead = analogRead(0);
    }
    //********************************************************************
    
    //********************************************************************
    //Locks the workstaion if you are in Windows
    void WindowsLockStation(){
      digitalWrite(ledPin, HIGH);   // set the LED on
      Keyboard.set_modifier(MODIFIERKEY_CTRL|MODIFIERKEY_ALT);
      Keyboard.set_key1(KEY_DELETE); // use delete key
      Keyboard.send_now(); // send strokes
      Keyboard.set_modifier(0); //prep release of  control keys
      Keyboard.set_key1(KEY_ENTER); 
      delay(1500);
      Keyboard.send_now(); //Send the key changes
      Keyboard.set_key1(0); 
      Keyboard.send_now();
    }
    //********************************************************************
    //********************************************************************
    //Moves the mouse around and clicks to be annoying 
    void MouseWiggle(){
      digitalWrite(ledPin, HIGH);   // set the LED on
      Mouse.move(random(-100, 100) ,random(-100, 100) );
      Mouse.click();
    }
    //********************************************************************
    //********************************************************************
    //Opens a browser to http://irongeek.com
    void WebIG(){
      digitalWrite(ledPin, HIGH);   // set the LED on
      CommandAtRunBar("cmd /c start http://irongeek.com");
    }
    //********************************************************************
    //********************************************************************
    //Make a facebook post, assumes the person is logged in.
    void FacebookPost(char *SomeString){
      digitalWrite(ledPin, HIGH);   // set the LED on
      CommandAtRunBar("cmd /c start http://m.facebook.com");
      delay(6000);
      PressAndRelease(KEY_TAB, 8);
      Keyboard.print(SomeString);
      PressAndRelease(KEY_TAB, 1);
      PressAndRelease(KEY_ENTER, 1);
    }
    //********************************************************************
    
    
    

  2. I've updated my site, and the code:

    http://www.irongeek.com/i.php?page=securit...eystroke-dongle

    I think I need to add some of your functions, just to make coding keystroke easier. I've made a function to repeat keystrokes you have to hit many times in a roll, like tab. I've also added better code for checking the photoresistor and doing something based on light, and a timer function so you can leave the PHUKD behind to wait for someone to login.

  3. I've put OpenSSH on mine. It's a little slower that I imagine Dropbear would be, but more full featured. I made it the default on the Side-Track distro, but if you use RootNexus it's just a apt-get away.

  4. I've posted my Unicode and LSB stego code. The link is at the bottom of this post. I hope this is the right form to post it in. If not, please move. I need to work on fiding better homoglyphs so the font does not look so weird, and URL encoding. Assuming the forum system does not mangle it, there should be a hidden message in this post.

    http://www.irongeek.com/i.php?page=securit...-lsb-stego-code

  5. Back in the day, I was using the VIClient to access my VMWare Server. I belive I had to connect to Server_IP:WebPort with my login credentials. I'm not quite sure what's the difference between the viClient and vSphere Client is but try to also login using your vSphere Client but specify the web port (I believe it is 8333).

    Thanks, but I've tried that with no luck. If anyone knows a link to download the old viclient please let me know.

  6. The Web interface with the browser plugin for Vmware Server 2.0.2 on Windows 2008 sort of works in my LAN, but connecting to it from the Internet is a problem. You can start and stop VMs, but bringing up a VM's console does not work at all, with errors about having a bad password even though it worked fine for connecting in. I've tried installing the vSphere client, but to no avail, it want's to download support files from the server that are not there. Anyone know an alternative to the craptasic web interface for VMWare server 2.x?

  7. Anyone else here mess thie AVISynth for video editing?

    I use this script for making videos that look like the presentations for Defcon:

    #Defcon style video composite AviSynth script by Adrian http://irongeek.com
    #The next line is mostly for specifying and resizing the live video to put in the corner.
    #It also does some other filtering to make the video specs match. Use the Trim function to make things sync.
    livevid = DirectShowSource("file0003.avi").ConvertToRGB24().LanczosResize(208,156).Trim(300,0,false).ConvertFPS(25)
    #The line tells the script what to use for the large section of the video where I put the slide show/what was being projected
    slides = DirectShowSource("issasc_transcoded.avi").ConvertToRGB24().LanczosResize(640,480).Trim(0,0,false).ConvertFPS(25)
    #Just a for a logo for the corner, I use it to give info avout the presentation. Has to be 208x324.
    corner = ImageSource("corner.png",pixel_type="RGB24").ConvertFPS(25)
    #Now to dd all the file together
    livepluscorner = StackVertical(livevid,corner).AudioDub(livevid)
    StackHorizontal(livepluscorner,slides)

    Also, I like AVIDemux, but it's a pain to set up for batch conversions. With Mediacoder, I can transcode just about any video format, even AVISynth scripts:

    http://mediacoder.sourceforge.net/

×
×
  • Create New...