Skip to content

Instantly share code, notes, and snippets.

@thurask
Created November 30, 2016 03:48
Show Gist options
  • Save thurask/029362594fe3a837a611bccb11ef2751 to your computer and use it in GitHub Desktop.
Save thurask/029362594fe3a837a611bccb11ef2751 to your computer and use it in GitHub Desktop.
import json
from sshsec.scanner import scan
def cleaner(some_str):
return(some_str.replace("_", " ").upper())
def scanner(host, port=22):
r = scan((host, port))
hostkeys = r["host_keys"]
ident = r["ident"]
ip = r["ip"]
supported = r["supported"]
gex = r["gex"]
print("IP: {0}".format(ip))
print("{0}".format(ident))
print("SUPPORTED:")
for s in supported:
print(" {0}".format(cleaner(s)))
for b in supported[s]:
print(" {0}".format(b))
print("")
print("HOST KEYS:")
for h in hostkeys:
print(" {0}".format(cleaner(h)))
for a in hostkeys[h]:
print(" {0}: {1}".format(cleaner(a), hostkeys[h][a]))
print("")
print("GEX:")
for g in gex:
print(" {0}".format(cleaner(g)))
if gex[g] == "EOF":
print(" EOF")
else:
for c in gex[g]:
print(" {0}: {1}".format(cleaner(c), gex[g][c]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment