コード例 #1
0
ファイル: ida_script.py プロジェクト: sploitamos/pwndbg
import idaapi
import idautils
import idc

# Wait for any processing to get done
idaapi.autoWait()

# On Windows with NTFS filesystem a filepath with ':'
# is treated as NTFS ADS (Alternative Data Stream)
# and so saving file with such name fails
dt = datetime.datetime.now().isoformat().replace(':', '-')

# Save the database so nothing gets lost.
if idaapi.IDA_SDK_VERSION >= 700:
    idaapi.save_database(idc.GetIdbPath() + '.' + dt)
else:
    idc.SaveBase(idc.GetIdbPath() + '.' + dt)

DEBUG_MARSHALLING = False


def create_marshaller(use_format=None, just_to_str=False):
    assert use_format or just_to_str, 'Either pass format to use or make it converting the value to str.'

    def wrapper(_marshaller, value, appender):
        if use_format:
            marshalled = use_format % value
        elif just_to_str:
            marshalled = '<value><string>%s</string></value>' % escape(
                str(value))
コード例 #2
0
ファイル: ida_script.py プロジェクト: int-0x03/pwngef
#!/usr/bin/python
from __future__ import print_function

from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import threading

import idautils
import idc
import idaapi

# Save the database so nothing gets lost.
if idaapi.IDA_SDK_VERSION >= 700:
    idaapi.save_database(idc.GetIdbPath())
else:
    idc.SaveBase(idc.GetIdbPath())

HOST, PORT = "0.0.0.0", 1337
DEBUG = True

# class Gef:
#     """
#     Top level class where exposed methods are declared.
#     """

#     def __init__(self, server, *args, **kwargs):
#         self.server = server
#         self._version = ("IDA Pro", str(idaapi.IDA_SDK_VERSION))
#         return

#     def _dispatch(self, method, params):
#         """
コード例 #3
0
ファイル: ida_noita.py プロジェクト: noita-player/noitadocs
            obj.docstr = docstr_needed[obj.name]

    # remove the defaultness to allow ez serialization
    return dict(result)


LOG.info("Noita IDAPython init")
idaapi.auto_wait()
LOG.info("analysis finished")
idb_path = idautils.GetIdbDir() + "noita_auto.idb"
LOG.info("saving IDB to {}".format(idb_path))
#idaapi.save_database(idb_path)

all_strings = idautils.Strings()

# do something useful?
lua_natives = get_all_registered_lua_natives()

# person who started IDA defined where the log file is, so they can parse this out of it.
# import ast; natives_fromlogs = ast.literal_eval(x.split("|lol|")[1])
# ...py3, need to re.sub(r"(\d+)L,", "\\1,", x)
natives_fordisk = []
for caller, natives in lua_natives.iteritems():
    natives_fordisk.extend([o.to_dict() for o in natives])

LOG.info("|lol|{}|lol|".format(str(natives_fordisk)))

idaapi.save_database(idb_path)
if headless:
    idaapi.quit(0)
コード例 #4
0
ファイル: ida_script.py プロジェクト: cebrusfs/217gdb
import idaapi
import idautils
import idc

# Wait for any processing to get done
idaapi.autoWait()

# On Windows with NTFS filesystem a filepath with ':'
# is treated as NTFS ADS (Alternative Data Stream)
# and so saving file with such name fails
dt = datetime.datetime.now().isoformat().replace(':', '-')

# Save the database so nothing gets lost.
if idaapi.IDA_SDK_VERSION >= 700:
    idaapi.save_database(idc.GetIdbPath() + '.' + dt)
else:
    idc.SaveBase(idc.GetIdbPath() + '.' + dt)


DEBUG_MARSHALLING = False

def create_marshaller(use_format=None, just_to_str=False):
    assert use_format or just_to_str, 'Either pass format to use or make it converting the value to str.'

    def wrapper(_marshaller, value, appender):
        if use_format:
            marshalled = use_format % value
        elif just_to_str:
            marshalled = '<value><string>%s</string></value>' % escape(str(value))