This repository has been archived by the owner on Jun 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdrgadget.py
90 lines (66 loc) · 1.93 KB
/
drgadget.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""
known bugs:
- the dr.rer.oec.gadget GUI needs an overhaul. if you
are experiencing any issues, try closing the window
and reopen it using the plugin hotkey
todo:
- finish/improve disasm "engine"?
- support stack directions?
- add xrefs to "items" class?
- add proper handling/support for plugin hotkeys
"""
pluginname = "Dr.Gadget"
__author__ = "patois"
__version__ = "0.59b"
import struct, os, sys
from idaapi import *
from idc import *
sys.path.append(idadir(os.path.join("plugins", "drgadget")))
import ropviewer
import payload
pluginname = pluginname + " " + __version__
# -----------------------------------------------------------------------
class idp_hook(idaapi.IDP_Hooks):
def __init__(self):
idaapi.IDP_Hooks.__init__(self)
def savebase(self, *args):
if pl:
print "\n%s: saving...\n" % pluginname
pl.save_to_idb()
return _idaapi.IDP_Hooks_savebase(self, *args)
pl = None
rv = None
class drgadget(idaapi.plugin_t):
flags = 0
comment = ""
help = ""
wanted_name = pluginname
wanted_hotkey = "Alt-F5"
def init(self):
global rv
self.hook = idp_hook()
self.hook.hook()
print "%s: plugin initialized." % pluginname
rv = None
return idaapi.PLUGIN_KEEP
def run(self, arg):
global pl
global rv
if not pl:
pl = payload.Payload()
if pl.load_from_idb():
print "%s: loaded data from IDB." % pluginname
if not rv:
rv = ropviewer.ropviewer_t(pl)
if not rv.Create ():
print "could not create window."
return
rv.Show()
rv.show_content_viewers()
def term(self):
if self.hook:
self.hook.unhook()
pass
# -----------------------------------------------------------------------
def PLUGIN_ENTRY():
return drgadget()