-
Notifications
You must be signed in to change notification settings - Fork 9
/
valhalla.py
146 lines (119 loc) · 4.28 KB
/
valhalla.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
from modules import fetch_requests, shodan_con
from colorama import Fore
import argparse
import shodan
banner = f"""
,
, |\ ,__
|\ \/ `.
\ `-.:. `\\
`-.__ `\=====|
/=`'/ ^_\\
.' /\ .=)
.-' .'| '-(/_|
.' __( \ .'`
/_.'` `. |`
\ |
|/ {Fore.RED}"No system is safe"{Fore.RESET}
.__ .__ .__ .__
___ _______ | | | |__ _____ | | | | _____
\ \/ /\__ \ | | | | \\\\__ \ | | | | \__ \\
\ / / __ \| |_| Y \/ __ \| |_| |__/ __ \_
\_/ (____ /____/___| (____ /____/____(____ /
\/ \/ \/ \/
Author: c0deninja
Version: v1.8
"""
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument('-p', '--port', action='store',
help="port number to use",
metavar="8080")
parser.add_argument('-t', '--target',
help="file to scan")
parser.add_argument('-d', '--dork',
help="Dork to scan")
parser.add_argument('-f', '--file',
help="file to scan")
parser.add_argument('-cve', '--cve_id',
help="scan by cve id")
parser.add_argument('-vuln', '--vulnerability', action='store_true',
help="scan for vulnerabilities")
parser.add_argument('-ips', '--ipaddresses', action='store_true',
help="getting ip addresses from shodan")
parser.add_argument('-nm', '--nmap', action='store_true',
help="scan for unsecure http ports")
args = parser.parse_args()
print(banner)
if args.dork:
if args.ipaddresses:
print(f"Extracting IP Adddresses from {Fore.CYAN}Shodan{Fore.RESET}...")
shodan_con.ips(args.dork)
print(f"DONE{Fore.MAGENTA}!\n")
if args.target:
if args.port:
if args.cve_id:
fetch_requests.cve_scan(args.target, args.port, args.cve_id)
if args.target:
if args.port:
fetch_requests.scan(args.target, args.port)
if args.file:
if args.cve_id:
with open(f'{args.file}', 'r') as f:
domain_list = [x.strip() for x in f.readlines()]
for domains in domain_list:
fetch_requests.cve_scan_file(args.file, args.cve_id)
if args.file:
if args.nmap:
with open(f'{args.file}', 'r') as f:
domain_list = [x.strip() for x in f.readlines()]
for domains in domain_list:
print(f"{Fore.MAGENTA}[+] {Fore.CYAN}-{Fore.WHITE} Scanning {Fore.GREEN}{domains}{Fore.WHITE} ....\n")
fetch_requests.nmap_scan(f"{domains}")
if args.file:
if args.port:
with open(f'{args.file}', 'r') as f:
domain_list = (x.strip() for x in f.readlines())
for domains in domain_list:
fetch_requests.scan(domains, args.port)
if args.dork:
if args.port:
if args.cve_id:
try:
shodan_con.ips(args.dork)
with open('ips.txt', 'r') as f2:
ip_list = (x.strip() for x in f2.readlines())
for iplist in ip_list:
fetch_requests.cve_scan_dork(iplist, args.port, args.cve_id)
except shodan.APIError as e:
print(e)
else:
pass
if args.dork:
if args.port:
try:
shodan_con.ips(args.dork)
with open('ips.txt', 'r') as f2:
for iplist in (x.strip() for x in f2):
fetch_requests.scan(iplist, args.port)
except shodan.APIError as e:
print(e)
if args.target:
if args.port:
if args.vulnerability:
fetch_requests.vuln_scan(args.target, args.port)
else:
print("Error: Missing required argument(s)")
if args.dork:
if args.port:
if args.vulnerability:
try:
shodan_con.ips(args.dork)
with open('ips.txt', 'r') as f2:
ip_list = (x.strip() for x in f2.readlines())
for iplist in ip_list:
fetch_requests.vuln_dork(iplist, args.port, args.vulnerability)
except shodan.APIError as e:
print(e)
else:
pass