-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhoneychecker.py
More file actions
62 lines (49 loc) · 2.19 KB
/
honeychecker.py
File metadata and controls
62 lines (49 loc) · 2.19 KB
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
from authsite import tk_authsite as tas
import sqlite3
from dna_algorithm import dna_encryption as d
db_file = 'database.db'
usernames = []
credentials = []
h_credentials = []
def honeychecker():
with sqlite3.connect(db_file) as conn:
cursor = conn.cursor()
cursor.execute("""
select username from credentials
""")
usernames= cursor.fetchall()
username, password = tas.login_credentials.username, tas.login_credentials.password
flag = 0
for i in usernames:
for j in i:
if j == username:
flag = 1
with sqlite3.connect(db_file) as conn:
cursor = conn.cursor()
cursor.execute("""
select sweetword, otp, lookupno, case_flag from credentials
""")
credentials = cursor.fetchall()
for i in credentials:
passw = d.dna_decryption(i[0], i[1], i[2], i[3])
if passw == password:
tas.login_success()
else:
with sqlite3.connect(db_file) as conn:
cursor = conn.cursor()
cursor.execute("""
select honeyword1, otp1, honeyword2, otp2, honeyword3, otp3, honeyword4, otp4, honeyword5, otp5, honeyword6, otp6, honeyword7, otp7, honeyword8, otp8, honeyword9, otp9, lookupno_h, caseflag_h from credentials where username = ?
""", (j,))
h_credentials = cursor.fetchall()
for i in h_credentials:
for j in range(0, 17, 2):
passw = d.dna_decryption(i[j], i[j+1], i[-2], i[-1])
if passw == password:
print("honeyword matched")
tas.password_not_recognised()
else:
print("Wrong Password")
tas.wrong_password()
if flag == 0:
print("Account not found")
tas.user_not_found()