Skip to content

Closes #52 - Added command line flags for JSON output #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

12 changes: 8 additions & 4 deletions lib/helpers/file_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)

Expand Down
20 changes: 16 additions & 4 deletions lib/helpers/output_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down