Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from idc import *
from idautils import *
sys.path.append(
os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'..',
)
)
from continuum import Continuum
from continuum.project import Project
# Connect to server instance.
proj = Project()
cont = Continuum()
proj.open(Project.find_project_dir(GetIdbDir()), skip_analysis=True)
cont.open_project(proj)
# Wait for auto-analysis to complete.
SetShortPrm(INF_AF2, GetShortPrm(INF_AF2) | AF2_DODATA)
print("Analyzing input file ...")
cont.client.send_analysis_state('auto-analysis')
Wait()
# Index types.
print("Indexing types ...")
cont.client.send_analysis_state('indexing-types')
proj.index.index_types_for_this_idb()
# Index symbols.
print("Indexing symbols ...")
def init(self):
"""init callback, invoked by IDA when the plugin is loaded."""
self.core = Continuum()
zelf = self
# Place UI hook so we know when to create our UI stuff.
class UiHooks(idaapi.UI_Hooks):
def ready_to_run(self, *_):
zelf.ui_init()
zelf.ui_hook.unhook()
self.ui_hook = UiHooks()
self.ui_hook.hook()
# Setup IDP hook for type changes.
class IdbHooks(idaapi.IDB_Hooks):
def local_types_changed(self, *args):
if zelf.core.client and not zelf.core.project.ignore_changes:
zelf.core.project.index.index_types_for_this_idb(purge_locally_deleted=True)