-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexUpdate.py
121 lines (111 loc) · 2.97 KB
/
indexUpdate.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#! /usr/bin/python2.7
import time
import mysql.connector
read_data = ""
file_path ="/var/www/html/index.html"
connector = mysql.connector.connect(user='cowrie',
password='Kaltopmih',
host='127.0.0.1',
database='cowrie',
autocommit=True)
query="select ip, username, password, timestamp from sessions, auth where sessions.id = session order by timestamp DESC LIMIT 300;"
base ="""<html>
<style>
.btn-group button {
background-color: LimeGreen;
border: 1px solid green;
color: black;
padding: 10px 24px;
cursor: pointer;
float:left;
position:relative;
left:40%;
}
.btn-group:after {
content: "";
clear: both;
display: table;
}
.btn-group button:not(:last-child) {
border-right: none;
}
.btn-group button:hover {
background-color: green;
}
body {
background-color:black;
color:LimeGreen;
}
h1, p {
color:LimeGreen;
font-family:verdana,sans,sans-serif;
text-align:center;
}
p {
padding-bottom:50px;
}
input {
background-color:LimeGreen;
}
</style>
<meta http-equiv="refresh" content="5">
<head>
<title>The Se7en honeypot</title>
</head>
<div class="btn-group">
<form action="index.html" method="get">
<button>Login log</button>
</form>
<form action="cmd.html" method="get">
<button>Command log</button>
</form>
<form action="whois.html" method="get">
<button>Who is lookup</button>
</form>
</div>
<h1>Honeypot statistics</h1>
<p>The IP:s, credentials and login times of our honorable guests.</p>
<table align="center" border="1" bordercolor="LimeGreen" cellspacing="0" cellpadding="1" style="table-layout:fixed;vertical-align:bottom;font-size:14px;font-family:verdana,sans,sans-serif;border-collapse:collapse;border:2px solid LimeGreen">
<tr>
<td align="left" style="padding:1px 4px">
<b>[IP]</b>
</td>
<td>
<b>[USERNAME]</b>
</td>
<td>
<b>[PASSWORD]</b>
</td>
<td>
<b>[TIME]</b>
</td>
</tr>
"""
def makehtml():
cursor = connector.cursor()
cursor.execute(query)
html = base
for session in cursor:
ip = str(session[0])
login = (session[1]).encode('ascii', 'ignore').decode('ascii')
password = (session[2]).encode('ascii', 'ignore').decode('ascii')
date = str(session[3])
if login == 'root' and password == '1234':
info = "<tr><td>" + ip + \
"</td><td><font color='red'>" + login + \
"</font></td><td><font color='red'>" + password + \
"</font></td><td>" + date + "</td></tr>\n"
else:
info = "<tr><td>" + ip + \
"</td><td>" + login + \
"</td><td>" + password + \
"</td><td>" + date + "</td></tr>\n"
html = html + info
html = html + "</html>"
cursor.close()
return html
while True:
time.sleep(5)
html = makehtml()
with open(file_path, 'w') as f:
f.write(html)