-
Notifications
You must be signed in to change notification settings - Fork 4
/
LostAndFound.py
117 lines (93 loc) · 3.63 KB
/
LostAndFound.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import os, sys, argparse, importlib.util, urllib, fnmatch, tqdm, requests
from extractors import from_url, from_string, from_apk, from_binary, from_dir
from utils import *
args = []
def banner() :
b = '''
:・゚✧:・゚✧:☆*:✧:・゚✧::☆*:・゚✧::☆*::・゚:☆*:゚✧:・゚:☆*::・゚:☆*::・゚✧
(ノ◕ヮ◕)ノ*:・゚✧ 𝓛𝓸𝓼𝓽 & 𝓕𝓸𝓾𝓷𝓭 。.:☆*:・'(*⌒―⌒*)))
:・゚✧:・゚✧:☆*:✧:・゚✧::☆*:・゚✧::☆*::・゚:☆*:゚✧:・゚:☆*::・゚:☆*::・゚✧
'''
print(b)
def load_checkers():
checkers_folder = "./checkers"
checkers = {}
checkers_files = os.listdir(checkers_folder)
for c in checkers_files:
location = os.path.join(checkers_folder,c)
if c[-3:] != '.py' or os.path.isfile(location) != True :
continue
info = importlib.machinery.PathFinder().find_spec(c[:-3],[checkers_folder])
p = info.loader.load_module()
checkers[c[:-3]] = p
return checkers
def check_all(urls, checkers):
domains = []
if args.verbose :
print(urls)
print("[?] Checking URLS ...")
for u in tqdm.tqdm(urls) :
u = clean_url(u)
parsed_url = urllib.parse.urlparse(u)
#print(parsed_url)
domains.append(parsed_url.netloc)
for c in checkers.keys() :
if hasattr(checkers[c], "base_domains") :
if fnmatch_all(parsed_url.netloc, checkers[c].base_domains) :
checkers[c].check(u)
domains.remove(parsed_url.netloc)
print("[?] Checking Domains ...")
checkers["domain"].check(domains)
def main(args):
checkers = load_checkers()
banner()
requests.packages.urllib3.disable_warnings() # ignore SSL warnings
if args.url:
print("URL: ", args.url)
urls = set()
if os.path.isfile(args.url) :
with open(args.url) as f :
clean_urls = []
for l in f :
clean_urls.append(clean_url(l.strip()))
urls = from_url.extract(clean_urls)
else :
urls = from_url.extract(args.url)
check_all(urls, checkers)
elif args.apk:
print("APK: ", args.apk)
urls = from_apk.extract(args.apk)
check_all(urls, checkers)
elif args.dir:
print("DIR: ", args.dir)
urls = from_dir.extract(args.dir)
check_all(urls, checkers)
elif args.ipa:
print("IPA: ", args.ipa)
elif args.bin:
print("BIN: ", args.bin)
urls = from_binary.extract(args.bin)
check_all(urls, checkers)
elif args.proxy:
print("PROXY: ", args.proxy)
elif args.txt:
print("TXT: ", args.txt)
f = open(args.txt,"r").read()
urls = from_string.extract(f)
check_all(urls, checkers)
if __name__ == "__main__" :
parser = argparse.ArgumentParser(description="")
group = parser.add_mutually_exclusive_group()
group.add_argument("-u", "--url", help="URL to check")
group.add_argument("-a", "--apk", help="APK to check")
group.add_argument("-d", "--dir", help="Directory of Source Code to check")
group.add_argument("-i", "--ipa", help="IPA to check")
group.add_argument("-b", "--bin", help="Binary to check")
group.add_argument("-t", "--txt", help="Text file to check")
group.add_argument("-p", "--proxy", help="Proxy to check")
parser.add_argument("-v", "--verbose", help="Verbose output", action="store_true")
args = parser.parse_args()
if len(sys.argv) == 1 :
parser.print_help(sys.stderr)
sys.exit()
main(args)