Skip to content

Commit 36684c7

Browse files
authored
Merge pull request #71 from codingo/codingo-output-grepable
Closes #6 - Output grepable support
2 parents 74db0e0 + c158499 commit 36684c7

File tree

6 files changed

+33
-2
lines changed

6 files changed

+33
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $ pip install -r requirements.txt
4949
| --user-agent | Specify a user agent to use for scans. |
5050
| --waf | If set then simple WAF bypass headers will be sent. |
5151
| -oN OUTPUT_NORMAL | Normal output printed to a file when the -oN option is specified with a filename argument. |
52+
| -oG OUTPUT_GREPABLE | Grepable output printed to a file when the -oG is specified with a filename argument. |
5253
| -oJ OUTPUT_JSON | JSON output printed to a file when the -oJ option is specified with a filename argument. |
5354
| - | By passing a blank '-' you tell VHostScan to expect input from stdin (pipe). |
5455

VHostScan.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ def main():
120120

121121
if(arguments.output_json):
122122
output.output_json(arguments.output_json)
123-
print("\n[+] Writing json ouptut to %s" % arguments.output_json)
123+
print("\n[+] Writing json output to %s" % arguments.output_json)
124+
125+
if(arguments.output_grepable):
126+
output.output_grepable(arguments.output_grepable)
127+
print("\n[+] Writing grepable ouptut to %s" % arguments.output_json)
124128

125129

126130
if __name__ == "__main__":

lib/core/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# |V|H|o|s|t|S|c|a|n| Developed by @codingo_ & @__timk
33
# +-+-+-+-+-+-+-+-+-+ https://github.com/codingo/VHostScan
44

5-
__version__ = '1.6.4'
5+
__version__ = '1.7'

lib/helpers/output_helper.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ def write_normal(self, filename):
2424
output += self.output_normal_detail()
2525
file.write_file(output)
2626

27+
def write_grepable(self, filename):
28+
file = file_helper(filename)
29+
30+
output = self.generate_header()
31+
output += self.output_grepable_detail()
32+
33+
file.write_file(output)
34+
2735
def output_normal_likely(self):
2836
uniques = False
2937
depth = str(self.scanner.unique_depth)
@@ -107,6 +115,16 @@ def output_normal_detail(self):
107115

108116
return output
109117

118+
def output_grepable_detail(self):
119+
for host in self.scanner.hosts:
120+
output += "\n{}\t{}\t{}".format(
121+
str(host.hostname),
122+
str(host.response_code),
123+
str(host.hash)
124+
)
125+
126+
return output
127+
110128
def generate_header(self):
111129
output = "VHostScanner Log: {} {}\n".format(
112130
time.strftime("%d/%m/%Y"),

lib/input.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ def setup_parser():
117117
'specified with a filename argument.'
118118
)
119119

120+
output.add_argument(
121+
'-oG', dest='output_grepable',
122+
help='Grepable output printed to a file when the -oG option is '
123+
'specified with a filename argument.'
124+
)
125+
120126
user_agent = parser.add_mutually_exclusive_group()
121127
user_agent.add_argument(
122128
'--random-agent', dest='random_agent', action='store_true',

tests/test_input.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_parse_arguments_default_value(tmpdir):
3030
'add_waf_bypass_headers': False,
3131
'output_normal': None,
3232
'output_json': None,
33+
'output_grepable' : None,
3334
'stdin': False,
3435
'ssl': False,
3536
}
@@ -83,6 +84,7 @@ def test_parse_arguments_custom_arguments(tmpdir):
8384
'add_waf_bypass_headers': True,
8485
'output_normal': '/tmp/on',
8586
'output_json': None,
87+
'output_grepable' : None,
8688
'stdin': True,
8789
}
8890

0 commit comments

Comments
 (0)