Beispiel #1
0
    def get_instruction(i):
        rret = trace.db.fetch_changes_by_clnum(i, 1)
        if len(rret) == 0:
            return None
        else:
            rret = rret[0]

        instr = program.static[rret['address']]['instruction']
        rret['instruction'] = instr.__str__(trace, i)  #i == clnum

        # check if static fails at this
        if rret['instruction'] == "":
            # TODO: wrong place to get the arch
            arch = program.static[rret['address']]['arch']

            # we have the address and raw bytes, disassemble
            raw = trace.fetch_raw_memory(i, rret['address'], rret['data'])
            rret['instruction'] = str(
                model.Instruction(raw, rret['address'], arch))

        #display_call_args calls make_function_at
        if qira_config.WITH_STATIC:
            if instr.is_call():
                args = qira_analysis.display_call_args(instr, trace, i)
                if args != "":
                    rret['instruction'] += " {" + args + "}"

        if 'name' in program.static[rret['address']]:
            #print "setting name"
            rret['name'] = program.static[rret['address']]['name']
        if 'comment' in program.static[rret['address']]:
            rret['comment'] = program.static[rret['address']]['comment']

        if i in slce:
            rret['slice'] = True
        else:
            rret['slice'] = False
        # for numberless javascript
        rret['address'] = ghex(rret['address'])
        try:
            rret['depth'] = trace.dmap[i - trace.minclnum]
        except:
            rret['depth'] = 0

        # hack to only display calls
        if True or instr.is_call():
            #if instr.is_call():
            return rret
        else:
            return None
Beispiel #2
0
  def get_instruction(i):
    rret = trace.db.fetch_changes_by_clnum(i, 1)
    if len(rret) == 0:
      return None
    else:
      rret = rret[0]

    instr = program.static[rret['address']]['instruction']
    rret['instruction'] = str(instr)

    # check if static fails at this
    if rret['instruction'] == "":
      # TODO: wrong place to get the arch
      arch = program.static[rret['address']]['arch']

      # we have the address and raw bytes, disassemble
      raw = trace.fetch_raw_memory(i, rret['address'], rret['data'])
      rret['instruction'] = str(model.Instruction(raw, rret['address'], arch))

    #display_call_args calls make_function_at
    if qira_config.WITH_STATIC:
      if instr.is_call():
        args = qira_analysis.display_call_args(instr,trace,i)
        if args != "":
          rret['instruction'] += " {"+args+"}"

    if 'name' in program.static[rret['address']]:
      #print "setting name"
      rret['name'] = program.static[rret['address']]['name']
    if 'comment' in program.static[rret['address']]:
      rret['comment'] = program.static[rret['address']]['comment']

    if i in slce:
      rret['slice'] = True
    else:
      rret['slice'] = False
    # for numberless javascript
    rret['address'] = ghex(rret['address'])
    try:
      rret['depth'] = trace.dmap[i - trace.minclnum]
    except:
      rret['depth'] = 0

    # hack to only display calls
    if True or instr.is_call():
    #if instr.is_call():
      return rret
    else:
      return None