-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathautoruns.py
62 lines (43 loc) · 1.24 KB
/
autoruns.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
import tempfile
import subprocess
import os
import idaapi
from ida_settings import IDASettings
EDITOR = r'C:\Windows\System32\notepad.exe'
class Autoruns(idaapi.plugin_t):
flags = idaapi.PLUGIN_PROC
comment = 'Autoruns'
help = 'Autoruns'
wanted_name = 'Autoruns'
wanted_hotkey = ''
def _edit(self):
path = tempfile.mktemp()
with open(path, 'wb') as f:
f.write(self._code)
subprocess.Popen([EDITOR, path]).wait()
with open(path, 'rb') as f:
self._code = f.read()
os.unlink(path)
exec(self._code)
@property
def _code(self):
try:
return self.settings['code']
except:
return ''
@_code.setter
def _code(self, value):
self.settings.idb['code'] = value
def init(self):
self.settings = IDASettings('Autoruns')
exec(self._code)
self.menu_items = []
idaapi.add_menu_item('View/', 'Edit Autoruns', '', idaapi.SETMENU_INS, self._edit, tuple())
return idaapi.PLUGIN_KEEP
def term(self):
for menu_items in self.menu_items:
idaapi.del_menu_item(menu_items)
def run(self, arg):
pass
def PLUGIN_ENTRY():
return Autoruns()