Skip to content

Commit ad43e52

Browse files
authored
Merge pull request #53 from xuvez/master
Closes #52 - Added command line flags for JSON output
2 parents 5d383d6 + 10b43c6 commit ad43e52

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

lib/core/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# |V|H|o|s|t|S|c|a|n| Developed by @codingo_ & @__timk
33
# +-+-+-+-+-+-+-+-+-+ https://github.com/codingo/VHostScan
44

5-
__version__ = '1.5.1'
5+
__version__ = '1.5.2'
66

lib/helpers/file_helper.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ def __init__(self, output_file):
77
self.output_file = output_file
88

99
def check_directory(self):
10-
directory = self.output_file
10+
directory = os.path.dirname(self.output_file)
11+
1112
try:
12-
os.stat(self.directory)
13+
os.stat(directory)
1314
except:
14-
os.mkdir(self.directory)
15-
print("[!] %s didn't exist and has been created." % output_directory)
15+
os.mkdir(directory)
16+
print("[!] %s didn't exist and has been created." % directory)
1617

1718
# placeholder for error checking on -oJ implementation
1819
def is_json(json_file):
@@ -24,6 +25,9 @@ def is_json(json_file):
2425
return True
2526

2627
def write_file(self, contents):
28+
# check if host directory exists, if not create it
29+
self.check_directory()
30+
2731
with open(self.output_file, "w") as o:
2832
o.write(contents)
2933

lib/helpers/output_helper.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,28 @@ def output_normal_likely(self):
4646

4747
def output_json(self, filename):
4848
file = file_helper(filename)
49-
list = dict()
49+
output = dict()
50+
output['Start Time'] = '{} {}'.format(time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"))
51+
output['Target'] = self.scanner.target
52+
output['Base Host'] = self.scanner.base_host
53+
output['Port'] = self.scanner.port
54+
output['Real Port'] = self.scanner.real_port
55+
output['Ignore HTTP Codes'] = self.scanner.ignore_http_codes
56+
output['Ignore Content Length'] = self.scanner.ignore_content_length
57+
output['Wordlist'] = self.scanner.wordlist
58+
output['Unique Depth'] = self.scanner.unique_depth
59+
output['SSL'] = self.scanner.ssl
60+
result = dict()
5061
for host in self.scanner.hosts:
51-
headers = {}
62+
headers = dict()
5263
for header in host.keys:
5364
headers[header.split(':')[0]] = header.split(':')[1].strip()
5465

55-
list[host.hostname] = {'Code': host.response_code,
66+
result[host.hostname] = {'Code': host.response_code,
5667
'Hash': host.hash,
5768
'Headers': headers}
58-
file.write_file(json.dumps(list))
69+
output['Result'] = result
70+
file.write_file(json.dumps(output))
5971

6072

6173
def output_fuzzy(self):

0 commit comments

Comments
 (0)