-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkippo.py
executable file
·65 lines (55 loc) · 1.74 KB
/
kippo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python2
import socket
import paramiko
import sys
hs = {'honeyscore':0}
def cipherspecTest(host):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host,22))
t = paramiko.Transport(sock)
t.start_client()
#k = t.get_remote_server_key()
a = t.get_security_options()
print t.host_key.__dict__
#print("ATTRS OF KEY: ", t.host_key.__dict__)
print(str(t.host_key.size))
if t.host_key.size == 1024:
hs['honeyscore']+=2
print('honeyscore 2 : diffie-hellman-group-exchange-sha1 used by kippo')
def commandTest(host):
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.WarningPolicy())
try:
client.connect(host,22,'root','123456')
except paramiko.ssh_exception.AuthenticationException:
print("Authentication Failure!")
exit()
try:
(stdin, stdout, stderr) = client.exec_command('ifconfig')
except:
hs['honeyscore']+=3
print('honeyscore 3 : commands execution not supported by kippo')
# research by andrew-morris
def andrewMorris(host):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host,22))
banner = s.recv(1024)
s.send('\n\n\n\n\n\n\n\n')
response = s.recv(1024)
s.close()
if "168430090" in response:
hs['honeyscore']+=5
print('honeyscore 5 : twisted framework mishandled input ')
def scan(host):
cipherspecTest(host)
commandTest(host)
andrewMorris(host)
if __name__ == '__main__':
if len(sys.argv) != 2:
print('[+] Usage: python %s 1.1.1.1' % sys.argv[0])
exit()
host = sys.argv[1]
cipherspecTest(host)
#commandTest(host)
#andrewMorris(host)