explorer: use bitmask + enum for analyze option

This commit is contained in:
Ana Maria Martinez Gomez
2021-05-25 10:58:35 +02:00
parent 2158be0a2e
commit 0685d36220

View File

@@ -44,6 +44,13 @@ CAPA_SETTINGS_RULE_PATH = "rule_path"
CAPA_SETTINGS_RULEGEN_AUTHOR = "rulegen_author"
CAPA_SETTINGS_RULEGEN_SCOPE = "rulegen_scope"
from enum import IntFlag
class Options(IntFlag):
DEFAULT = 0
ANALYZE = 1 # Runs the analysis when starting the explorer
def write_file(path, data):
""" """
@@ -230,7 +237,7 @@ class CapaSettingsInputDialog(QtWidgets.QDialog):
class CapaExplorerForm(idaapi.PluginForm):
"""form element for plugin interface"""
def __init__(self, name, option=0):
def __init__(self, name, option=Options.DEFAULT):
"""initialize form elements"""
super(CapaExplorerForm, self).__init__()
@@ -278,7 +285,7 @@ class CapaExplorerForm(idaapi.PluginForm):
self.Show()
if option == 1:
if (option & Options.ANALYZE) == Options.ANALYZE:
self.analyze_program()
def OnCreate(self, form):