def __init__(self, handle, view=None): self._view = view self.handle = core.handle_of_type(handle, core.BNBasicBlock) self._arch = None self._func = None self._instStarts = None self._instLengths = None
def __init__(self, provider, handle=None): if handle is None: self._cb = core.BNScriptingInstanceCallbacks() self._cb.context = 0 self._cb.destroyInstance = self._cb.destroyInstance.__class__( self._destroy_instance) self._cb.executeScriptInput = self._cb.executeScriptInput.__class__( self._execute_script_input) self._cb.cancelScriptInput = self._cb.cancelScriptInput.__class__( self._cancel_script_input) self._cb.setCurrentBinaryView = self._cb.setCurrentBinaryView.__class__( self._set_current_binary_view) self._cb.setCurrentFunction = self._cb.setCurrentFunction.__class__( self._set_current_function) self._cb.setCurrentBasicBlock = self._cb.setCurrentBasicBlock.__class__( self._set_current_basic_block) self._cb.setCurrentAddress = self._cb.setCurrentAddress.__class__( self._set_current_address) self._cb.setCurrentSelection = self._cb.setCurrentSelection.__class__( self._set_current_selection) self._cb.completeInput = self._cb.completeInput.__class__( self._complete_input) self._cb.completeInput.restype = ctypes.c_void_p self.handle = core.BNInitScriptingInstance(provider.handle, self._cb) self.delimiters = ' \t\n`~!@#$%^&*()-=+{}\\|;:\'",<>/?' else: self.handle = core.handle_of_type(handle, core.BNScriptingInstance) self.listeners = []
def __init__(self, sym_type, addr, short_name, full_name=None, raw_name=None, handle=None, binding=None, namespace=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNSymbol) else: if isinstance(sym_type, str): sym_type = SymbolType[sym_type] if full_name is None: full_name = short_name if raw_name is None: raw_name = full_name if binding is None: binding = SymbolBinding.NoBinding if isinstance(namespace, str): namespace = NameSpace(namespace) if isinstance(namespace, NameSpace): namespace = namespace._get_core_struct() self.handle = core.BNCreateSymbol(sym_type, short_name, full_name, raw_name, addr, binding, namespace)
def __init__(self, contents="", handle=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNDataBuffer) elif isinstance(contents, int) or isinstance(contents, long): self.handle = core.BNCreateDataBuffer(None, contents) elif isinstance(contents, DataBuffer): self.handle = core.BNDuplicateDataBuffer(contents.handle) else: self.handle = core.BNCreateDataBuffer(contents, len(contents))
def __init__(self, arch, handle = None, source_func = None): self.arch = arch self.source_function = source_func if handle is not None: self.handle = core.handle_of_type(handle, core.BNMediumLevelILFunction) else: if self.source_function is None: raise ValueError("IL functions must be created with an associated function") func_handle = self.source_function.handle self.handle = core.BNCreateMediumLevelILFunction(arch.handle, func_handle)
def __init__(self, provider, handle = None): if handle is None: self._cb = core.BNDownloadInstanceCallbacks() self._cb.context = 0 self._cb.destroyInstance = self._cb.destroyInstance.__class__(self._destroy_instance) self._cb.performRequest = self._cb.performRequest.__class__(self._perform_request) self.handle = core.BNInitDownloadInstance(provider.handle, self._cb) self.__class__._registered_instances.append(self) else: self.handle = core.handle_of_type(handle, core.BNDownloadInstance) self._must_free = handle is not None
def __init__(self, contents="", handle=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNDataBuffer) elif isinstance(contents, int) or isinstance(contents, long): self.handle = core.BNCreateDataBuffer(None, contents) elif isinstance(contents, DataBuffer): self.handle = core.BNDuplicateDataBuffer(contents.handle) else: if bytes != str and isinstance(contents, str): contents = contents.encode('charmap') self.handle = core.BNCreateDataBuffer(contents, len(contents))
def __init__(self, provider, handle=None): if handle is None: self._cb = core.BNDownloadInstanceCallbacks() self._cb.context = 0 self._cb.destroyInstance = self._cb.destroyInstance.__class__( self._destroy_instance) self._cb.performRequest = self._cb.performRequest.__class__( self._perform_request) self.handle = core.BNInitDownloadInstance(provider.handle, self._cb) else: self.handle = core.handle_of_type(handle, core.BNDownloadInstance) self._outputCallbacks = None
def __init__(self, filename = None, handle = None): """ Instantiates a new FileMetadata class. :param filename: The string path to the file to be opened. Defaults to None. :param handle: A handle to the underlying C FileMetadata object. Defaults to None. """ if handle is not None: self.handle = core.handle_of_type(handle, core.BNFileMetadata) else: binaryninja._init_plugins() self.handle = core.BNCreateFileMetadata() if filename is not None: core.BNSetFilename(self.handle, str(filename)) self.nav = None
def __init__(self, filename=None, handle=None): """ Instantiates a new FileMetadata class. :param filename: The string path to the file to be opened. Defaults to None. :param handle: A handle to the underlying C FileMetadata object. Defaults to None. """ if handle is not None: self.handle = core.handle_of_type(handle, core.BNFileMetadata) else: binaryninja._init_plugins() self.handle = core.BNCreateFileMetadata() if filename is not None: core.BNSetFilename(self.handle, str(filename)) self._nav = None
def __init__(self, contents="", handle=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNDataBuffer) elif isinstance(contents, int) or isinstance(contents, numbers.Integral): self.handle = core.BNCreateDataBuffer(None, contents) elif isinstance(contents, DataBuffer): self.handle = core.BNDuplicateDataBuffer(contents.handle) else: if isinstance(contents, bytes) or isinstance( contents, bytearray) or isinstance(contents, str): contents = cstr(contents) else: raise TypeError( "DataBuffer contents must be bytes, bytearray, or str") self.handle = core.BNCreateDataBuffer(contents, len(contents))
def __init__(self, contents="", handle=None): # python3 no longer has longs try: long except NameError: long = int if handle is not None: self.handle = core.handle_of_type(handle, core.BNDataBuffer) elif isinstance(contents, int) or isinstance(contents, long): self.handle = core.BNCreateDataBuffer(None, contents) elif isinstance(contents, DataBuffer): self.handle = core.BNDuplicateDataBuffer(contents.handle) else: self.handle = core.BNCreateDataBuffer(contents, len(contents))
def __init__(self, arch = None, handle = None, source_func = None): self._arch = arch self._source_function = source_func if handle is not None: self.handle = core.handle_of_type(handle, core.BNHighLevelILFunction) if self._source_function is None: self._source_function = binaryninja.function.Function(handle = core.BNGetHighLevelILOwnerFunction(self.handle)) if self._arch is None: self._arch = self._source_function.arch else: if self._source_function is None: self.handle = None raise ValueError("IL functions must be created with an associated function") if self._arch is None: self._arch = self._source_function.arch func_handle = self._source_function.handle self.handle = core.BNCreateHighLevelILFunction(arch.handle, func_handle)
def __init__(self, sym_type, addr, short_name, full_name=None, raw_name=None, handle=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNSymbol) else: if isinstance(sym_type, str): sym_type = SymbolType[sym_type] if full_name is None: full_name = short_name if raw_name is None: raw_name = full_name self.handle = core.BNCreateSymbol(sym_type, short_name, full_name, raw_name, addr)
def __init__(self, provider, handle=None): if handle is None: self._cb = core.BNWebsocketClientCallbacks() self._cb.context = 0 self._cb.destroyClient = self._cb.destroyClient.__class__( self._destroy_client) self._cb.connect = self._cb.connect.__class__(self._connect) self._cb.write = self._cb.write.__class__(self._write) self._cb.disconnect = self._cb.disconnect.__class__( self._disconnect) self.handle = core.BNInitWebsocketClient(provider.handle, self._cb) self.__class__._registered_clients.append(self) else: self.handle = core.handle_of_type(handle, core.BNWebsocketClient) self._must_free = handle is not None self.on_connected = nop self.on_disconnected = nop self.on_error = nop self.on_data = nop self._connected = False
def __init__(self, provider, handle=None): if handle is None: self._cb = core.BNScriptingInstanceCallbacks() self._cb.context = 0 self._cb.destroyInstance = self._cb.destroyInstance.__class__( self._destroy_instance) self._cb.executeScriptInput = self._cb.executeScriptInput.__class__( self._execute_script_input) self._cb.setCurrentBinaryView = self._cb.setCurrentBinaryView.__class__( self._set_current_binary_view) self._cb.setCurrentFunction = self._cb.setCurrentFunction.__class__( self._set_current_function) self._cb.setCurrentBasicBlock = self._cb.setCurrentBasicBlock.__class__( self._set_current_basic_block) self._cb.setCurrentAddress = self._cb.setCurrentAddress.__class__( self._set_current_address) self._cb.setCurrentSelection = self._cb.setCurrentSelection.__class__( self._set_current_selection) self.handle = core.BNInitScriptingInstance(provider.handle, self._cb) else: self.handle = core.handle_of_type(handle, core.BNScriptingInstance) self.listeners = []
def __init__(self, handle=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNDownloadProvider) self.__dict__["name"] = core.BNGetDownloadProviderName(handle)
def __init__(self, handle=None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNTypeParser) self.__dict__["name"] = core.BNGetTypeParserName(handle)
def __init__(self, view, handle): self.view = view self.handle = core.handle_of_type(handle, core.BNBasicBlock) self._arch = None self._func = None
def __init__(self, handle): self.handle = core.handle_of_type(handle, core.BNTypeLibrary)
def __init__(self, handle): self.handle = core.handle_of_type(handle, core.BNRepository)
def __init__(self, handle): self.handle = core.handle_of_type(handle, core.BNRepoPlugin)
def __init__(self, handle = None): if handle is not None: self.handle = core.handle_of_type(handle, core.BNDownloadProvider) self.__dict__["name"] = core.BNGetDownloadProviderName(handle)
def __init__(self, handle): raise Exception("RepoPlugin temporarily disabled!") self.handle = core.handle_of_type(handle, core.BNRepoPlugin)