This repository has been archived by the owner on Sep 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy path2020-bigbasket_com.py
59 lines (46 loc) · 2.37 KB
/
2020-bigbasket_com.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
import collections
from parsers import base
class Parse(base.Parser):
"""
Bigbasket.com breach data parser
Source File SHA-1: a4dd21b5ca4e98c82417262f82957005de2db637 bb.sql
Good Lines: 20,489,857
"""
name = "None"
web = "www.bigbasket.com"
year = "2020"
def row_format(self, r: str) -> tuple:
"""
Sample:
(1,'2011-11-02 17:54:40','2020-02-06 16:00:19',NULL,5508,'[email protected]',
'sha1$b6f84$1b2b6a277dff95df33a5176fcc2faab419589d1f','Prashanth','Vijayendra','1985-02-25',
'',0,0,0,'2019-08-01 13:46:49','127.0.0.1','49.206.14.56','2011-11-02 17:54:40',11,
'Shamanna Lane,Church road',560017,_binary '\0\0\0\0\0\0\0\�\��iS@#ƫ�\�)@','',NULL,
'ALREADY_ACTIVATED1','83592',0,NULL,'No:33,Flat No:006,Arrcons Agna Indraprasta','bangalore'
,1,1,'Murugeshpalya',0,612,'612','[email protected]','','no33flatno006arrconsagnaindraprastashamannalanechurchroad'
,0,1,'MzE0OTkyNTYxNQ==',45,NULL,'',NULL,'',1,'A-DX-XBO-95998165-14','2012-09-05','2019-10-14',51,'BBO-52794-030912'
,5323.43,80349.96,807,793,76213.00,79361.40,5323.00,2420,2435,'gmail.com',59.97,9506.56,NULL,5634.33,'2019-10-02'
,NULL,'2014-04-13',0.00,1,NULL,'[email protected]',NULL,NULL,NULL,NULL)
:param r:
:return:
"""
row = r.split(',')
email = row[5].replace('\'', '').strip()
pw_hash = row[6].replace('\'', '').strip()
domain = email.split('@')[1] if '@' in email else ''
#print(f"{email},{pw_hash},{domain}")
return self.name, self.web, int(self.year), domain, email, '', pw_hash, ''
def process_rows(self) -> collections.abc.Iterable[tuple]:
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 `member_member` VALUES"):
continue
if len(row.split('VALUES')) != 2:
print("x", end='')
continue
_, values = row.split('VALUES')
inserts = values.split(r'),(')
for value_tuple in inserts:
yield self.row_format(value_tuple)