Skip to content

Commit

Permalink
file error handling additions
Browse files Browse the repository at this point in the history
  • Loading branch information
knavesec committed Oct 27, 2022
1 parent d1e592b commit 8a5e71a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions credmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def main(args,pargs):

global start_time, end_time, time_lapse, outfile, cancelled, color, notify_obj, regions

# check if config file exists before parsing
if args.config is not None and not os.path.exists(args.config):
log_entry("Config file {} cannot be found".format(args.config))
return

# assign variables
# TOO MANY MF VARIABLES THIS HAS GOTTEN OUT OF CONTROL
# This is fine ;)
Expand Down Expand Up @@ -73,6 +78,23 @@ def main(args,pargs):
log_entry("File {} already exists, try again with a unique file name".format(outfile))
return

# File handling
if username_file is not None and not os.path.exists(username_file):
log_entry("Username file {} cannot be found".format(username_file))
return

if password_file is not None and not os.path.exists(password_file):
log_entry("Password file {} cannot be found".format(password_file))
return

if userpass_file is not None and not os.path.exists(userpass_file):
log_entry("User-pass file {} cannot be found".format(userpass_file))
return

if useragent_file is not None and not os.path.exists(useragent_file):
log_entry("Useragent file {} cannot be found".format(useragent_file))
return

# AWS Key Handling
if access_key is None and secret_access_key is None and session_token is None and profile_name is None:
log_entry("No FireProx access arguments settings configured, add access keys/session token or fill out config file")
Expand Down

0 comments on commit 8a5e71a

Please sign in to comment.