Wednesday, April 4, 2012

Teensy USB HID for Penetration Testers - Part 1 - Introduction and Arduino Installation

My first blog post after two back to back awesome conferences Black Hat Europe and Troopers. At Black Hat Europe I conducted a workshop called Teensy Programming for Everyone. The workshop was well recieved by most of the participants. But I found that many of them found it difficult to setup Arduino for usage with Teensy and other basic stuff. So keeping in mind my upcoming trainings at Shakacon and GrrCON I am starting this series of blog posts which during initial posts will detail the basics of Teensyduino installation, structure of sketches and usage of Teensy. In later posts, I will cover Kautilya and its usage. So let's get started.

Teensy is a programmable USB HID from nice guys at pjrc.com. I use Teensy++ (which is an improved version of Teensy) in Penetration Tests for its ability to be used as a programmable keyboard. To start with, this is how you can install Arduino with Teensyduino:


For Windows (Tested on Windows 7 and XP) as an Adminsitrator

1. Download Arduino for Windows.

2. Extract the zip archive.

3. Download Teensyduino for Windows which is a plugin for Arduino. We require this to add support for Teensy in Arduino.

4. Download Windows Serial Installer

5. Run the the downloaded Serial Installer. You will get a warning as the driver is not signed by MicroSoft. Accept it and continue with the installation.




6. Run the Teensyduino, it will check for installed serial driver.Provide the path for the folder where Arduino has been extracted, the "Next" button will be activated only if a Arduino is found at the provided location.


You can choose more libraries to install on the next screen. You can choose to install none, Teensy does not require them.



7. Now you should see more options in Arduino.





For Linux (Tested on Backtrack 5)


1. Download Arduino for Linux.

2. Extract the zip archive.

3. Download Teensyduino 32bit or Teensyduino 64bit depending on your OS. We require this to add support for Teensy in Arduino.

4. Download udev rules. This is required to use Teensy as non root user.

5. Install udev rules

sudo cp 49-teensy.rules /etc/udev/rules.d/

6. Run the Teensyduino, provide the path for the directory where Arduino has been extracted.


7. Now you should see more options in Arduino.


This is it for the first post. Please leave comments and feedback.


UPDATE: If you are facing problems when using Linux make sure you have installed all the dependencies. Read this for more details

14 comments:

  1. Plz help...where can i buy a teensy...i reside in DELHI

    ReplyDelete
  2. I always buy it from the makers pjrc.com. Never tried it, but heard good things about digibay.in

    ReplyDelete
  3. No Mac OS X guide? I know there is Arduino and Teensyduino for OS X but is there anything else that needs to be done? Similar to step 4 in both of the guides above.

    ReplyDelete
    Replies
    1. Sorry, I have tested setting it up on OS X. This could be helpful:
      http://www.pjrc.com/teensy/first_use.html

      Delete
  4. Hi Nikhil

    I'm trying to use the instruction for win7 OS. I made all the items you mentioned. When I upload any program nothing happens. no error no result. Do you have any idea about this problem.

    ReplyDelete
    Replies
    1. What does the Arduino Environment says? Does it ask to reboot the Teensy? Does Teensy gets detected when you connect it for uploading the sketch?

      Delete
  5. Arduino Environment says "Please press the RESET BUTTON on your teensy to upload your sketch. Auto-reboot only works if the Teensy running a previous sketch"

    I checked the device manager. When I attached the teensy I can see under the ports title as Teensy USB Serial . When I press the reset button teensy diappears from device manager.

    Also when I push upload button from arduino teensy disappears from device manager.

    ReplyDelete
    Replies
    1. Looks like you are not selecting correct USB type in Arduino Environment. Make sure you select USBY type as "Keyboard + Mouse+Joystick" under the Tools menu of Arduino.

      Delete
  6. Actually I select "Keyboard + Mouse+Joystick" option from tools USB type menu. I didn't understand what is wrong

    ReplyDelete
  7. Have you tried the Examples for Keyboard in the Arduino Environment under File->Examples->Teensy? See if you could get them running.

    ReplyDelete
  8. Hi Nikhil,

    Thanks for sharing your knowledge.
    I am intending to use this information for a high school practicum.
    Just for my budget estimation: is Teensy the only required hardware ?

    ReplyDelete
  9. Hi Nikhil,

    your project is interesting, which version of teensy should i purchase (using it on kali)

    ReplyDelete

Note: Only a member of this blog may post a comment.