0x00 What is Arduino
Arduino is actually a development board, the microcontroller and the necessary components integrated into a circuit board, expand the perfect interface and pins, you can connect a variety of sensors, complete the design of your mind, you can also understand it as an electronic building block, because it does not need to weld, Also does not need the advanced radio knowledge, only needs the programming foundation and the basic circuit knowledge.
Arduino does not need to know the underlying knowledge of various hardware, these low-level calls have been implemented in advance for you, and it uses the C language rather than the assembly, with an official IDE and a variety of hardware call library, you just need to plug in your own design of a variety of hardware, you can start to write programs, After writing the microcontroller (which is called the download in the Arduino), they will start running automatically. It is an open source hardware, the circuit diagram is open, and now the official and expansion of the various Arduino board has been added up to hundreds of kinds.
Aduino's official website: http://www.arduino.cc, to do the following, download the official Arduino IDE and install it, in the IDE installation directory of the drivers subdirectory, there is the need to burn write Arduino USB to serial port driver, You must install the driver before you can start programming.
0X01 Module
1. Arduino nano/micro/Mini a 30 yuan or so 2. Bluetooth module A 20 yuan or so 3. Several conductors A lump of about 3 yuan
With the Nano of the cottage (the actual combat words have to pull out the needle, welding wire) can also, the price of about 10 yuan. Mini is also good, the price is about 10 yuan, but need a USB TTL to burn the program. Micro Cottage about 30 yuan, this is smaller than the Nano, with the Mini, the board can simulate keyboard and mouse to achieve hid attacks, equivalent to Teensy. Nail size Lilypad may be, I do not have this board, not very clear about the situation of the board.
While the actual combat, the Arduino pin out, directly to the two modules welded up, the size is almost the following, because the wire will be slightly larger than the following.
0x02 Ideas
The original idea is to use the micro-board to receive the PS2 keyboard and then in the micro-simulation into the keyboard forward. But because I could not completely decode the key information of the PS2 keyboard, I changed a thought. directly with the board in parallel to the connection line, so that the keyboard issued key information will follow the line to reach two places, one is a computer, one is our recorder.
0x03 principle
PS2 a total of 6 pins: clock clocks, GND ground, data data and 5V power supply, the remaining two are unused reserved ports, arranged in order as shown:
Clock and data are used to intercept key messages, and the remaining two are used to power keyboards and devices.
Wiring diagram:
It seems that the connection is a little confusing, in fact it's quite simple. Keyboard normal connection to the computer is not changed, just need to connect the computer in the keyboard of the line of these four wires lead wires connected to the board.
The Bluetooth module also needs to connect four wires
0x04 Connection Hardware
Is the whole point of the device, the actual wartime welding line without the DuPont line and PIN can be compressed to the U-disk size, and the power supply directly from the keyboard. This device can be plugged into the keyboard to achieve covert monitoring, because the use of the method is not forwarded, even if the circuit failure (as long as the welding, the possibility is very low) will not affect the normal use of the keyboard. The size of the weld is as good as the beginning of the article.
0x05 Burn Write Program
First you need to download a library file and unzip it into the Librarys folder in the Arduino IDE installation directory. Then use the Arduino IDE to write the program to the Board, in the Tool menu bar Select the model of the Board, the selection number corresponding to the serial number. Burn Write the following procedure
#include <PS2Keyboard.h>Const intDatapin =3;Const intIrqpin =2; Ps2keyboard keyboard;voidSetup () {Delay ( -); Keyboard.begin (Datapin, Irqpin); Serial.begin (9600); Serial.println ("Keyboard Test:");}voidLoop () {if(Keyboard.available ()) {//read the next key Charc =Keyboard.read (); //Check for some of the special keys if(c = =ps2_enter) {serial.println (); } Else if(c = =Ps2_tab) {Serial.print ("[Tab]"); } Else if(c = =Ps2_esc) {Serial.print ("[ESC]"); } Else if(c = =Ps2_pagedown) {Serial.print ("[PgDn]"); } Else if(c = =ps2_pageup) {Serial.print ("[PgUp]"); } Else if(c = =Ps2_leftarrow) {Serial.print ("[left]"); } Else if(c = =Ps2_rightarrow) {Serial.print ("[Right]"); } Else if(c = =Ps2_uparrow) {Serial.print ("[up]"); } Else if(c = =Ps2_downarrow) {Serial.print ("[Down]"); } Else if(c = =ps2_delete) {Serial.print ("[Del]"); } Else{serial.print (c); } }}
Mobile phone above using Bluetooth SPP connected to the bluetooth® serial port, you can see the keyboard real-time key information.
I use a notebook, no PS2 port, so I use another Arduino board as a computer. So you'll see a piece of stuff in the video, but the device has only two small boards, and the rest is for simulating the computer.
* in Upload *
Video can be seen when the key, the phone's Bluetooth terminal in real-time to receive key data, while the computer also received the key information. It can be seen that the device does not affect the communication between the keyboard and the computer, just listen to what they are talking about.
0x06 Other issues
Some areas also need to be perfected:
1 The function key part is not recognized (but does not affect keyboard use) 2. Key information can also be cheaper, smaller, transmission distance of the nrf24l01+, the code is a bit complicated (for I have not studied understand)3. The Arduino itself provides EEPROM memory, But the capacity is only 1k, so does not store the key information above, if the keyword triggered to write to the storage, maybe a bit of use. can also use the Micro SD card module, the key information stored in the memory card, wait until someone connected to the device via wireless send out. I didn't buy this module, so this piece didn't do.
In addition, you can do smaller and cheaper! Welcome advice!
50 Yuan making PS2 keyboard wireless monitoring device