-
Notifications
You must be signed in to change notification settings - Fork 0
/
webzir.py
107 lines (91 loc) · 4.46 KB
/
webzir.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
import argparse
import os
import time
import datetime
import requests
import colorama
from colorama import Fore, Style
from core import Core
def Log(msg, status='?'):
color = Fore.CYAN
if status == '+': color = Fore.GREEN
elif status == '-': color = Fore.RED
print(f"[{color}{status}{Style.RESET_ALL}] {msg}")
def PrintName(v):
print(''' __ __ ___. __________.__
/ \ / \ ____\_ |__ \____ /|__|______
\ \/\/ // __ \| __ \ / / | \_ __ \\
\ /\ ___/| \_\ \/ /_ | || | \/
\__/\ / \___ >___ /_______ \|__||__|
\/ \/ \/ \/''' + f" {Fore.GREEN}v{v}{Style.RESET_ALL}\n")
def main():
coreModules = Core()
colorama.init(autoreset=True)
colorama.ansi.clear_screen()
PrintName(coreModules.version)
parser = argparse.ArgumentParser(description=f"Lightweight web scanner for quick recon")
parser.add_argument("target", help="your target URL")
parser.add_argument("--output", help="output directory path")
parser.add_argument("-r", "--random-agent", help="use random user agent", action="store_true")
parser.add_argument("-v", "--verbose", help="use extensive output", action="store_true")
parser.add_argument("-f", "--noRedirect", help="don't allow redirect when bruteforcing entries (faster)", action="store_true")
args = parser.parse_args()
startScanTime = time.time()
try:
coreModules.SetTarget(args.target)
coreModules.Setup(randomUserAgent=args.random_agent, verbose=args.verbose, allowRedirect=not args.noRedirect)
if coreModules.target.IP == coreModules.target.hostname:
Log(f"Initiating a security scan for {coreModules.target.GetFullURL()}...", status='?')
else:
Log(f"Initiating a security scan for {coreModules.target.GetFullURL()} ({coreModules.target.IP})...", status='?')
print()
coreModules.DetectTech()
coreModules.ScrapeWordlist()
coreModules.Wayback()
coreModules.Whois()
except (RuntimeError, requests.exceptions.ConnectionError) as e:
Log(f"Fatal error: {e}", status='-')
Log("Exiting...", status='?')
exit(1)
except KeyboardInterrupt:
print()
Log("Keyboard interruption", status='-')
totalScanTime = round(time.time() - startScanTime, 2)
for finding in coreModules.results:
if type(coreModules.results[finding]) == list:
Log(f"{finding}", status='+')
print(" ", end='')
for i in coreModules.results[finding]:
print(f"{i}; ", end='')
print()
elif type(coreModules.results[finding]) == dict:
Log(f"{finding}", status='+')
for elem in coreModules.results[finding]:
print(f" {elem}: {coreModules.results[finding][elem]}")
else:
Log(f"{finding}: {coreModules.results[finding]}", status='+')
if coreModules.wayback: Log(f"Found {len(coreModules.wayback)} link(s) in Wayback machine", status='+')
print()
Log(f"Time elapsed: {totalScanTime}s", status='?')
if args.output:
if args.verbose: print("[?] Writing data to the files...")
if not os.path.exists(args.output): os.makedirs(args.output)
with open(f"{args.output}/report.txt", 'w') as file:
file.write(f"WebZir scanner v{coreModules.version}\nScan report for the host {coreModules.target.GetFullURL()} ({coreModules.target.IP}) ")
file.write(f"{datetime.datetime.now()}\n\n")
for finding in coreModules.results:
if type(coreModules.results[finding]) == list:
file.write(f"[+] {finding}\n")
for i in coreModules.results[finding]: file.write(f"{i}; ")
file.write('\n')
elif type(coreModules.results[finding]) == dict:
file.write(f"[+] {finding}\n")
for elem in coreModules.results[finding]: file.write(f" {elem}: {coreModules.results[finding][elem]}\n")
else:
file.write(f"[+] {finding}: {coreModules.results[finding]}\n")
with open(f"{args.output}/dictionary.txt", 'w') as file:
for element in coreModules.wordlist: file.write(element + '\n')
if coreModules.wayback:
with open(f"{args.output}/wayback.txt", 'w') as file:
for element in coreModules.wayback: file.write(element + '\n')
if __name__ == "__main__": main()