Code Monkey home page Code Monkey logo

passive-ssh's Introduction

Passive SSH

Passive SSH logo

Passive SSH is an open source framework composed of a scanner and server to store and lookup the SSH keys and fingerprints per host (IPv4/IPv6/onion).

The key materials along fingerprints and hosts are stored in a fast-lookup database. The system provides an historical view of SSH keys seen but also common key materials reused on different IP addresses.

Features

  • A simple SSH scanner
  • A server storing key materials in a Redis database
  • A simple ReST API to lookup by SSH fingerprints (including hassh or host (IPv4, IPv6 or onion addresses)
  • Statistics of SSH banners and SSH fingerprints

Server Requirements

  • Python >= 3.6
  • Redis >5.0
  • tornado

Scanner Requirements

  • Python >= 3.6
  • D4 paramiko
  • pysocks (required to scan Tor hidden services)

Install

./install.sh
  • Install Redis and all pythons requirements.
  • All Python 3 code will be installed in a virtualenv (PSSHENV).

Tor proxy

The ssh scanner can be used with a Tor proxy to scan a host or an hidden service.

Don't forget to install the Tor proxy if you want to scan Tor hidden services: sudo apt-get install tor -y

Running

Launch the redis and the tornado server:

./LAUNCH -l

Manual scan

A SSH scanner is included to scan small networks or internal infrastructure.

. ./PSSHENV/bin/activate
cd bin/

# Scan a host
./ssh_scan.py -t <host: 10.0.0.12>

# Scan a network range
./ssh_scan.py -r <network range: 10.0.0.0/8>

API

An API is available to query the Passive SSH server.

By default, the tornado server for Passive SSH is running on port 8500.

curl http://localhost:8500/banners

Endpoints

/stats

Return server staticstics:

  • number of SSH banners
  • number of scanned hosts:
    • ip
    • onion
  • number of fingerprints by type

/banners

Return all banners ordered by scores

/banner/hosts/<banner>

Get hosts by banner:

  • banner
  • list of hosts

/keys/types

Return the list of all keys types

/host/ssh/<host>

Return host SSH metadata:

  • first seen
  • last seen
  • ports
  • list of banners
  • list of fingerprints

/host/history/<host>

Return the SSH history of an host

/fingerprints

Return all fingerprints ordered by scores

/fingerprint/all/<fingerprint>

Get hosts by fingerprint:

  • first seen
  • last seen
  • key type
  • key base64
  • fingerprint
  • list of hosts

/fingerprint/type/<key_type>/<fingerprint>

Get hosts by type of key and fingerprint:

  • first seen
  • last seen
  • key type
  • key base64
  • fingerprint
  • list of hosts

/hasshs

Return all hasshs ordered by scores

/hassh/hosts/<hassh>

Get hosts by hassh:

  • hassh
  • list of hosts
  • kexinit

Existing Passive SSH database

License

The software is free software/open source released under the GNU Affero General Public License version 3.

passive-ssh's People

Contributors

adulau avatar chrisr3d avatar gallypette avatar terrtia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passive-ssh's Issues

Scanning bug

Traceback (most recent call last):
  File "ssh_scan.py", line 259, in <module>
    res = ssh_scanner(str(v), ssh_port, use_proxy=use_proxy, proxy_ip=proxy_ip, proxy_port=proxy_port)
  File "ssh_scan.py", line 209, in ssh_scanner
    res = ssh_fingerprinter(target, ssh_port, use_proxy=use_proxy, proxy_ip=proxy_ip, proxy_port=proxy_port)
  File "ssh_scan.py", line 175, in ssh_fingerprinter
    ssh_fingerprint, host_pkey, host_ref = get_ssh_fingerprint(target, port, socket_timeout, use_proxy=use_proxy, proxy_ip=proxy_ip, proxy_port=proxy_port)
  File "ssh_scan.py", line 144, in get_ssh_fingerprint
    key = ssh_transport.get_remote_server_key()
  File "/home/adulau/analyzer-d4-passivessh/PSSHENV/lib/python3.8/site-packages/paramiko/transport.py", line 836, in get_remote_server_key
    raise SSHException("No existing session")
paramiko.ssh_exception.SSHException: No existing session

Add a timeout flag ssh_scan

It would come especially handy when dealing with large lists of hosts:

cat ips |  xargs -I {} ./ssh_scan.py --proxy -i 127.0.0.1 -pp 9050 -t {} 
Socket error: 0x05: Connection refused
{}
0.470165491104126
Socket error: timed out
{}
30.028011560440063
Socket error: timed out
{}
30.03199052810669
Socket error: timed out
{}
30.032567501068115

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.