-
Notifications
You must be signed in to change notification settings - Fork 1
/
deluxe.py
80 lines (67 loc) · 2.22 KB
/
deluxe.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
74
75
76
77
78
79
80
import sys, json
import modules.search as Searcher
import modules.scrape as Scraper
import modules.extract as Extractor
import modules.download as Downloader
import modules.args as ArgumentHandler
__author__ = "@2xxeformyshirt"
__version__ = "2.0.0"
if len(sys.argv) == 1:
print("[-] Missing arguments...quitting!")
sys.exit()
def extract(args):
"""extract metadata from files listed in manifest"""
print(
(
"[+] Extracting metadata from documents specified in \033[1m%s\033[0m"
% args["man"]
)
)
manj = Extractor.processmanifest(args["man"], args["extout"])
print(("[+] Updated manifest written to \033[1m%s\033[0m" % args["extout"]))
if args["print"]:
print("[+] Printing list of results to terminal\n")
Extractor.pprintmanifest(manj)
def scrape(args):
"""given a url, download a list of links"""
print(("[+] Scraping \033[1m%s\033[0m for document links" % args["url"]))
urls = Scraper.scrapepage(args["url"])
print(
("[+] Downloading identified documents to \033[1m%s\033[0m" % args["scrapeout"])
)
Downloader.downloadlist(urls, args["scrapeout"])
print(
("[+] Manifest written to \033[1m%s/manifest.json\033[0m" % args["scrapeout"])
)
def search(args):
"""given a domain, download a list of links"""
print(
(
"[+] Searching Google for document links for \033[1m%s\033[0m"
% args["domain"]
)
)
urls = Searcher.extensionsearch(args["domain"], args["numres"])
print(
("[+] Downloading identified documents to \033[1m%s\033[0m" % args["searchout"])
)
Downloader.downloadlist(urls, args["searchout"])
print(
("[+] Manifest written to \033[1m%s/manifest.json\033[0m" % args["searchout"])
)
def main():
print((ArgumentHandler.BANNER))
args = vars(ArgumentHandler.parser.parse_args())
"""switch on subparser"""
if args["sps"] == "extract":
extract(args)
elif args["sps"] == "scrape":
scrape(args)
elif args["sps"] == "search":
search(args)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("[-] User interrupt...quitting!")
sys.exit()