Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 ...")
cont.client.send_analysis_state('indexing-symbols')
def handle_open_idb(self, _, is_old_database):
"""Performs start-up tasks when a new IDB is loaded."""
# Is IDB part of a continuum project? Open it.
proj_dir = Project.find_project_dir(GetIdbDir())
if proj_dir:
project = Project()
project.open(proj_dir)
self.open_project(project)
project.index.sync_types_into_idb()