diff --git a/lib/core/__version__.py b/lib/core/__version__.py index d1d6262..19f2498 100644 --- a/lib/core/__version__.py +++ b/lib/core/__version__.py @@ -2,5 +2,5 @@ # |V|H|o|s|t|S|c|a|n| Developed by @codingo_ & @__timk # +-+-+-+-+-+-+-+-+-+ https://github.com/codingo/VHostScan -__version__ = '1.5.1' +__version__ = '1.5.2' diff --git a/lib/helpers/file_helper.py b/lib/helpers/file_helper.py index 535c5d8..5a36ee4 100644 --- a/lib/helpers/file_helper.py +++ b/lib/helpers/file_helper.py @@ -7,12 +7,13 @@ def __init__(self, output_file): self.output_file = output_file def check_directory(self): - directory = self.output_file + directory = os.path.dirname(self.output_file) + try: - os.stat(self.directory) + os.stat(directory) except: - os.mkdir(self.directory) - print("[!] %s didn't exist and has been created." % output_directory) + os.mkdir(directory) + print("[!] %s didn't exist and has been created." % directory) # placeholder for error checking on -oJ implementation def is_json(json_file): @@ -24,6 +25,9 @@ def is_json(json_file): return True def write_file(self, contents): + # check if host directory exists, if not create it + self.check_directory() + with open(self.output_file, "w") as o: o.write(contents) diff --git a/lib/helpers/output_helper.py b/lib/helpers/output_helper.py index 6071318..7e04ded 100644 --- a/lib/helpers/output_helper.py +++ b/lib/helpers/output_helper.py @@ -46,16 +46,28 @@ def output_normal_likely(self): def output_json(self, filename): file = file_helper(filename) - list = dict() + output = dict() + output['Start Time'] = '{} {}'.format(time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S")) + output['Target'] = self.scanner.target + output['Base Host'] = self.scanner.base_host + output['Port'] = self.scanner.port + output['Real Port'] = self.scanner.real_port + output['Ignore HTTP Codes'] = self.scanner.ignore_http_codes + output['Ignore Content Length'] = self.scanner.ignore_content_length + output['Wordlist'] = self.scanner.wordlist + output['Unique Depth'] = self.scanner.unique_depth + output['SSL'] = self.scanner.ssl + result = dict() for host in self.scanner.hosts: - headers = {} + headers = dict() for header in host.keys: headers[header.split(':')[0]] = header.split(':')[1].strip() - list[host.hostname] = {'Code': host.response_code, + result[host.hostname] = {'Code': host.response_code, 'Hash': host.hash, 'Headers': headers} - file.write_file(json.dumps(list)) + output['Result'] = result + file.write_file(json.dumps(output)) def output_fuzzy(self):