예제 #1
0
파일: database.py 프로젝트: clayne/Classy
    def __init__(self):
        self.data = {}
        self.is_open = False

        idb_path = idaapi.get_path(idaapi.PATH_TYPE_IDB)
        self.path = os.path.splitext(idb_path)[0] + '.cdb'
        self.autosave_path = os.path.splitext(idb_path)[0] + '.autosave.cdb'

        self.autosave_timer = QtCore.QTimer()
        self.autosave_timer.timeout.connect(self.autosave)
예제 #2
0
 def guess_file_path():
     input_file = idaapi.get_input_file_path()
     input_file = ConfigHelpers.string_decode(input_file)
     if not os.path.isfile(input_file):
         # get_input_file_path returns file path from IDB, which may not
         # exist locally if IDB has been moved (eg. send idb+binary to
         # another analyst)
         guessed_path = idaapi.get_path(idaapi.PATH_TYPE_IDB)
         guessed_path = guessed_path.replace('idb', 'exe')
         if os.path.isfile(guessed_path):
             return guessed_path
         guessed_path = guessed_path.replace('.exe', '')
         if os.path.isfile(guessed_path):
             return guessed_path
     return input_file
예제 #3
0
from idaapi import PluginForm

# get PYTHON_PATH settings, based on platform
PYTHON_PATH = rsconfig.get_python_interpreter()
os.environ['PYTHON_PATH'] = PYTHON_PATH

# default value is current script's path
BROKER_PATH = os.path.join(os.path.normpath(os.path.dirname(__file__)),
                           rsconfig.PLUGIN_DIR, 'broker.py')
if not os.path.exists(BROKER_PATH):
    rs_log("[-] broker path is not properly set, current value: <%s>" %
           BROKER_PATH)
    raise RuntimeError

os.environ['IDB_PATH'] = os.path.dirname(
    os.path.realpath(idaapi.get_path(idaapi.PATH_TYPE_IDB)))

COL_CBTRACE = rsconfig.COL_CBTRACE

# --------------------------------------------------------------------------


class RequestHandler(object):

    # color callback
    def cb_color(self, ea):
        idaapi.set_item_color(ea, COL_CBTRACE)

    # instruction step callback
    def cb_curline(self, ea):
        if self.prev_loc:
예제 #4
0
import ida_dbg
import ida_nalt

from idaapi import PluginForm


# get PYTHON_PATH settings, based on platform
PYTHON_PATH = rsconfig.get_python_interpreter()

# default value is current script's path
BROKER_PATH = os.path.join(os.path.normpath(os.path.dirname(__file__)), rsconfig.PLUGIN_DIR, 'broker.py')
if not os.path.exists(BROKER_PATH):
    rs_log("[-] broker path is not properly set, current value: <%s>" % BROKER_PATH)
    raise RuntimeError

IDB_PATH = os.path.dirname(os.path.realpath(idaapi.get_path(idaapi.PATH_TYPE_IDB)))

COL_CBTRACE = rsconfig.COL_CBTRACE


# --------------------------------------------------------------------------


class RequestHandler(object):

    # color callback
    def cb_color(self, ea):
        idaapi.set_item_color(ea, COL_CBTRACE)

    # instruction step callback
    def cb_curline(self, ea):
예제 #5
0
import glob
import os
import itertools
import idaapi
import idc

PLUGINS_LIST = "plugins-{}.list".format(idaapi.get_kernel_version())

USER_PLUGIN_LIST_PATH = os.path.join(idaapi.get_user_idadir(), PLUGINS_LIST)
SYS_PLUGIN_LIST_PATH = os.path.join(idaapi.idadir(idaapi.CFG_SUBDIR),
                                    PLUGINS_LIST)
IDB_PATH = idaapi.get_path(idaapi.PATH_TYPE_IDB)
if IDB_PATH:
    PROJECT_PLUGIN_LIST_PATH = os.path.join(os.path.dirname(IDB_PATH),
                                            PLUGINS_LIST)
else:
    PROJECT_PLUGIN_LIST_PATH = None


def message(*messages):
    for msg in messages:
        for line in msg.splitlines():
            idaapi.msg("[PluginLoader] {}\n".format(line))


def iter_without_duplicates(*iterables):
    visited = set()
    chained_iterables = itertools.chain(*iterables)
    for item in chained_iterables:
        if item in visited:
            continue