Skip to content

Inject keystrokes/mousemoves like RubberDucky , but sending via USB serial-port from another PC

License

Notifications You must be signed in to change notification settings

jogi-k/RubberJogi

Repository files navigation

RubberJogi

What is the idea / the usecase ?

  • You want to control a PC from another PC, making keystrokes, eventually mouse-moves.
  • Even when starting up and e.g. entering the BIOS
  • => ssh etc not an option
  • you need to be independent from any "client" on the controlled machine
  • only solution which comes to mind is : USB HID
  • Therefore you connect from PC I somehow to PC II, on PC II as USB-Keyboard

Solution : RubberJogi

+----------------+                                  +----------------+
|                |                                  |                |
|    PC I        |                                  |    PC II       |
|                |          +-------------+         |                |
|  (Controller)  | USB      |             |  USB    |  (Worker)      |
|                +--------->+ RubberJogi  +-------->+                |
|                | serial   |             |  HID    |                |
|                |          +-------------+         |                |
|                |                                  |                |
+----------------+                                  +----------------+
  • PC I connects to RubberJogi via USB-Serial
  • RubberJogi injects Keystrokes etc via USB HID to PC II

Ingredients Hardware

  • Arduino ( with USB-Keyboard capability), e.g. Leonardo, Micro, etc

  • USB-TTL UART Converter , FTDI Serial

  • some cables

    RubberJogi_bb

    RubberJogi_schem

Ingredients Software

  • As it is not possible to send CMD-Keys like ALT, CTRL via serial line, a language has to be used.
  • Avoid to reinvent the wheel ==> Compatible to the famous RubberDucky-Script-Language
  • ==> Based on arducky by Baptiste MOINE (Creased), THANKS!
  • Parser is based on https://github.com/Creased/arducky/blob/master/arducky.ino
  • is partially extended for also sending MOUSE-Movements
  • is already extended to control four additional GPIO-Switches
  • Accepted Commands :
    • All RubberDucky-Commands (not really all...)
    • backspace
    • switch1_on / switch1_off => switching Optocoupler at Pin2
    • switch2_on / switch2_off => switching Optocoupler at Pin4
    • switch3_on / switch3_off => switching Optocoupler at Pin6
    • switch4_on / switch4_off => switching Optocoupler at Pin8
    • boot => switching Optocoupler at Pin2 for 1.5 sec high, then low
    • reboot => switching Optocoupler at Pin2 for 10sec high, then low, after a delay of 2 secs then once more for 1.5 sec high, then low
    • aten => switching Optocoupler at Pin4 for 1.5 sec high, then low

Controlling

For "talking" to the RubberJogi from PC1 you need to configure your serial port to

  • 9600 Baud
  • 8 Bit, 1 Stop-Bit, No parity

If you are using a linux-box you could use the follwing command to achieve this:

stty -F /dev/ttyUSB0 cs8 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
Then you can just try out the functionality of the box with e.g :

  • echo "ENTER" > /dev/ttyUSB0 when you are allowed to use /dev/ttyUSB, or
  • echo "ENTER" | sudo tee /dev/ttyUSB0 when you need to be root to use /dev/ttyUSB

In both cases you should see a moving text-cursor on the second PC (best open an Editor...)

Special Hardware with 2 switches

  • In our/my usecase we also need to control two switches

  • one of these is connected to the reset-button of the PC

  • the other one is connected to the switch of a USB-sharing station, so we can switch a USB-stick between PC1 and PC2 ...

  • more explanations will follow, the code is already able to make use of these

  • here at least are the schematics

  • In case you want (like we do) to switch on PC2 with a command from PC1 you need to connect Vcc between FTDI and Arduino, otherwise the Arduino will not have power when he is connected to a switched of PC ... ( see the green cable below)

  • Unfortunately, it looks like this is backfeeding 5V even to the 2nd PC via USB. This is not a problem if the PC is switched on. BUT : If you have the PC switched off and want to switch it on, then - depending on the PC - it might make some trouble for the PC, as it is never really switching completely off. I need to try this remedy : https://forum.arduino.cc/t/powering-the-arduino-with-a-5v-power-supply/261902/12

  • We tried out this remedy (remove T1 of the ARDUINO) and it works perfect. BUT beware: when you want to re-programm the Arduino you NEED to have the FTDI connected as well to a PC, as otherwise the Arduino is not powered...

  • See here the location of the T1 to be removed: Arduino T1 to be removed

    RubberJogi_with_switch_bb

    RubberJogi_with_switch_schem

Extended Special Hardware with 4 switches

  • in the meantime we even have use-cases where we need to control up to 4 switches

  • as before one of these is connected to the reset-button of the PC (in our case)

  • as before one is connected to the switch of a USB-sharing station, so we can switch a USB-stick between PC1 and PC2 ... (in our case)

  • the other 2 switches are needed to control boot-sel switches of embedded ARM systems

  • here are the additional schematics

  • In case you want (like we do) to switch on PC2 with a command from PC1 you need to connect Vcc between FTDI and Arduino, otherwise the Arduino will not have power when he is connected to a switched of PC ... ( see the green cable below)

  • backfeeding 5V via USB to PC2: see above at the 2-Switch-Solution)

    RubberJogi_with_switch_bb

    RubberJogi_with_switch_schem

Extended Special Hardware with 5 switches and one relay

  • finally (in our application) we need to switch power
  • we introduced a 5th optocoupler, connected to pin10 AND we connected a real relay to that to be able to switch power
  • schematics will follow

Reality

This is one sample-prototype without any switches, just the "plain" RubberJogi. This was soldered "flying" and is only stabilized with heat shrink tube.

RubberJogi_with_4_switches_sample

This is one sample-prototype, with 4 switches, soldered on a veroboard/breadboard

RubberJogi_with_4_switches_sample

These are all 3 prototypes I have built, together on one picture.

  • 2 times extended RubberJogis with 4 switches
  • 1 as a pure RubberJogi, no switches.

Different RubberJogis

Parts-List

What do you need to build a RubberJogi?

Part Rubber
Jogi
Standard
Rubber
Jogi
Two Switch
Rubber
Jogi
Four Switch
Arduino Micro 1 1 1
FTDI USB / Serial Converter 5V capable 1 1 1
Cables between Arduino/FTDI
(Vcc, GND, RxD, TxD)
4 4 4
USB-Cable to Arduino
(USB-A to Micro-USB)
1 1 1
USB-Cable to FTDI
(USB-A to Mini-USB)
1 1 1
Veroboard ? ca 60x50 mm ca 60x50mm
Header Arduino
(when not using already w/ headers)
? 34 34
Header FTDI ? 18 18
Optocoupler 4N25 DIL 0 2 4
Resistor 390 Ohm 0 2 4
Connectors, depends on your needs, e.g 0 2 4
Example: Headers for switches 0 4 8

Links, Ideas