sshsec

SSH server configuration tester


Keywords
ssh, server, configuration, security, networking
License
MIT
Install
pip install sshsec==1.1.0

Documentation

sshsec

SSH server parameter tester.

Scans an SSH server and retrieves its configuration, host keys, and diffie-helman groups.

To test your SSH server, go to https://sshsec.zkpq.ca/

Installation

pip:

sudo pip install sshsec

manually:

git clone git@github.com:Knio/sshsec.git
cd sshsec
python3 setup.py install

Usage as a Python library

import json
from sshsec.scanner import scan
r = scan(('openssh.net', 22))
print(json.dumps(r, indent=2, sort_keys=True))

Usage as a command line tool

$ python3 -m sshsec openssh.net
{
  "gex": {
    "1024": {
      "g": 2,
      "p": 159259850257719811867554786380066496141054381349625691658237079119657765195697019837897004360303510318330901286894234009457060430121357034092539802165180875239170962147069586114921659598570247768304754803583845853230501492466875331371237049752561347024495839387857354729546039652268187122395481551030841927187
    },
    "2048": {
      "g": 2,
      "p": 31454579041241601736609998733004992422865419218788895262066271182970777866607669837632557116104914864262471591517433673762854188337899989729770338985485246520282210440380816415784512224233592891419333764130567052965454548474996091876343495206430895619164499922619731259233704237849382085957317731248700068383394910666858391104881933224556830952143504484164227974234899745623509249442885526292545329704595399146662735093219961107990697492484307658941636329290715952695511642030568120201564884619417787046594785613422345346945647068080087123860661313660205912647518045501215135868270781661036012277985916740407037505427
    },
    "4096": {
      "g": 5,
      "p": 956664048229384451063003713300570257741353782893177101986377092048478139710713892756437311971517667455031123074069241335840628702275548123125328772367601266487570336479647249472679718631976630991129186470265632259675448366093799008154488506403730374925088370908373225434858666050448164548515798963195582705723538619348132778552088778898099544509585011187422715046073897691131643135168865442216299352649204422589867356910632881947076008726254407713829211706472677295409348123786467789265049721399743951191227508826593833073909665728944631191711365008221247924616519982085946426904690436982174923806989550684881116231348921642579519028229354922738667556274046221452073375294768982936541417036590264848263293787762219142019073849652165722953437787847353775227092483980987245597291510781761867942718670999927937900071166935782045926351126315218844992136233972748572687300646469868985530342251771376848708335688036400689597453472177256527717796435274403880827729844397874374571871934595457595288797712802742498720967403781138959432943349456273929641420016711347782896430070003203177549983604166119553871502229729488624447122942124841198011683774741760085826847634280186546869095427642263585323784690283038368972746533534370571494033598807
    },
    "768": "EOF",
    "8192": {
      "g": 2,
      "p": 925853908800773264336169799780239675576713823190441241653494891678297736084004812583179580867849967822388544425239869672801159575884028489568399122408411456668730009118962139159739412834380307675259181426597235364611509093331562581030551782390280894494012698373092607091818453265129908025089220759262432525729798456299627792791336861169842369316377126509061783946440705053432134539131491572383781877123842139938493935774323534861714073227094408491093904112927892441227760711358754541141708616562481289232110316318561071146786399433423555613083960579853501611040885126429002395234909802330422942586099153135212592684195486500084975370365269132085360267596777841187890714353597165425768302121152310227345554856999766784821175326069504097977287198232580733439018879899444707500264678570178203985021381122213441627765285108531496521604546259247064123066683700564633107488681343064248573298446273539216656334022100873727133470739127020594947082178150753032356618011438929906197400446490678302272808606118939157637651632055424324307429957721572455722253047625981804597857422171918418673861237851736005345803712568356082647339325536228177068805725425731261498520946955469030201292838740084731398047566162307492608064588115404459913867559769804004875334274725356185890428146726579542785444627514397981275643396579308277347775954641021432032548546175324924078265530658264203765465716394708048419721425044728965948496714564021538245966961941601408993966161181411714402412180512403053238506568574310089182247804517220198347540631647224212200297386940104188362247108582589403400660558684599921123356856745593592572665839816662848269181434118435532164952118019996416618126964465084271279575350939847291708402634113783503697887101835692741079144295998773212557115323870779100895244352686159906031410719328133361108323102757360271725422196322161092746585238878338843235281784745542402215183578061240198858816035645517090844135103162619752108219065075180748326452293516471972565614290994156831506229867653678395304315515454101841652406875563751516316768619255368517890136257944669757801128559068284890970420767065093684534223808256376630316601444503787971100764083486962112312567724501515001771105410622721818006600872115521841562690387477536452586675784000889881897508691487373089735357575401257435818385592897441523562833558972725264003396076167704203957674610050407013908067202814134875652553495262226432628216161601963453202628056538387527102043652301146611342485950806306011803
    }
  },
  "host_keys": {
    "ecdsa-sha2-nistp256": {
      "algorithm": "ecdsa-sha2-nistp256",
      "ascii": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJQLp5VRuQDfQkSav3U6mI9qdzIkAJGkQD3Vvwtt67V6UGthN3ZOH7m7ZgWlHEVPlQBuB4ZwR7h/Zo6V8MJf91I=",
      "fingerprint": "ca:42:8a:b3:e0:a7:49:7f:b1:0b:bf:44:e4:67:21:4a",
      "n": 61385005062442491273914845503750707213131831035626135487295378962954504091204389541525312149719578123226675322769163264120756374341569335049660634520090450,
      "name": "nistp256"
    },
    "ssh-dss": {
      "algorithm": "ssh-dss",
      "ascii": "AAAAB3NzaC1kc3MAAACBAJqdPlcw/gMON9bK7nNkamviVE/Yb+Xh086Fd0Oz6gEgFMdRgtJM3kvU8brGoa88uObWaOhQxKqY29lzN1EwEddgPxI224F7kgT9zkXXIV6fe8jWMx/kqhSY616BrSGHCHzVmE+g41G/9X5/THdQUzn0DIhyH4rdSsjoav+0eT7LAAAAFQCooP5hXJkNmsL/syIfkODxtOmPZwAAAIAUCNuyDX0Jkzl+J2siZXO0lIi5CoghuZXEget0C+YpE/4yDUszznt/KSrJrxLo9DRiSUeIVIIe2RH1uAIxczpl6xfbYxFj+GZLZNZ0xwFvPG/+0Wg6HM7tMQ35tUxsKkSc7P20RdKKJy7TxONjCuhKZNuLRlzPqhGrurxOikm5gwAAAIEAj8hn5j6Oed2WcGzOdwkIrwtzrsZIbMYudWTQ9+Ty8zuHcNbqAEQfauQC1DvtAc9vcs+dRfVTlp6Q4QvwXKBC5WuC7V8ZMO3SAjBxJ443bVP1WZdoc9M4lvpU/7flM/P+UmozmwPV/8ESCUsQoESaZ8wRfmEgC7I3vWpBgVbweuc=",
      "fingerprint": "e9:20:7a:03:53:08:14:e2:7b:5f:72:c5:47:34:c8:d5",
      "g": 14068776168775387647692803895664445576864422229425035031970008418250369563124356872487128235213491945504072297126345369918004201040231641550099397331859419193843072487206181108500351421645170644267474847389167261885509924246812423824996345678261376985211019688900435815034355152715927557868502434463940721027,
      "p": 108573806368263176561156185578960244054192258075289831438116686364968070114337792959880941960968083298817511662659728709676370982403389281669744477727124369424549741989919012718707363867000009795970434347515485024494020988252794254265056259881102577483494465458017505889251112518840417507549577558476472270539,
      "q": 962700728381269871171872262336640920957382922087,
      "y": 100967740653007538850795846636790494538642450418492893676331112452242258272286382650259356880513860339248175157567987022652835791225564410997605194593239700954353943208276418910412722811283358474700351051297006910341230243402990334109127765949899195482828262372925592001606474015055627307539792345741585840871
    },
    "ssh-rsa": {
      "algorithm": "ssh-rsa",
      "ascii": "AAAAB3NzaC1yc2EAAAABIwAAAIEAsQpVyGYI7vjnNUfWBSQe2jq9Fdgv/S4/yvBSIcRhPpuyPeUlNxLf9Vey9paxbowhcCyu+xk/Mwz+L15UPg9If2PYN0NG7+ayNqTpS+eP6bE6rbqtCdFSBEM9zRuZUln14kGwSgJYQqcT/qDt80Ro8Z+zSh9MCQuLbIrspSKYx88=",
      "e": 35,
      "fingerprint": "20:ad:fa:70:cf:85:54:9d:ee:7f:6c:a3:98:77:94:4e",
      "n": 124321976693093509052545532045795054853138950368528424484226875470405051571217610165215789202806480384782897974886278243196708306351857751123622092225828238744864547584918348270098280941122778392104469412903444085393367205715214864280418949129741175558936276359197125286013139401562132712104754053790444341199
    }
  },
  "ident": "SSH-2.0-OpenSSH_6.2",
  "ip": "129.128.5.196",
  "supported": {
    "compression_algorithms_client_to_server": [
      "none",
      "zlib@openssh.com"
    ],
    "compression_algorithms_server_to_client": [
      "none",
      "zlib@openssh.com"
    ],
    "encryption_algorithms_client_to_server": [
      "aes128-ctr",
      "aes192-ctr",
      "aes256-ctr",
      "arcfour256",
      "arcfour128",
      "aes128-gcm@openssh.com",
      "aes256-gcm@openssh.com",
      "aes128-cbc",
      "3des-cbc",
      "blowfish-cbc",
      "cast128-cbc",
      "aes192-cbc",
      "aes256-cbc",
      "arcfour",
      "rijndael-cbc@lysator.liu.se"
    ],
    "encryption_algorithms_server_to_client": [
      "aes128-ctr",
      "aes192-ctr",
      "aes256-ctr",
      "arcfour256",
      "arcfour128",
      "aes128-gcm@openssh.com",
      "aes256-gcm@openssh.com",
      "aes128-cbc",
      "3des-cbc",
      "blowfish-cbc",
      "cast128-cbc",
      "aes192-cbc",
      "aes256-cbc",
      "arcfour",
      "rijndael-cbc@lysator.liu.se"
    ],
    "kex_algorithms": [
      "ecdh-sha2-nistp256",
      "ecdh-sha2-nistp384",
      "ecdh-sha2-nistp521",
      "diffie-hellman-group-exchange-sha256",
      "diffie-hellman-group-exchange-sha1",
      "diffie-hellman-group14-sha1",
      "diffie-hellman-group1-sha1"
    ],
    "languages_client_to_server": [
      ""
    ],
    "languages_server_to_client": [
      ""
    ],
    "mac_algorithms_client_to_server": [
      "hmac-md5-etm@openssh.com",
      "hmac-sha1-etm@openssh.com",
      "umac-64-etm@openssh.com",
      "umac-128-etm@openssh.com",
      "hmac-sha2-256-etm@openssh.com",
      "hmac-sha2-512-etm@openssh.com",
      "hmac-ripemd160-etm@openssh.com",
      "hmac-sha1-96-etm@openssh.com",
      "hmac-md5-96-etm@openssh.com",
      "hmac-md5",
      "hmac-sha1",
      "umac-64@openssh.com",
      "umac-128@openssh.com",
      "hmac-sha2-256",
      "hmac-sha2-512",
      "hmac-ripemd160",
      "hmac-ripemd160@openssh.com",
      "hmac-sha1-96",
      "hmac-md5-96"
    ],
    "mac_algorithms_server_to_client": [
      "hmac-md5-etm@openssh.com",
      "hmac-sha1-etm@openssh.com",
      "umac-64-etm@openssh.com",
      "umac-128-etm@openssh.com",
      "hmac-sha2-256-etm@openssh.com",
      "hmac-sha2-512-etm@openssh.com",
      "hmac-ripemd160-etm@openssh.com",
      "hmac-sha1-96-etm@openssh.com",
      "hmac-md5-96-etm@openssh.com",
      "hmac-md5",
      "hmac-sha1",
      "umac-64@openssh.com",
      "umac-128@openssh.com",
      "hmac-sha2-256",
      "hmac-sha2-512",
      "hmac-ripemd160",
      "hmac-ripemd160@openssh.com",
      "hmac-sha1-96",
      "hmac-md5-96"
    ],
    "server_host_key_algorithms": [
      "ssh-rsa",
      "ssh-dss",
      "ecdsa-sha2-nistp256"
    ]
  }
}