-
Notifications
You must be signed in to change notification settings - Fork 13
/
__init__.py
77 lines (60 loc) · 2.09 KB
/
__init__.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
from functools import partial
from binaryninja import PluginCommand, BackgroundTaskThread
from binaryninjaui import ViewType
from .cfstring import define_cfstrings_plugin
from .classes import define_classes_plugin
from .methods import define_methods
from .objcgraph import ObjcFlowGraphViewType
from .objcview import ObjcView
from .selectors import define_selectors_plugin
from .types import define_types_plugin
# ObjcView.register()
PluginCommand.register(
'Objc\\Define selectors',
'Define selector strings in Objective-C sections',
define_selectors_plugin,
is_valid=lambda v: '__objc_classname' in v.sections or '__objc_selrefs' in v.sections
)
PluginCommand.register(
'Objc\\Define CFStrings',
'Define CFStrings in Objective-C sections',
define_cfstrings_plugin,
is_valid=lambda v: '__cfstring' in v.sections
)
PluginCommand.register(
'Objc\\Define types',
'Define Objective-C types',
define_types_plugin,
is_valid=lambda v: '__objc_classrefs' in v.sections
)
PluginCommand.register(
'Objc\\Define classes',
'Define Objective-C classes',
define_classes_plugin,
is_valid=lambda v: '__objc_data' in v.sections
)
class ObjectiveCTaskThread(BackgroundTaskThread):
def __init__(self, view):
super().__init__('Defining Objective-C Structures...')
self.view = view
def run(self):
define_types_plugin(self.view)
self.progress = 'Defining Objective-C selectors...'
define_selectors_plugin(self.view)
self.progress = 'Defining CFStrings...'
define_cfstrings_plugin(self.view)
self.progress = 'Defining Objective-C classes...'
define_classes_plugin(self.view)
self.progress = 'Defining Objective-C methods...'
define_methods(self.view)
def _run_all_plugins(view):
if view.session_data.get('ClassList'):
return
ObjectiveCTaskThread(view).start()
PluginCommand.register(
"Objc\\Run all",
"Run all Objective-C plugins",
_run_all_plugins,
is_valid=lambda v: '__objc_data' in v.sections
)
ViewType.registerViewType(ObjcFlowGraphViewType())