Skip to content

Commit ab46c28

Browse files
authored
Merge pull request #70 from codingo/codingo-json-output-check
Added feedback for user when -oJ fails to format as JSON
2 parents 7697201 + a1f83e3 commit ab46c28

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/core/__version__.py

+1-1
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.3'
5+
__version__ = '1.6.4'

lib/helpers/file_helper.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def check_directory(self):
1616
os.mkdir(directory)
1717
print("[!] %s didn't exist and has been created." % directory)
1818

19-
# placeholder for error checking on -oJ implementation
2019
def is_json(json_file):
2120
try:
2221
with open(json_file, "r") as f:

lib/helpers/output_helper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@ def __init__(self, scanner, arguments):
1515
def write_normal(self, filename):
1616
file = file_helper(filename)
1717

18-
# todo: finish check_directory (needs regex to split out filename)
19-
# file.check_directory(filename)
20-
2118
output = self.generate_header()
2219
output += self.output_normal_likely()
2320

2421
if(self.arguments.fuzzy_logic):
2522
output += self.output_fuzzy()
2623

2724
output += self.output_normal_detail()
28-
2925
file.write_file(output)
3026

3127
def output_normal_likely(self):
@@ -74,6 +70,10 @@ def output_json(self, filename):
7470
}
7571

7672
output['Result'] = result
73+
74+
if not file.is_json(output):
75+
print("[!] Json format check failed")
76+
7777
file.write_file(json.dumps(output, indent=2))
7878

7979
def output_fuzzy(self):

0 commit comments

Comments
 (0)