Merge pull request #687 from fireeye/fix/655

remove duplicate check when saving file
This commit is contained in:
mike-hunhoff
2021-07-27 10:49:23 -06:00
committed by GitHub
2 changed files with 12 additions and 4 deletions

View File

@@ -19,6 +19,7 @@
### capa explorer IDA Pro plugin
- explorer: add additional filter logic when displaying matches by function #686 @mike-hunhoff
- explorer: remove duplicate check when saving file #687 @mike-hunhoff
### Development

View File

@@ -54,8 +54,6 @@ class Options(IntFlag):
def write_file(path, data):
""" """
if os.path.exists(path) and 1 != idaapi.ask_yn(1, "The file already exists. Overwrite?"):
return
with open(path, "wb") as save_file:
save_file.write(data)
@@ -1140,7 +1138,7 @@ class CapaExplorerForm(idaapi.PluginForm):
s = json.dumps(self.doc, sort_keys=True, cls=capa.render.json.CapaJsonObjectEncoder).encode("utf-8")
path = idaapi.ask_file(True, "*.json", "Choose file to save capa program analysis JSON")
path = self.ask_user_capa_json_file()
if not path:
return
@@ -1216,7 +1214,16 @@ class CapaExplorerForm(idaapi.PluginForm):
def ask_user_capa_rule_file(self):
""" """
return QtWidgets.QFileDialog.getSaveFileName(
None, "Please select a capa rule to edit", settings.user.get(CAPA_SETTINGS_RULE_PATH, ""), "*.yml"
None,
"Please select a location to save capa rule file",
settings.user.get(CAPA_SETTINGS_RULE_PATH, ""),
"*.yml",
)[0]
def ask_user_capa_json_file(self):
""" """
return QtWidgets.QFileDialog.getSaveFileName(
None, "Please select a location to save capa JSON file", "", "*.json"
)[0]
def set_view_status_label(self, text):