File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,13 @@ def __init__(self, output_file):
7
7
self .output_file = output_file
8
8
9
9
def check_directory (self ):
10
- directory = self .output_file
10
+ directory = os .path .dirname (self .output_file )
11
+
11
12
try :
12
- os .stat (self . directory )
13
+ os .stat (directory )
13
14
except :
14
- os .mkdir (self . directory )
15
- print ("[!] %s didn't exist and has been created." % output_directory )
15
+ os .mkdir (directory )
16
+ print ("[!] %s didn't exist and has been created." % directory )
16
17
17
18
# placeholder for error checking on -oJ implementation
18
19
def is_json (json_file ):
@@ -24,6 +25,9 @@ def is_json(json_file):
24
25
return True
25
26
26
27
def write_file (self , contents ):
28
+ # check if host directory exists, if not create it
29
+ self .check_directory ()
30
+
27
31
with open (self .output_file , "w" ) as o :
28
32
o .write (contents )
29
33
You can’t perform that action at this time.
0 commit comments