Python idaapi.netnode() Examples
The following are 30
code examples of idaapi.netnode().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
idaapi
, or try the search function
.
Example #1
Source File: ida_frontend.py From revsync with MIT License | 6 votes |
def on_open(): global auto_wait global fhash print('revsync: file opened:', idaapi.get_root_filename()) netnode.create(NETNODE_NAME) try: fhash = netnode.getblob(0, 'I').decode('ascii') except: fhash = None if not fhash: fhash = read_fhash() try: ret = netnode.setblob(fhash.encode('ascii'), 0, 'I') except: print('saving fhash failed, this will probably break revsync') if auto_is_ok(): on_load() auto_wait = False else: auto_wait = True print('revsync: waiting for auto analysis') if not hasattr(IDP_Hooks, 'auto_empty_finally'): idaapi.register_timer(1000, wait_for_analysis)
Example #2
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 6 votes |
def repr(cls, nodeidx): res = [] try: l1 = max(len(key or '') for key in cls.fiter(nodeidx)) l2 = max(len("{!r}".format(cls.get(nodeidx, key))) for key in cls.fiter(nodeidx)) except ValueError: l1, l2 = 0, 2 for i, key in enumerate(cls.fiter(nodeidx)): value = "{:<{:d}s} : str={!r}, buffer={!r}, int={:#x}({:d})".format("{!r}".format(cls.get(nodeidx, key)), l2, cls.get(nodeidx, key, str), cls.get(nodeidx, key, buffer), cls.get(nodeidx, key, int), cls.get(nodeidx, key, int)) res.append("[{:d}] {:<{:d}s} -> {:s}".format(i, key, l1, value)) if not res: raise internal.exceptions.MissingTypeOrAttribute(u"{:s}.repr({:#x}) : The specified node ({:x}) does not have any hashvals.".format('.'.join(('internal', __name__, cls.__name__)), nodeidx, nodeidx)) return '\n'.join(res) # FIXME: implement a file-allocation-table based filesystem using the netnode wrappers defined above
Example #3
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get(cls, nodeidx, key, type=None): node = netnode.new(nodeidx) if type is None: return netnode.hashval(node, key or '') elif issubclass(type, basestring): return netnode.hashstr(node, key or '') elif issubclass(type, buffer): return netnode.hashstr_buf(node, key or '') elif issubclass(type, six.integer_types): return netnode.hashval_long(node, key or '') raise internal.exceptions.InvalidTypeOrValueError(u"{:s}.get({:#x}, {!r}, type={!r}) : An unsupported type ({!r}) was requested for the netnode's hash.".format('.'.join(('internal', __name__, cls.__name__)), nodeidx, key, type, type))
Example #4
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set(cls, nodeidx, tag, value, start=0): node = netnode.new(nodeidx) return netnode.setblob(node, value, start, tag)
Example #5
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def remove(cls, nodeidx, tag, start=0): node = netnode.new(nodeidx) return netnode.delblob(node, start, tag)
Example #6
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get(cls, nodeidx, idx): node = netnode.new(nodeidx) return netnode.altval(node, idx)
Example #7
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set(cls, nodeidx, idx, value): node = netnode.new(nodeidx) return netnode.altset(node, idx, value)
Example #8
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def remove(cls, nodeidx, idx): node = netnode.new(nodeidx) return netnode.altdel(node, idx)
Example #9
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def fiter(cls, nodeidx): node = netnode.new(nodeidx) for idx, value in utils.falt(node): yield idx, value return
Example #10
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def riter(cls, nodeidx): node = netnode.new(nodeidx) for idx, value in utils.ralt(node): yield idx, value return
Example #11
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set(cls, nodeidx, idx, value): node = netnode.new(nodeidx) return netnode.supset(node, idx, value)
Example #12
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def remove(cls, nodeidx, idx): node = netnode.new(nodeidx) return netnode.supdel(node, idx)
Example #13
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def fiter(cls, nodeidx): node = netnode.new(nodeidx) for idx, _ in utils.fsup(node): yield idx return
Example #14
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def riter(cls, nodeidx): node = netnode.new(nodeidx) for idx, _ in utils.rsup(node): yield idx return
Example #15
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get(cls, nodeidx, tag, start=0): node = netnode.new(nodeidx) sz = netnode.blobsize(node, start, tag) res = netnode.getblob(node, start, tag) return None if res is None else res[:sz]
Example #16
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def remove(cls, nodeidx, key): node = netnode.new(nodeidx) return netnode.hashdel(node, key)
Example #17
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def fiter(cls, nodeidx): node = netnode.new(nodeidx) for key, _ in utils.fhash(node): yield key return
Example #18
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def riter(cls, nodeidx): node = netnode.new(nodeidx) for key, _ in utils.rhash(node): yield key return
Example #19
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, name): node = idaapi.netnode(name, 0, True)
Example #20
Source File: payload.py From DrGadget with MIT License | 5 votes |
def load_from_idb(self): node = idaapi.netnode(0x41414141) node.create(self.nodename) result = node.getblob(0, "D") if result: self.items = pickle.loads(result) return result
Example #21
Source File: payload.py From DrGadget with MIT License | 5 votes |
def save_to_idb(self): node = idaapi.netnode(0x41414141) node.create(self.nodename) node.setblob(pickle.dumps(self.items), 0, "D")
Example #22
Source File: jayutils.py From flare-ida with Apache License 2.0 | 5 votes |
def _addHexLogging(logger): logger.doHexLog = types.MethodType(doHexLog, logger) logger.debugHex = types.MethodType(debugHex, logger) logger.infoHex = types.MethodType(infoHex, logger) logger.warningHex = types.MethodType(warningHex, logger) logger.errorHex = types.MethodType(errorHex, logger) return logger ###################################################################### # IDB persistent storage wrappers ###################################################################### #my own personal netnode name
Example #23
Source File: jayutils.py From flare-ida with Apache License 2.0 | 5 votes |
def queryIdbNetnode(key): n = idaapi.netnode(NETNODE_NAME, len(NETNODE_NAME), True) return n.hashval(key)
Example #24
Source File: jayutils.py From flare-ida with Apache License 2.0 | 5 votes |
def setIdbNetnode(key, value): n = idaapi.netnode(NETNODE_NAME, len(NETNODE_NAME), True) return n.hashset(key, value) ###################################################################### # visgraph traversal helpers ###################################################################### #orange TODO: path funtions aren't checking for duplicating traversal # since doing there's no path node ID, and doing a straight node-cmp # is too much
Example #25
Source File: _netnode.py From ida-minsc with BSD 3-Clause "New" or "Revised" License | 5 votes |
def rsup(cls, node): for res in cls.valriter(node, netnode.supfirst, netnode.supprev, netnode.supnext, netnode.supval): yield res return
Example #26
Source File: netnode.py From ida-netnode with Apache License 2.0 | 5 votes |
def __init__(self, netnode_name=OUR_NETNODE): self._netnode_name = netnode_name # self._n = idaapi.netnode(netnode_name, namelen=0, do_create=True) self._n = idaapi.netnode(netnode_name, 0, True)
Example #27
Source File: netnode.py From ida-netnode with Apache License 2.0 | 5 votes |
def kill(self): self._n.kill() self._n = idaapi.netnode(self._netnode_name, 0, True)
Example #28
Source File: ida_painter.py From lighthouse with MIT License | 5 votes |
def _paint_instructions(self, instructions): """ Paint instruction level coverage defined by the current database mapping. NOTE: we now use 'streaming' mode for instructions rather than this. """ color = struct.pack("I", self.palette.coverage_paint+1) for address in instructions: set_abits(address, 0x40000) nn = netnode(address) nn.supset(20, color, 'A') self._painted_instructions |= set(instructions) self._action_complete.set()
Example #29
Source File: ida_frontend.py From revsync with MIT License | 5 votes |
def cached_fhash(): return netnode.getblob(0, 'I').decode('ascii')
Example #30
Source File: ida_frontend.py From revsync with MIT License | 5 votes |
def publish(data, **kwargs): if not auto_is_ok(): return if fhash == netnode.getblob(0, 'I').decode('ascii'): client.publish(fhash, data, **kwargs) ### IDA Hook Classes ###