Skip to content
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

Closes #6 - Output grepable support #71

Merged
merged 5 commits into from
Oct 11, 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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. |
| -oG OUTPUT_GREPABLE | Grepable output printed to a file when the -oG 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). |

Expand Down
6 changes: 5 additions & 1 deletion VHostScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def main():

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

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


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion lib/core/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# |V|H|o|s|t|S|c|a|n| Developed by @codingo_ & @__timk
# +-+-+-+-+-+-+-+-+-+ https://github.com/codingo/VHostScan

__version__ = '1.6.4'
__version__ = '1.7'
18 changes: 18 additions & 0 deletions lib/helpers/output_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def write_normal(self, filename):
output += self.output_normal_detail()
file.write_file(output)

def write_grepable(self, filename):
file = file_helper(filename)

output = self.generate_header()
output += self.output_grepable_detail()

file.write_file(output)

def output_normal_likely(self):
uniques = False
depth = str(self.scanner.unique_depth)
Expand Down Expand Up @@ -107,6 +115,16 @@ def output_normal_detail(self):

return output

def output_grepable_detail(self):
for host in self.scanner.hosts:
output += "\n{}\t{}\t{}".format(
str(host.hostname),
str(host.response_code),
str(host.hash)
)

return output

def generate_header(self):
output = "VHostScanner Log: {} {}\n".format(
time.strftime("%d/%m/%Y"),
Expand Down
6 changes: 6 additions & 0 deletions lib/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ def setup_parser():
'specified with a filename argument.'
)

output.add_argument(
'-oG', dest='output_grepable',
help='Grepable output printed to a file when the -oG option is '
'specified with a filename argument.'
)

user_agent = parser.add_mutually_exclusive_group()
user_agent.add_argument(
'--random-agent', dest='random_agent', action='store_true',
Expand Down
2 changes: 2 additions & 0 deletions tests/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def test_parse_arguments_default_value(tmpdir):
'add_waf_bypass_headers': False,
'output_normal': None,
'output_json': None,
'output_grepable' : None,
'stdin': False,
'ssl': False,
}
Expand Down Expand Up @@ -83,6 +84,7 @@ def test_parse_arguments_custom_arguments(tmpdir):
'add_waf_bypass_headers': True,
'output_normal': '/tmp/on',
'output_json': None,
'output_grepable' : None,
'stdin': True,
}

Expand Down