Skip to content
forked from DmMeta/sshp4ru

A Rust-based reimplementation of sshp, preserving the functionality and CLI interface of the C version, while benefiting from Rust’s memory safety.

License

Notifications You must be signed in to change notification settings

Sofosss/sshp4ru

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo
sshp4ru - Parallel SSH Executor in Rust

MIT rust

sshp4ru is a high-performance, parallel SSH executor, rewritten in Rust, based on the C-based sshp project by Dave Eddy and Rany. This tool is designed to execute SSH commands concurrently across multiple hosts, managing the associated SSH connections efficiently and coalescing the output in a systematic manner.

🚩 Table of Contents

About

The original node-sshp was developed in Node.js and was later rereleased in C. This adaptation was based off the C version, which offered a straightforward solution for managing multiple SSH processes in parallel. The project was well-regarded for its ability to handle a large number of concurrent SSH connections while efficiently managing their output. The sshp4ru project re-implements this functionality in Rust, a systems programming language known for its memory safety, concurrency and performance guarantees. This rewrite ensures that the tool remains robust and resilient to memory-related issues.

Installation

Before using sshp4ru, make sure you have Rust >= 2021 installed on your system.

  1. Clone the repository and navigate to the project's directory:

    git clone https://github.com/Sofosss/sshp4ru.git
    cd sshp4ru
  2. Install the CLI binary:

    cargo install --path . --release

Note

The compiled binary will be located in the ~/.cargo/bin directory (which should be in PATH).

  1. Alternatively, compile the CLI binary and copy it manually:

    cargo build --release
    cp ./target/release/sshp4ru /usr/local/bin
  2. Verify the installation by checking the version:

    sshp4ru --version

Functionality and Interface

  • The functionality of sshp4ru is identical to the C-based implementation of sshp. The core features and behavior have been preserved.

  • The command-line interface (CLI) remains unchanged, meaning you can use sshp4ru in the same way you would use sshp. The only difference is the name of the executable (sshp4ru) when running commands.

  • The handling of exit codes follows the same conventions as the sshp implementation, ensuring compatibility. For detailed information on how exit codes are used, you can refer to the documentation of sshp.

  • To check the functionality of sshp4ru, you can refer to the examples from the C-based version. The interface, arguments and expected results will be the same.

Example:

If the C-based implementation command was:

sshp -f hosts.txt -m 3 uname -v

The equivalent command with sshp4ru would be:

sshp4ru -f hosts.txt -m 3 uname -v

Testing and Style

The test suite included in this version of the project was originally part of the C-based implementation and has since been adapted to the Rust version.

Note

In order to run the tests, you should use cargo build instead of cargo build --release. The compiled binary will be located in the ./target/debug/ directory when using the standard build configuration.

The style requirements are minimal and are incorporated via the cargo fmt command based on rustfmt.toml file. They ensure:

  • Each line has maximum width of 100 columns.
  • Each tab equals 4 spaces.
  • We use spaces both for identation and for alignment.
  • We use a compressed layout of function parameters.

Future Work

In the pursuit of self-improvement, any new suggestions, solutions and potential bug fixes are welcome. Just open an issue or submit a pull request.

The following features and enhancements are potential candidates for future development:

  • Implementing kqueue for event monitoring to enhance event handling on systems that support kqueue.
  • Publish the project on crates.io.
  • Adding a password login timer to enforce a time limit for password-based logins.

Contact

License

Distributed under the MIT License. See LICENSE.md for more details.

About

A Rust-based reimplementation of sshp, preserving the functionality and CLI interface of the C version, while benefiting from Rust’s memory safety.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 94.6%
  • Shell 5.4%