Skip to content

Commit 09f571a

Browse files
committed
Closes 15. Add JSON output support
1 parent d9b2a3d commit 09f571a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

VHostScan.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def main():
3434
parser.add_argument("--rate-limit", dest="rate_limit", type=int, help='Amount of time in seconds to delay between each scan (default 0).', default=0)
3535
parser.add_argument("--waf", dest="add_waf_bypass_headers", action="store_true", help="If set then simple WAF bypass headers will be sent.", default=False)
3636
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
37+
parser.add_argument("-oJ", dest="output_json", help="JSON output printed to a file when the -oJ option is specified with a filename argument." )
3738
parser.add_argument("-", dest="stdin", action="store_true", help="By passing a blank '-' you tell VHostScan to expect input from stdin (pipe).", default=False)
3839

3940
arguments = parser.parse_args()
@@ -104,6 +105,10 @@ def main():
104105
output.write_normal(arguments.output_normal)
105106
print("\n[+] Writing normal ouptut to %s" % arguments.output_normal)
106107

108+
if(arguments.output_json):
109+
output.output_json(arguments.output_json)
110+
print("\n[+] Writing json ouptut to %s" % arguments.output_json)
111+
107112

108113
if __name__ == "__main__":
109114
main()

lib/helpers/output_helper.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from fuzzywuzzy import fuzz
55
import itertools
66
import numpy as np
7+
import json
78

89

910
class output_helper(object):
@@ -43,6 +44,21 @@ def output_normal_likely(self):
4344
return "\n[!] No matches with a unique count of {} or less.".format(depth)
4445

4546

47+
def output_json(self, filename):
48+
file = file_helper(filename)
49+
list = dict()
50+
for host in self.scanner.hosts:
51+
headers = {}
52+
for header in host.keys:
53+
headers[header.split(':')[0]] = header.split(':')[1].strip()
54+
55+
list[host.hostname] = {'Code': host.response_code,
56+
'Hash': host.hash,
57+
'Response': host.content,
58+
'Headers': headers}
59+
file.write_file(json.dumps(list))
60+
61+
4662
def output_fuzzy(self):
4763
output = "\n\n[+] Match similarity using fuzzy logic:"
4864
request_hashes = {}

0 commit comments

Comments
 (0)