This repository was archived by the owner on Sep 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy path2023-petstop_com.py
More file actions
65 lines (52 loc) · 2.05 KB
/
2023-petstop_com.py
File metadata and controls
65 lines (52 loc) · 2.05 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
63
64
65
from parsers import base
import collections
class Parse(base.Parser):
"""
Petstop.com breach data parser
6c7b90d59b2c2610d5f9e617613408fd4be5bb4f PETSTOP_FULL.sql
Good Lines: 45,153
"""
name = "None"
web = "petstop.com"
year = "2023"
def row_format(self, r: str) -> tuple:
"""
18037-CREATE TABLE `users` (
18038- `id` bigint(20) NOT NULL,
18039- `username` varchar(60) NOT NULL,
18040- `password` varchar(128) DEFAULT NULL,
18041- `name` varchar(256) DEFAULT NULL,
18042- `email` varchar(256) DEFAULT NULL,
18043- `last_login_timestamp` bigint(20) DEFAULT NULL,
18044- PRIMARY KEY (`id`),
18045- UNIQUE KEY `users_ak` (`username`)
18046-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
"""
pw_hash = ''
password = ''
salt = ''
row = r.split(',')
#for x in range(0, len(row)):
# print(f'{x}: ' + row[x])
#exit()
try:
email = row[4].replace('\'', '').strip()
pw_hash = row[5].replace('\'', '').strip()
domain = email.split('@')[1] if '@' in email else ''
except:
email = domain = password = pw_hash = ''
#print(f'{email}:{password}')
#print(f'{email}:{pw_hash}')
return self.name, self.web, int(self.year), domain, email, password, pw_hash, salt
def process_rows(self) -> collections.abc.Iterable[tuple]:
print('\nPlease wait. It takes a while to get to the data.', flush=True)
with open(self.source, 'r', encoding='utf-8', errors='ignore') as source:
for row in source:
if row is None:
continue
if not row.startswith(r"INSERT INTO `users` VALUES"):
continue
_, values = row.split('VALUES')
inserts = values.split(r'),(')
for value_tuple in inserts:
yield self.row_format(value_tuple)