@@ -205,12 +205,12 @@ def do_token_reset(self, api, token, username):
205205 try :
206206 token_ .write (token )
207207 except :
208- lib .output .warning ("issue writing token, is it blank?" )
208+ lib .output .warning ("issue writing token, is it blank? Try again " )
209209 with open (lib .settings .API_KEYS ["censys" ][1 ], 'w' ) as username_ :
210210 try :
211211 username_ .write (username )
212212 except :
213- lib .output .warning ("issue writing username, is it blank?" )
213+ lib .output .warning ("issue writing username, is it blank? Try again " )
214214 else :
215215 with open (lib .settings .API_KEYS ["shodan" ][0 ], 'w' ) as token_ :
216216 token_ .write (token )
@@ -465,7 +465,13 @@ def do_load_custom_hosts(self, file_path):
465465 return
466466 lib .output .warning ("overwriting hosts file with provided, and backing up current" )
467467 backup_path = lib .settings .backup_host_file (lib .settings .HOST_FILE , lib .settings .HOST_FILE_BACKUP )
468- shutil .copy (file_path , lib .settings .HOST_FILE )
468+ try :
469+ shutil .copy (file_path , lib .settings .HOST_FILE )
470+ except Exception as e :
471+ if "are the same file" in str (e ):
472+ lib .output .warning ("there hasn't been any changes to the file since last save" )
473+ else :
474+ raise e .__class__ (str (e ))
469475 lib .output .info ("host file replaced, backup stored under '{}'" .format (backup_path ))
470476 self .loaded_hosts = open (lib .settings .HOST_FILE ).readlines ()
471477
0 commit comments