Skip to content

k4pil/Pentest-automation-raspberry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Offloading Resource-Intensive Tasks to Raspberry Pi (or IoT Devices) Using SSH

This Python script empowers you to offload computationally intensive tasks to a Raspberry Pi or other IoT devices connected to your network, all via SSH. By utilizing this script, you can automate remote task execution and reduce the burden on your primary system.

Prerequisites

Before deploying this script, ensure the following prerequisites are met:

  • Python 3.x
  • paramiko library (install with pip install paramiko)
  • dotenv library (install with pip install python-dotenv)
  • SSH access to the target Raspberry Pi or IoT device with appropriate permissions

Setup

  1. Clone this repository and navigate to the project directory.

  2. Create a virtual environment (venv) to isolate project dependencies:

    python3 -m venv venv
  3. Activate the virtual environment:

    • On macOS and Linux:

      source venv/bin/activate
    • On Windows:

      .\venv\Scripts\Activate.ps1

      OR

      .\venv\Scripts\activate.bat
  4. Create a .env file within the project directory with the following structure:

    server=your_server_hostname
    port=your_ssh_port
    user=your_ssh_username
    password=your_ssh_password
    ssh_public_key=your_public_key_path  # (Only if using public key authentication; use forward slashes for paths on Windows)
    

    Replace your_server_hostname, your_ssh_port, your_ssh_username, your_ssh_password, and your_public_key_path with the actual server details and authentication methods for your Raspberry Pi or IoT device. On Windows, use forward slashes (/) in the ssh_public_key path.

  5. Install the required packages from requirements.txt:

    pip install -r requirements.txt

Usage

Execute the script from the command line, specifying the desired command and its arguments:

python3 run.py -b <base command> -a <arguments> [-s] [-n] [-p]
  • -b <base command>: The core command you wish to execute remotely (e.g., python, ffmpeg, curl).
  • -a <arguments>: Additional arguments or options to accompany the base command.

Optional Flags:

  • -s or --save-output-remote: Save the command output to a file on the remote device.
  • -n or --no-output-local: Do not display the output in the terminal (useful for background tasks).
  • -p or --use-public-key-remote: Use public key authentication for the SSH connection (requires specifying ssh_public_key in the .env file).

For example:

python3 run.py -b python -a my_script.py

This will run the my_script.py Python script on the Raspberry Pi or IoT device and display the output.

Features

  • SSH Connectivity: The script securely establishes an SSH connection with the remote Raspberry Pi or IoT device.

  • Command Verification: It checks if the specified base command is available on the target device before execution.

  • Remote Execution: Offload compute-intensive tasks to the remote device, freeing up resources on your primary system.

Note

  • Ensure that you possess valid SSH access rights and permissions for command execution on the Raspberry Pi or IoT device.

  • Exercise caution when utilizing this script, especially with potentially resource-intensive tasks, to avoid overloading the remote device.

Feel encouraged to contribute to this project or report any encountered issues.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages