1+ #!/usr/bin/env python
2+
13# _ _ _ _ _
24# | | | | (_) | |
35# _ _ ___| |__ | | _ _| | |
5557Options:
5658 -h --help: Show this help
5759 --version: Print usbkill version and exit
58- --cs: Copy program folder settings .ini to /etc/usbkill/settings .ini
59- --no-shut-down: Execute all the (destructive) commands you defined in settings .ini,
60+ --cs: Copy program folder usbkill .ini to /etc/usbkill/usbkill .ini
61+ --no-shut-down: Execute all the (destructive) commands you defined in usbkill .ini,
6062 but don't turn off the computer
6163"""
6264
@@ -111,7 +113,7 @@ def shred(settings):
111113 settings ['folders_to_remove' ].append (usbkill_folder )
112114 else :
113115 settings ['files_to_remove' ].append (os .path .realpath (__file__ ))
114- settings ['files_to_remove' ].append (usbkill_folder + "/settings .ini" )
116+ settings ['files_to_remove' ].append (usbkill_folder + "/usbkill .ini" )
115117
116118 # Remove files and folders
117119 for _file in settings ['files_to_remove' ] + settings ['folders_to_remove' ]:
@@ -381,16 +383,14 @@ def startup_checks():
381383 except subprocess .CalledProcessError :
382384 print ("[NOTICE] FileVault is disabled. Sensitive data SHOULD be encrypted." )
383385
384- # On first time use copy settings .ini to /etc/usebkill.ini
386+ # On first time use copy usbkill .ini to /etc/usebkill.ini
385387 # If dev-mode, always copy and don't remove old settings
386388 if not os .path .isfile (SETTINGS_FILE ) or copy_settings :
387389 sources_path = os .path .dirname (os .path .realpath (__file__ )) + '/'
388- if not os .path .isfile (sources_path + "settings.ini" ):
389- sys .exit ("\n [ERROR] You have lost your settings file. Get a new copy of the settings.ini and place it in /etc/ or in " + sources_path + "/\n " )
390- print ("[NOTICE] Copying setting.ini to " + SETTINGS_FILE )
391- os .system ("cp " + sources_path + "settings.ini " + SETTINGS_FILE )
392- if not copy_settings :
393- os .remove (sources_path + "settings.ini" )
390+ if not os .path .isfile (sources_path + "install/usbkill.ini" ):
391+ sys .exit ("\n [ERROR] You have lost your settings file. Get a new copy of the usbkill.ini and place it in /etc/ or in " + sources_path + "/\n " )
392+ print ("[NOTICE] Copying install/setting.ini to " + SETTINGS_FILE )
393+ os .system ("cp " + sources_path + "install/usbkill.ini " + SETTINGS_FILE )
394394
395395 # Load settings
396396 settings = load_settings (SETTINGS_FILE )
@@ -399,7 +399,7 @@ def startup_checks():
399399 # Make sure no spaces a present in paths to be wiped.
400400 for name in settings ['folders_to_remove' ] + settings ['files_to_remove' ]:
401401 if ' ' in name :
402- msg += "[ERROR][WARNING] '" + name + "'as specified in your settings .ini contains a space.\n "
402+ msg += "[ERROR][WARNING] '" + name + "'as specified in your usbkill .ini contains a space.\n "
403403 sys .exit (msg )
404404
405405 # Make sure srm is present if it will be used.
@@ -428,7 +428,7 @@ def startup_checks():
428428
429429 return settings
430430
431- if __name__ == "__main__" :
431+ def go () :
432432 # Run startup checks and load settings
433433 settings = startup_checks ()
434434
@@ -444,3 +444,8 @@ def exit_handler(signum, frame):
444444
445445 # Start main loop
446446 loop (settings )
447+
448+ if __name__ == "__main__" :
449+ go ()
450+
451+
0 commit comments