Skip to content

Remotely activating a keylogger script via termius on a raspberry pi

Notifications You must be signed in to change notification settings

al3xxndr/RASPKEYLOGGER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

START HERE:

  1. Set up your Raspberry Pi: Install the operating system (such as Raspbian) on your Raspberry Pi and ensure it is connected to the internet.

  2. Choose a programming language: Select a programming language such as Python to write your keylogger. Python provides libraries that make it relatively straightforward to capture keystrokes.

  3. Implement keylogging functionality: Write a script that captures keystrokes and saves them to a log file. There are Python libraries available, like pynput, that can assist with capturing keyboard events.

  4. Run the keylogger on your Raspberry Pi: Execute the keylogger script on your Raspberry Pi to start capturing keystrokes. Make sure it runs in the background, so it remains undetectable.

  5. Remote access via Termius: Install the Termius app on your iPhone and set up SSH access to your Raspberry Pi. This will allow you to remotely access and control your Raspberry Pi.

  6. Monitor and retrieve logs: Use Termius or any SSH client to connect to your Raspberry Pi remotely. Navigate to the directory where the keylogger is saving logs and retrieve the captured keystrokes.

PYNPUT:

If you're interested in capturing keystrokes in Python, one popular library you can consider is called "pynput." The pynput library provides functionality for controlling and monitoring input devices such as keyboards and mice. With pynput, you can capture keystrokes and perform various actions based on the input.

You can install the pynput library using pip, the Python package installer, by running the following command:

pip install pynput

Once installed, you can import the keyboard module from pynput to capture keystrokes. Here's a simple example that demonstrates how to use pynput to capture and print keystrokes:

SCRIPT EXPLANATION:

The script begins by importing the necessary module keyboard from the pynput package. This module provides functionality for capturing keyboard events.

Next, the script sets the name of the log file as 'keystrokes.log' and initializes an empty string variable called current_sentence, which will be used to store the captured keystrokes.

The script defines a function on_press that is called when a key is pressed. Inside this function, it tries to extract the character representation of the pressed key using key.char. If the pressed key corresponds to a printable character, it appends the character to the current_sentence string. If the pressed key is a special key like the spacebar or the enter key, it appends the corresponding characters to the current_sentence string.

The script also defines a function on_release that is called when a key is released. Inside this function, it checks if the released key is the escape key. If it is, the function returns False, which will stop the listener and exit the script. Otherwise, it opens the log file in append mode and writes the content of the current_sentence string to the file. After writing, it resets the current_sentence to an empty string.

Next, the script creates a listener object by passing the on_press and on_release functions as parameters. This listener object will listen for keyboard events.

The script starts the listener by calling listener.start(), which begins capturing keyboard events. The listener will run in the background while the rest of the script continues executing.

To keep the script running until the listener is stopped, the script calls listener.join(). This command will wait for the listener thread to complete execution before moving on.

In summary, the script captures keystrokes using the pynput library and stores them in a log file. It utilizes the on_press and on_release functions to handle keyboard events and updates the current_sentence string accordingly. The script runs indefinitely, capturing and logging keystrokes until the listener is stopped by pressing the escape key.

HOW TO OPEN THE TEXT FILE:

To open a file using a command in the Raspberry Pi terminal, you can use the nano command, which is a simple text editor available in most Raspberry Pi distributions. Here's how you can use it to open a file:

  1. Open the terminal on your Raspberry Pi.

  2. Navigate to the directory where the file is located using the cd command. For example, if the file is in the /home/pi/Documents directory, you can use the following command:

    cd /home/pi/Documents
    
  3. Once you're in the correct directory, you can open the file using the nano command followed by the filename. For example, if the file is named keystrokes.log, you can use the following command:

    nano keystrokes.log
    
  4. The file will open in the nano text editor. You can navigate through the file using the arrow keys.

  5. If you want to make changes to the file, you can edit the contents using the nano editor. Press Ctrl+O to save the changes and Ctrl+X to exit the editor.

Alternatively, you can use other text editors available in the Raspberry Pi terminal, such as vim or vi, depending on your preference and familiarity.

Remember to replace keystrokes.log with the actual filename of the file you want to open.

If you prefer a graphical interface to open and view the file, you can use a file manager application like Thunar or PCManFM, depending on your Raspberry Pi distribution.

DEPENDENCIES / ISSUES:

  1. sudo apt-get install python3
  2. pip install pynput
  3. If you are remote accessing via termius, before entering "python " enter the command export Display=:0

About

Remotely activating a keylogger script via termius on a raspberry pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages