Skip to content

Commit 5d383d6

Browse files
authored
Merge pull request #50 from xuvez/master
Closes #15. Add JSON output support
2 parents 3ec18a4 + 79b5a36 commit 5d383d6

6 files changed

+25
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ $ pip install -r requirements.txt
4747
| --user-agent | Specify a user agent to use for scans. |
4848
| --waf | If set then simple WAF bypass headers will be sent. |
4949
| -oN OUTPUT_NORMAL | Normal output printed to a file when the -oN option is specified with a filename argument. |
50+
| -oJ OUTPUT_JSON | JSON output printed to a file when the -oJ option is specified with a filename argument. |
5051
| - | By passing a blank '-' you tell VHostScan to expect input from stdin (pipe). |
5152

5253
## Usage Examples

VHostScan.py

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def main():
3737
parser.add_argument('--user-agent', dest='user_agent', type=str, help='Specify a user-agent to use for scans')
3838
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)
3939
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
40+
parser.add_argument("-oJ", dest="output_json", help="JSON output printed to a file when the -oJ option is specified with a filename argument." )
4041
parser.add_argument("-", dest="stdin", action="store_true", help="By passing a blank '-' you tell VHostScan to expect input from stdin (pipe).", default=False)
4142

4243
arguments = parser.parse_args()
@@ -108,6 +109,10 @@ def main():
108109
output.write_normal(arguments.output_normal)
109110
print("\n[+] Writing normal ouptut to %s" % arguments.output_normal)
110111

112+
if(arguments.output_json):
113+
output.output_json(arguments.output_json)
114+
print("\n[+] Writing json ouptut to %s" % arguments.output_json)
115+
111116

112117
if __name__ == "__main__":
113118
main()

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.4'
5+
__version__ = '1.5.1'
66

lib/core/virtual_host_scanner.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def scan(self):
119119
# add url and hash into array for likely matches
120120
self.results.append(hostname + ',' + page_hash)
121121

122-
#rate limit the connection, if the int is 0 it is ignored
123-
time.sleep(self.rate_limit)
122+
#rate limit the connection, if the int is 0 it is ignored
123+
time.sleep(self.rate_limit)
124124

125125
self.completed_scan=True
126126

lib/helpers/output_helper.py

+15
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,20 @@ 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+
'Headers': headers}
58+
file.write_file(json.dumps(list))
59+
60+
4661
def output_fuzzy(self):
4762
output = "\n\n[+] Match similarity using fuzzy logic:"
4863
request_hashes = {}

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dnspython==1.15.0
12
fuzzywuzzy==0.15.1
23
numpy==1.12.0
34
pandas==0.19.2

0 commit comments

Comments
 (0)