Giter Site home page Giter Site logo

bs3vcenk / massh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from foxthealmighty/shodan_raspi

15.0 4.0 2.0 52 KB

A simple multithreaded SSH credential tester.

License: MIT License

Python 100.00%
raspberry-pi raspberrypi ssh shodan shodan-api python

massh's Introduction

massh

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

Requirements

massh uses the following modules:

  • paramiko - for SSHing into remote hosts
  • shodan - for accessing the Shodan API
  • colorama - for colored output
  • tqdm - for pretty progress bars

...which can be installed by running: pip3 install -r requirements.txt

Usage

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

massh (Mass-SSH): multithreaded ssh bruteforcer/cred-tester

optional arguments:
  -h, --help            show this help message and exit
  -i FILE, --input FILE
                        input file (one IP:port per line)
  -k SHODAN_KEY, --shodan-key SHODAN_KEY
                        Set Shodan API key
  -q QUERY, --query QUERY
                        Set Shodan search query
  -u USERNAME, --username USERNAME
                        Set username [default: root]
  -p PASSWORD, --password PASSWORD
                        Set password
  --ssh-key SSH_KEY     Set SSH key
  -c CMD, --command CMD
                        Command to run after a successful connection [default:
                        none]
  -o FILE, --output FILE
                        Output successful IPs to FILE [default:
                        successful.log]
  -t THREADS, --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 support [default: no]
  --paramiko-log FILE   Paramiko debug log [default: none/off]

So, for example, scan Shodan for OpenSSH servers, and try to connect using the the username root and password 123456

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

If you want to use a list of IPs, you can use the -i argument to specify a file containing the IPs and ports, one per line. The format is IP:PORT, for example:

1.1.1.1:22
2.2.2.2:22

Another useful option is to use the --ssh-key argument to specify a SSH key to use for authentication. This can be used to test if a key is valid on a list of hosts:

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

massh's People

Contributors

bs3vcenk avatar somu1795 avatar

Stargazers

GHOST ECHO avatar ddddddddddp avatar  avatar Alex Hoffer avatar  avatar Keethesh avatar  avatar  avatar  avatar  avatar Evgeny avatar  avatar  avatar hellrope avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

marciopocebon

massh's Issues

Throwing errors

Doesn't seem to work. Every time I try a search i get flooded with these errors:

./shodan_raspi.py -k myAPIkey -query-string "OpenSSH" -u ROOT -p TOOR
[i] Shodan-RPi 1.1.0
by btx3 (based on code by somu1795)

[i] Reading from Shodan results
[] Getting results from Shodan...
[
] Creating array using Shodan IPs...
[i] 100 targets found

Exception: Error reading SSH protocol banner
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 2211, in _check_banner
buf = self.packetizer.readline(timeout)
File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 380, in readline
buf += self._read_timeout(timeout)
File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 609, in _read_timeout
raise EOFError()
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 2039, in run
self._check_banner()
File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 2216, in _check_banner
"Error reading SSH protocol banner" + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.