Keylogger Script in Rasperrypi with Python

Prakash King
2 min readAug 27, 2019

--

In this article I will show you how to setup keylogger in rasperrypi device.

Boot up your Pi, and attach it to a screen, mouse, and keyboard like a regular desktop computer. Alternatively, you can connect to your Pi via SSH to save the clutter of extra wires. We will cover how to control LEDs whichever method you choose.

Once you are sure the Raspberry Pi is booting up correctly, turn it off again while you build your circuit, to avoid damaging your Pi.

Along with your Raspberry Pi, you will need:

  1. A breadboard
  2. 1 x LED
  3. Jumper wires

here’s keylogger.py file:

Follow the steps below:

  1. Home menu > Programming > Thonny IDE
  2. save file as “Keylogger.py
  3. connect the LED in breadboard with jumper cable to the 5V pin and other jumper wire to GPIO pin 8 (you can choose any pin, but remember the pin)
  4. Type/copy the code in keylogger.py file from above.
  5. click Run symbol in IDE or go to file location > right-click > start terminal >type ‘Python Keylogger.py’ > Click enter
  6. Now your keylogger is running, you can play with your keyboard. go to any window and type something. all contents will be saved with log to key_log.txt file.
  7. when you each time hit the key in keyboard, your led will Blink!
  8. close Terminal or stop in IDE to end the program. now you can view file saved in same location.
keylogger running demo

Final Thoughts

Its always fun playing with rasperrypi. Rasperrypi can be used for many automations and even in robots .I love python because it has more cool features. i appreciate you to make some changes and create new things which comes to your mind. just have fun with learning.

That’s all, thanks! If you liked this post, don’t forget to leave a 👏!

If you found this article interesting and front end development interests you, consider following me on Instagram , Twitter or Linkedin. share it out. Thanks! :)

--

--