Skip to content

Commit

Permalink
Merge pull request #50 from xuvez/master
Browse files Browse the repository at this point in the history
Closes #15. Add JSON output support
  • Loading branch information
codingo authored Oct 4, 2017
2 parents 3ec18a4 + 79b5a36 commit 5d383d6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ $ pip install -r requirements.txt
| --user-agent | Specify a user agent to use for scans. |
| --waf | If set then simple WAF bypass headers will be sent. |
| -oN OUTPUT_NORMAL | Normal output printed to a file when the -oN option is specified with a filename argument. |
| -oJ OUTPUT_JSON | JSON output printed to a file when the -oJ option is specified with a filename argument. |
| - | By passing a blank '-' you tell VHostScan to expect input from stdin (pipe). |

## Usage Examples
Expand Down
5 changes: 5 additions & 0 deletions VHostScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def main():
parser.add_argument('--user-agent', dest='user_agent', type=str, help='Specify a user-agent to use for scans')
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)
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
parser.add_argument("-oJ", dest="output_json", help="JSON output printed to a file when the -oJ option is specified with a filename argument." )
parser.add_argument("-", dest="stdin", action="store_true", help="By passing a blank '-' you tell VHostScan to expect input from stdin (pipe).", default=False)

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

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


if __name__ == "__main__":
main()
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.4'
__version__ = '1.5.1'

4 changes: 2 additions & 2 deletions lib/core/virtual_host_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def scan(self):
# add url and hash into array for likely matches
self.results.append(hostname + ',' + page_hash)

#rate limit the connection, if the int is 0 it is ignored
time.sleep(self.rate_limit)
#rate limit the connection, if the int is 0 it is ignored
time.sleep(self.rate_limit)

self.completed_scan=True

Expand Down
15 changes: 15 additions & 0 deletions lib/helpers/output_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from fuzzywuzzy import fuzz
import itertools
import numpy as np
import json


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


def output_json(self, filename):
file = file_helper(filename)
list = dict()
for host in self.scanner.hosts:
headers = {}
for header in host.keys:
headers[header.split(':')[0]] = header.split(':')[1].strip()

list[host.hostname] = {'Code': host.response_code,
'Hash': host.hash,
'Headers': headers}
file.write_file(json.dumps(list))


def output_fuzzy(self):
output = "\n\n[+] Match similarity using fuzzy logic:"
request_hashes = {}
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dnspython==1.15.0
fuzzywuzzy==0.15.1
numpy==1.12.0
pandas==0.19.2
Expand Down

0 comments on commit 5d383d6

Please sign in to comment.