44from certipy .commands .find import Find
55from certipy .lib .target import Target , DnsResolver
66from certipy .lib .formatting import pretty_print
7+ from datetime import datetime
78
89from nxc .paths import NXC_PATH
910
@@ -95,8 +96,9 @@ def on_login(self, context, connection):
9596 if self .json or self .csv or self .text :
9697 makedirs (self .output_path , exist_ok = True )
9798
99+ filename = f"certipy_{ connection .hostname } _{ connection .host } _{ datetime .now ().strftime ('%Y-%m-%d_%H%M%S' )} " .replace (":" , "-" )
98100 if self .json :
99- with open (f"{ self .output_path } /certipy-find .json" , "w" ) as f :
101+ with open (f"{ self .output_path } /{ filename } .json" , "w" ) as f :
100102 json .dump (
101103 output ,
102104 f ,
@@ -106,10 +108,10 @@ def on_login(self, context, connection):
106108 if self .csv :
107109 template_output = finder .get_template_output_for_csv (output )
108110 ca_output = finder .get_ca_output_for_csv (output )
109- with open (f"{ self .output_path } /certipy-find -templates.csv" , "w" ) as f :
111+ with open (f"{ self .output_path } /{ filename } -templates.csv" , "w" ) as f :
110112 f .write (template_output )
111- with open (f"{ self .output_path } /certipy-find -cas.csv" , "w" ) as f :
113+ with open (f"{ self .output_path } /{ filename } -cas.csv" , "w" ) as f :
112114 f .write (ca_output )
113115 if self .text :
114- with open (f"{ self .output_path } /certipy-find .txt" , "w" ) as f :
116+ with open (f"{ self .output_path } /{ filename } .txt" , "w" ) as f :
115117 pretty_print (output , print_func = lambda x : f .write (x + "\n " ))
0 commit comments