Skip to content

Commit

Permalink
Attempt to remove custom PBA file when resetting config only if filen…
Browse files Browse the repository at this point in the history
…ame exists in DB
  • Loading branch information
shreyamalviya committed Apr 19, 2021
1 parent 57f8f20 commit 1ad8249
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions monkey/monkey_island/cc/resources/pba_file_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ def delete(self, file_type):
PBA_LINUX_FILENAME_PATH if file_type == "PBAlinux" else PBA_WINDOWS_FILENAME_PATH
)
filename = ConfigService.get_config_value(filename_path)
file_path = Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename)
try:
if os.path.exists(file_path):
os.remove(file_path)
ConfigService.set_config_value(filename_path, "")
except OSError as e:
LOG.error("Can't remove previously uploaded post breach files: %s" % e)
if filename:
file_path = Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename)
try:
if os.path.exists(file_path):
os.remove(file_path)
ConfigService.set_config_value(filename_path, "")
except OSError as e:
LOG.error("Can't remove previously uploaded post breach files: %s" % e)

return {}

Expand Down

0 comments on commit 1ad8249

Please sign in to comment.