Wednesday, October 12, 2011

Build your own USB Keylogger

What is it?

A hardware keylogger is an electronic device capable of capturing keystrokes from a PS/2 or USB keyboard. A hardware video-logger is a tiny frame-grabber for capturing screenshots from a VGA, DVI, or HDMI video source.

What you'll Need:
  1. PIC 12F1822 (SOIC Version)
  2. EEPROM 24XX1025 (Any 1Mb version will be ok) (SOIC Version)
  3. 2 * 4k7 Resistor 1/8 W (Or any resistor of the same value as small as you can solder in the adapter)
  4. Pickit 2 / 3 (For programming the pic and reading the eeprom)
  5. An USB to PS/2 Adapter that can be opened.

Steps:

1. Circuit

This is the complete circuit of the Keylogger, it may seem complex, but in real, it isn't.. we'll see why..
It is divided into two "zones":
One is the Adapter, which connect GND and VCC pin of PS/2 connector with their respective pins on the USB Connector and CLK and DAT pin to, respectively, D+ and D- pins.
The other zone is composed by the PIC and the EEPROM (and the I2C required pull-up resistors). The PIC take care of detecting incoming Data from PS/2, decode, and then writing it to the EEPROM.

2.Open up
Open up your USB to PS/2 Adapter, it should look like this.
It simply connects pins from USB female to the PS/2 male connector.
All the wires are glued together with some kind of silicone or something similar, so you have to carefully remove that with a diagonal pliers or anything similar.
You should remain with the separated Female USB and the Male PS/2 connector and the plastic holder.

3. Soldering
Solder the wires as shown above:
  1. VCC - VCC
  2. GND - GND
  3. D+    - CLK
  4. D-     - DAT
Note: See here  for USB Pinout.
See here  for PS/2 Pinout.

4. Soldering PIC and Programming it:


You need to temporarily solder your PIC onto a small piece of surface-mount board or by solder a wire to each pin, one by one.
No matter which way you have chosen, you need to be able to connect your PIC to Pickit 2 or any other PIC programmers that support PIC 12F1822.
The code is written using PCW from CCS, so, if you want to modify the code, feel free to modify or distribute it as you wish, just mention this guide if you want to redistribute it.
I've also attached the .hex file if you want to simply copy the code.
 SMD.hex5 KB                         Source.zip1 KB


5. Soldering PIC and EEPROM:
 

Now precisely solder the PIC with the EEPROM, and the two Pull-Up resistors.
If you aren't an expert in soldering, its advisable to take help from a friend.


6. Read EEPROM

  

After the soldering process, re-assemble your Keylogger, connect to the keyboard that you want to log and wait for the information / data you want to get from this Keylogger.
Then, unplug the Keylogger and re-plug the keyboard.
Now, you have to read from the eeprom, so, If you have soldered also the SDA and SCL pin to the two N/C pin of PS/2 (like it was shown in the circuit) you can now build a simple converter from PS/2 to ICSP connector of your EEPROM-reader (In my case, Pickit 2).
After reading the eeprom memory, you should save it to a file for better usage. You can do this with a simple Hex Viewer.
Remember that the data collected from PIC are pure "keyboard scancodes", so you need to convert to a readable version. I've attached the code file below for the conversion.
KeyLogger Decryptor.zip13 KB


7. Ready to go:

No comments:

Post a Comment