mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
Merge pull request #1957 from mandiant/fix/explorer-bugs
fix rule display and save functionality
This commit is contained in:
@@ -1073,9 +1073,7 @@ class CapaExplorerForm(idaapi.PluginForm):
|
||||
|
||||
self.view_rulegen_features.load_features(all_file_features, all_function_features)
|
||||
|
||||
self.set_view_status_label(
|
||||
f"capa rules: {settings.user[CAPA_SETTINGS_RULE_PATH]} ({settings.user[CAPA_SETTINGS_RULE_PATH]} rules)"
|
||||
)
|
||||
self.set_view_status_label(f"capa rules: {settings.user[CAPA_SETTINGS_RULE_PATH]}")
|
||||
except Exception as e:
|
||||
logger.exception("Failed to render views (error: %s)", e)
|
||||
return False
|
||||
@@ -1324,10 +1322,17 @@ class CapaExplorerForm(idaapi.PluginForm):
|
||||
idaapi.info("No rule to save.")
|
||||
return
|
||||
|
||||
path = Path(self.ask_user_capa_rule_file())
|
||||
if not path.exists():
|
||||
rule_file_path = self.ask_user_capa_rule_file()
|
||||
if not rule_file_path:
|
||||
# dialog canceled
|
||||
return
|
||||
|
||||
path = Path(rule_file_path)
|
||||
if not path.parent.exists():
|
||||
logger.warning("Failed to save file: parent directory '%s' does not exist.", path.parent)
|
||||
return
|
||||
|
||||
logger.info("Saving rule to %s.", path)
|
||||
write_file(path, s)
|
||||
|
||||
def slot_checkbox_limit_by_changed(self, state):
|
||||
|
||||
Reference in New Issue
Block a user