• Teensy USB HID for Penetration Testers - Part 2 - Basics of Arduino and Hello World

    In the first post we installed Arduino Development Environment (ADE). Now lets have a look at basics of Programming Teensy using ADE

    Make sure that proper board is selected from the menu. Then choose the correct device type



    In Arduino Development Environment (ADE), programming is done in a C type syntax. We have variables, methods, conditional operators and pointers etc. A program is called a sketch in ADE.

    Now, let's have a look at sketches. A sketch must have a setup and a loop function. This is a bare minimum sketch and compilation of a sketch will fail in absence of any of these methods. You can compile a sketch even with empty setup and loop functions.

    setup is called when a sketch is started. It is loaded only once. loop function keeps...umm...looping and repeats the code written inside it.



    Let's write a very simple sketch which types "Hello World" on the cursor.

    void setup()

    {

    Keyboard.print("Hello World");

    }

    void loop()

    {

    }
    Now connect your Teensy device to the machine and compile and upload the code to the device by clicking on the Verify button. If you have done everything correctly you the sketch will be compiled and uploaded on the device. The device will reboot and should type out Hello World for you. Congrats you just ran your first sketch !!

    If you move "Keyboard.print" to loop, Teensy will keep typing Hello World indefinitely. We will have a look at Keyboard and other functions in detail in next post.

    If you encounter errors while compiling, double check that you have selected correct board type and device type. When you connect Teensy for the first time it may not type anything, since enough delays have not been introduced and device drivers take nearly 25 seconds to get loaded. Give it another try, it _will_ work.

    If you want your Teensy to type nothing on your machine and want to test this only on a test machine, as soon as the program is compiled and Teensy reboots, press the small reboot key on Teensy and make sure "Auto" reboot is disabled on Teensyloader application (if the Auto button is off i.e. Dark Green in color,it is disabled). Now pull Teensy out of your machine and connect it to a "victim". You can see your device getting detected and type whatever was programmed.

    This is it. This is a very basic post and is intended for first time or basic users of Teensy and ADE. In the next post we will look in more detail about writing Teensy sketches with ADE. Meanwhile, try this and post your comments, insults and feedback.

    Read Part I here http://www.garage4hackers.com/content/117-teensy-usb-hid-penetration-testers-part-1-introduction-arduino-install.html
    Part-III here :http://www.garage4hackers.com/conten...s-arduino.html
    Part-IV-http://www.garage4hackers.com/conten...-kautilya.html
    This article was originally published in blog: Teensy USB HID for Penetration Testers - Part 2 - Basics of Arduino and Hello World started by SamratAshok
  • G4H Twitter

  • Latest Posts

    Arunpreet Singh

    Selective Symbolic Execution(S2E)

    i was looking into some academic research papers ,found this interesting Project

    S2E: Selective Symbolic Execution - Dependable Systems Lab

    Course Related
    Syllabus - CS-617: Testing Software...

    Arunpreet Singh Today, 08:33 AM Go to last post
    liyw

    Thank you Amol for sharing such resourceful...

    Thank you Amol for sharing such resourceful information. If you have any further update on this .. please share that too..

    liyw Today, 12:29 AM Go to last post
    GroundZeroS

    Open challenge to Design the logo for Ground Zero Summit

    Hello All!

    The GroundZero Summit (G0S) is an international platform for Information Security professionals showcasing their research, products and case studies to industry leaders, policy makers,...

    GroundZeroS Yesterday, 12:26 PM Go to last post
    pragyaware

    Hi rohit nice to meet here!! I have also a keen...

    Hi rohit nice to meet here!! I have also a keen interest in this area. So i think i must gain some knowledge from you and you gain some knowledge from me regarding linux server

    pragyaware 05-23-2013, 11:47 AM Go to last post
    "vinnu"

    Yeh i need your help. I have a code that is...

    Yeh i need your help. I have a code that is dynamically generating objects to a browser and carrying all the mutations (dynamically). It takes huge time to crash browser. Tell me how to reduce the...

    "vinnu" 05-23-2013, 10:44 AM Go to last post