forked from soxoj/maigret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wizard.py
executable file
·68 lines (54 loc) · 1.75 KB
/
wizard.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
import asyncio
import logging
import maigret
TOP_SITES_COUNT = 300
TIMEOUT = 10
MAX_CONNECTIONS = 50
def main():
logger = logging.getLogger('maigret')
logger.setLevel(logging.WARNING)
loop = asyncio.get_event_loop()
db = maigret.MaigretDatabase().load_from_file('./maigret/resources/data.json')
username = input('Enter username to search: ')
sites_count = (
int(
input(
f'Select the number of sites to search ({TOP_SITES_COUNT} for default, {len(db.sites_dict)} max): '
)
)
or TOP_SITES_COUNT
)
sites = db.ranked_sites_dict(top=sites_count)
show_progressbar = input('Do you want to show a progressbar? [Yn] ').lower() != 'n'
extract_info = (
input(
'Do you want to extract additional info from accounts\' pages? [Yn] '
).lower()
!= 'n'
)
use_notifier = (
input(
'Do you want to use notifier for displaying results while searching? [Yn] '
).lower()
!= 'n'
)
notifier = None
if use_notifier:
notifier = maigret.Notifier(print_found_only=True, skip_check_errors=True)
search_func = maigret.search(
username=username,
site_dict=sites,
timeout=TIMEOUT,
logger=logger,
max_connections=MAX_CONNECTIONS,
query_notify=notifier,
no_progressbar=not show_progressbar,
is_parsing_enabled=extract_info,
)
results = loop.run_until_complete(search_func)
input('Search completed. Press any key to show results.')
for sitename, data in results.items():
is_found = data['status'].is_found()
print(f'{sitename} - {"Found!" if is_found else "Not found"}')
if __name__ == '__main__':
main()