Skip to content

Commit 4f38ca5

Browse files
diogoosorioDiogo Osório
authored andcommitted
Make the VHostScan.py adhere to the pep8 convention
1 parent f58319a commit 4f38ca5

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

VHostScan.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@
77
from socket import gethostbyaddr
88
from lib.core.virtual_host_scanner import *
99
from lib.helpers.output_helper import *
10-
from lib.helpers.file_helper import get_combined_word_lists, load_random_user_agents
10+
from lib.helpers.file_helper import get_combined_word_lists
11+
from lib.helpers.file_helper import load_random_user_agents
1112
from lib.core.__version__ import __version__
1213
from lib.input import cli_argument_parser
1314

15+
DEFAULT_WORDLIST_FILE = os.path.join(
16+
os.path.dirname(os.path.abspath(__file__)),
17+
'wordlists',
18+
'virtual-host-scanning.txt'
19+
)
20+
1421

1522
def print_banner():
1623
print("+-+-+-+-+-+-+-+-+-+ v. %s" % __version__)
@@ -20,13 +27,14 @@ def print_banner():
2027

2128
def main():
2229
print_banner()
23-
30+
2431
parser = cli_argument_parser()
2532
arguments = parser.parse(sys.argv[1:])
2633

2734
wordlist = []
2835
word_list_types = []
29-
default_wordlist = "./wordlists/virtual-host-scanning.txt" if not arguments.stdin else None
36+
37+
default_wordlist = DEFAULT_WORDLIST_FILE if not arguments.stdin else None
3038

3139
if arguments.stdin:
3240
word_list_types.append('stdin')
@@ -42,11 +50,14 @@ def main():
4250
print("[!] No words found in provided wordlists, unable to scan.")
4351
sys.exit(1)
4452

45-
print("[+] Starting virtual host scan for {host} using port {port} and {inputs}".format(
46-
host=arguments.target_hosts,
47-
port=arguments.port,
48-
inputs=', '.join(word_list_types),
49-
))
53+
print(
54+
"[+] Starting virtual host scan for {host} using "
55+
"port {port} and {inputs}".format(
56+
host=arguments.target_hosts,
57+
port=arguments.port,
58+
inputs=', '.join(word_list_types),
59+
)
60+
)
5061

5162
user_agents = []
5263
if arguments.user_agent:
@@ -62,10 +73,14 @@ def main():
6273
if(arguments.add_waf_bypass_headers):
6374
print("[>] WAF flag set, sending simple WAF bypass headers.")
6475

65-
print("[>] Ignoring HTTP codes: %s" % (arguments.ignore_http_codes))
76+
print("[>] Ignoring HTTP codes: {}".format(arguments.ignore_http_codes))
6677

6778
if(arguments.ignore_content_length > 0):
68-
print("[>] Ignoring Content length: %s" % (arguments.ignore_content_length))
79+
print(
80+
"[>] Ignoring Content length: {}".format(
81+
arguments.ignore_content_length
82+
)
83+
)
6984

7085
if arguments.first_hit:
7186
print("[>] First hit is set.")
@@ -78,7 +93,12 @@ def main():
7893
wordlist.extend(aliases)
7994

8095
scanner_args = vars(arguments)
81-
scanner_args.update({'target': arguments.target_hosts, 'wordlist': wordlist, 'user_agents': user_agents})
96+
scanner_args.update({
97+
'target': arguments.target_hosts,
98+
'wordlist': wordlist,
99+
'user_agents': user_agents
100+
})
101+
82102
scanner = virtual_host_scanner(**scanner_args)
83103
scanner.scan()
84104
output = output_helper(scanner, arguments)

0 commit comments

Comments
 (0)