Skip to content

A simple multithreaded SSH credential tester.

License

Notifications You must be signed in to change notification settings

bs3vcenk/massh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

massh

This Python script can be used to quickly test out a SSH key or a credential pair on several hosts.

Installation

The easiest way to install massh is to use pipx (install it if you don't have it):

pipx install git+https://github.com/bs3vcenk/massh

This will install massh in an isolated environment, and you can run it with massh.

Alternatively, you can clone the repository and install the dependencies manually:

git clone https://github.com/bs3vcenk/massh
cd massh
# Optional: create a virtual environment
python3 -m venv venv
source venv/bin/activate
# Install the dependencies
pip install -r requirements.txt

Get started

Say you have a list of IPs and ports in a file called hosts.txt:

192.168.1.11:22
192.168.1.12:22
192.168.1.13:22

You can use massh to test an SSH key on these hosts:

./massh.py -f hosts.txt -u root -i ~/.ssh/id_rsa

Or, you want to run a command on the hosts:

./massh.py -f hosts.txt -u root -p 123456 -c "uname -a"

If you have a Shodan API key, you can use it to search for hosts:

./massh.py -k SHODAN_KEY --query "OpenSSH" -u root -p 123456

Usage

usage: massh [-h] (-f FILE | -k SHODAN_KEY) [-q QUERY] -u USERNAME (-p PASSWORD | -i SSH_KEY) [-c CMD] [-o FILE] [-t THREADS] [--limit LIMIT] [--debug]
             [--singlethreaded]

massh (Mass-SSH): multithreaded ssh crendential tester

options:
  -h, --help            show this help message and exit
  -f, --file FILE       Input file (one IP:port per line)
  -k, --shodan-key SHODAN_KEY
                        Set Shodan API key
  -q, --query QUERY     Set Shodan search query
  -u, --username USERNAME
                        Set username [default: root]
  -p, --password PASSWORD
                        Set password
  -i, --ssh-key SSH_KEY
                        Set SSH key path
  -c, --command CMD     Command to run after successful connection
  -o, --output FILE     Output successful IPs to FILE [default: successful.log]
  -t, --threads THREADS
                        Threads for multiprocessing [default: 8]
  --limit LIMIT         Limit number of Shodan results [default: 100]
  --debug               Show debug information [default: off]
  --singlethreaded      Disable multiprocessing [default: off]

Packages

No packages published

Languages

  • Python 100.0%