How to use the vivisect.const.REF_CODE function in vivisect

To help you get started, we’ve selected a few vivisect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github williballenthin / viv-utils / viv_utils / __init__.py View on Github external
def get_all_xrefs_to(vw, va):
    '''
    get all xrefs, including fallthrough instructions, to this address.

    vivisect doesn't consider fallthroughs as xrefs.
    see: https://github.com/fireeye/flare-ida/blob/7207a46c18a81ad801720ce0595a151b777ef5d8/python/flare/jayutils.py#L311
    '''
    for xref in vw.getXrefsTo(va):
        yield xref

    op = get_prev_opcode(vw, va)

    for tova, bflags in op.getBranches():
        if tova == va:
            yield (op.va, va, vivisect.const.REF_CODE, bflags)
github fireeye / flare-ida / python / flare / jayutils.py View on Github external
init = vw.getXrefsTo(va)[:]
    prev = vw.getPrevLocation(va)
    if prev is None:
        return init
    lva, lsize, ltype, linfo = prev
    if ltype != vivisect.const.LOC_OP:
        return init
    try:
        op = vw.parseOpcode(lva)
    except Exception:
        print ('Weird error while doing getAllXrefsTo: %s' % str(err))
        return init
    brlist = op.getBranches()
    for tova,bflags in brlist:
        if tova == va:
            init.append( (lva, tova, vivisect.const.REF_CODE, bflags) )
    return init