-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjs-parse.py
73 lines (63 loc) · 2.88 KB
/
js-parse.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
#!/usr/bin/env python3
from js_parse_package.args import argparser
from js_parse_package.process_files import(
process_files_with_tqdm,
process_files_without_tqdm
)
from js_parse_package.show_results import(
stdout_dirs,
move_stored_files
)
from js_parse_package.store_files import write_files
from js_parse_package.show_results import all_dirs
# import logging
args = argparser()
target_url = args.url
if (target_url[len(target_url) - 1] == '/'):
target_url = args.url[:len(target_url)-1]
intro_logo = f"""\u001b[31m
░░░░░██╗░██████╗░░░░░░██████╗░░█████╗░██████╗░░██████╗███████╗
░░░░░██║██╔════╝░░░░░░██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔════╝
░░░░░██║╚█████╗░█████╗██████╔╝███████║██████╔╝╚█████╗░█████╗░░
██╗░░██║░╚═══██╗╚════╝██╔═══╝░██╔══██║██╔══██╗░╚═══██╗██╔══╝░░
╚█████╔╝██████╔╝░░░░░░██║░░░░░██║░░██║██║░░██║██████╔╝███████╗
░╚════╝░╚═════╝░░░░░░░╚═╝░░░░░╚═╝░░╚═╝╚═╝░░╚═╝╚═════╝░╚══════╝
{('parsing webpage: ' + target_url)}
--------------------------------------------------------------\u001b[0m"""
def verify_files():
if (args.merge or args.isolate):
if (args.merge and args.stdout):
process_files_without_tqdm()
write_files()
stdout_dirs()
elif (args.merge):
process_files_with_tqdm()
write_files()
print(f'\n\n\n\033[31m[PARSED]\033[0m {len(all_dirs)} urls\n')
else:
process_files_with_tqdm()
print(f'\n\n\n\033[31m[PARSED]\033[0m {len(all_dirs)} urls\n')
elif (args.json_report):
print('cannot use -j/--json-report alone. must pair this up with -o/--merge option')
quit()
elif(args.stdout):
process_files_without_tqdm()
stdout_dirs()
else:
process_files_with_tqdm()
stdout_dirs()
print(f'\n\n\n\033[31m[PARSED]\033[0m {len(all_dirs)} urls\n')
if(args.save_one or args.save_each):
move_stored_files()
print('saved js files')
print('done')
if __name__ == "__main__":
if (args.stdout):
pass
else:
if (args.no_logo):
pass
else:
print(intro_logo)
verify_files()
pass