Code Monkey home page Code Monkey logo

idametrics's Introduction

IDAMetrics-static.py

This repo forked from https://github.com/mxmssh/IDAmetrics, go to check the original README for more information.

What I did is porting IDAMetrics_static.py from IDA 5.5.0 (32 bit) to IDA 7.5.200519 (32 bit).

Bug fix

GetInstructionType function was erroneous, inaccuracy and hard to extend to x86_64.

The erroneous result of GetInstructionType

The implementation of GetInstructionType function was based on string matching which is erroneous and inaccuracy, e.g. the leave instruction would be counted as ASSIGNMENT_INSTRUCTION just because the startswith("lea") of leave is apparently True:

for assign_instr_mnem in assign_instructions_general:
        if instr_mnem.startswith(assign_instr_mnem):
            return inType.ASSIGNMENT_INSTRUCTION

The root cause of inaccuracy of GetInstructionType

Also, because the string matching need someone manually build a list. There may be omissions from the list. For example, setnz should be included in assign_instructions_general.

assign_instructions_general = [
    "mov", "cmov", "xchg", "bswap", "xadd", "ad", "sub", "sbb", "imul", "mul",
    "idiv", "div", "inc", "dec", "neg", "da", "aa", "and", "or", "xor", "not",
    "sar", "shr", "sal", "shl", "shrd", "shld", "ror", "rol", "rcr", "rcl",
    "lod", "sto", "lea"
]

How to fix

This kind of information should has been gained by IDA during the analyzing. Using APIs in module ida_idp should solve some problems.

idametrics's People

Contributors

mxmssh avatar terrynini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.