Exemplo n.º 1
0
 def _low_level_il_instruction_action(cls, view, func, instr, action):
     try:
         file_metadata = filemetadata.FileMetadata(
             handle=core.BNGetFileForView(view))
         view_obj = binaryview.BinaryView(
             file_metadata=file_metadata,
             handle=core.BNNewViewReference(view))
         owner = function.Function(view_obj,
                                   core.BNGetLowLevelILOwnerFunction(func))
         func_obj = lowlevelil.LowLevelILFunction(
             owner.arch, core.BNNewLowLevelILFunctionReference(func), owner)
         action(view_obj, func_obj[instr])
     except:
         log.log_error(traceback.format_exc())
Exemplo n.º 2
0
 def _recognize_low_level_il(self, ctxt, data, func, il):
     try:
         file_metadata = filemetadata.FileMetadata(
             handle=core.BNGetFileForView(data))
         view = binaryview.BinaryView(file_metadata=file_metadata,
                                      handle=core.BNNewViewReference(data))
         func = function.Function(view,
                                  handle=core.BNNewFunctionReference(func))
         il = lowlevelil.LowLevelILFunction(
             func.arch, handle=core.BNNewLowLevelILFunctionReference(il))
         return self.recognize_low_level_il(view, func, il)
     except:
         log.log_error(traceback.format_exc())
         return False
Exemplo n.º 3
0
 def _function_is_valid(cls, view, func, is_valid):
     try:
         if is_valid is None:
             return True
         file_metadata = filemetadata.FileMetadata(
             handle=core.BNGetFileForView(view))
         view_obj = binaryview.BinaryView(
             file_metadata=file_metadata,
             handle=core.BNNewViewReference(view))
         func_obj = function.Function(view_obj,
                                      core.BNNewFunctionReference(func))
         return is_valid(view_obj, func_obj)
     except:
         log.log_error(traceback.format_exc())
         return False
Exemplo n.º 4
0
 def _medium_level_il_function_action(cls, view, func, action):
     try:
         file_metadata = filemetadata.FileMetadata(
             handle=core.BNGetFileForView(view))
         view_obj = binaryview.BinaryView(
             file_metadata=file_metadata,
             handle=core.BNNewViewReference(view))
         owner = function.Function(
             view_obj, core.BNGetMediumLevelILOwnerFunction(func))
         func_obj = mediumlevelil.MediumLevelILFunction(
             owner.arch, core.BNNewMediumLevelILFunctionReference(func),
             owner)
         action(view_obj, func_obj)
     except:
         log.log_error(traceback.format_exc())
Exemplo n.º 5
0
 def _low_level_il_function_is_valid(cls, view, func, is_valid):
     try:
         if is_valid is None:
             return True
         file_metadata = filemetadata.FileMetadata(
             handle=core.BNGetFileForView(view))
         view_obj = binaryview.BinaryView(
             file_metadata=file_metadata,
             handle=core.BNNewViewReference(view))
         owner = function.Function(view_obj,
                                   core.BNGetLowLevelILOwnerFunction(func))
         func_obj = lowlevelil.LowLevelILFunction(
             owner.arch, core.BNNewLowLevelILFunctionReference(func), owner)
         return is_valid(view_obj, func_obj)
     except:
         log.log_error(traceback.format_exc())
         return False