Skip to content

Commit 0142523

Browse files
author
Michael Skelton
committed
Added writing out of file for oN (normal output)
1 parent 695dd5e commit 0142523

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

VHostScan.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def main():
2626
parser.add_argument('--ignore-content-length', dest='ignore_content_length', type=int, help='Ignore content lengths of specificed amount (default 0).', default=0)
2727
parser.add_argument('--unique-depth', dest='unique_depth', type=int, help='Show likely matches of page content that is found x times (default 1).', default=1)
2828
parser.add_argument("--ssl", dest="ssl", action="store_true", help="If set then connections will be made over HTTPS instead of HTTP (default http).", default=False)
29+
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
2930
arguments = parser.parse_args()
3031

3132
if not os.path.exists(arguments.wordlist):
@@ -47,10 +48,14 @@ def main():
4748
scanner = virtual_host_scanner(arguments.target_hosts, arguments.base_host, arguments.port, arguments.real_port, arguments.ssl, arguments.unique_depth, arguments.ignore_http_codes, arguments.ignore_content_length, arguments.wordlist)
4849

4950
scanner.scan()
50-
5151
output = output_helper(scanner)
52-
print(output.output_normal_detail())
52+
5353
print(output.output_normal_likely())
5454

55+
if(arguments.output_normal):
56+
output.write_normal(arguments.output_normal)
57+
print("\n[+] Writing normal ouptut to %s" % arguments.output_normal)
58+
59+
5560
if __name__ == "__main__":
5661
main()

lib/helpers/file_helper.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ class file_helper(object):
66
def __init__(self, output_file):
77
self.output_file = output_file
88

9-
def check_directory(output_directory):
9+
def check_directory(self):
10+
directory = self.output_file
1011
try:
11-
os.stat(output_directory)
12+
os.stat(self.directory)
1213
except:
13-
os.mkdir(output_directory)
14+
os.mkdir(self.directory)
1415
print("[!] %s didn't exist and has been created." % output_directory)
1516

16-
# validate json of output
17+
# placeholder for error checking on -oJ implementation
1718
def is_json(json_file):
1819
try:
1920
with open(json_file, "r") as f:
2021
json_object = json.load(f)
2122
except ValueError:
2223
return False
23-
return True
24+
return True
25+
26+
def write_file(self, contents):
27+
with open(self.output_file, "w") as o:
28+
o.write(contents)

0 commit comments

Comments
 (0)