-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path__init__.py
More file actions
32 lines (21 loc) · 889 Bytes
/
__init__.py
File metadata and controls
32 lines (21 loc) · 889 Bytes
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
#!/usr/bin/env python3
import pathlib
from .architecture import Smali
from .binaryview import Dex
Smali.register()
Dex.register()
from binaryninjaui import UIContextNotification, UIContext # type: ignore
from binaryninja.architecture import Architecture # type: ignore
class UINotification(UIContextNotification):
def __init__(self):
UIContextNotification.__init__(self)
UIContext.registerNotification(self)
def __del__(self):
UIContext.unregisterNotification(self)
def OnBeforeOpenFile(self, context, file):
Architecture["Smali"].frame = pathlib.Path(file.getFilename()).resolve().as_posix()
return True
def OnViewChange(self, context, frame, type):
if frame:
Architecture["Smali"].frame = pathlib.Path(context.getCurrentView().getData().file.filename).resolve().as_posix()
notif = UINotification()