summaryrefslogtreecommitdiff
path: root/python/examples
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2019-03-26 11:55:36 -0400
committerBrian Potchik <brian@vector35.com>2019-03-26 11:55:36 -0400
commit8b04c6ec72e8487883e5d71c141969dbf7eca050 (patch)
tree3cf6de820253be98795197e0b83481109973ff4b /python/examples
parent20362165f9fcfce7902c0c058754e4ddbe8b016f (diff)
Add BinaryDataNavigable API to View which enables FeatureMap/UI Plugin navigation.
Diffstat (limited to 'python/examples')
-rw-r--r--python/examples/kaitai/view.py7
-rw-r--r--python/examples/triage/byte.py1
2 files changed, 6 insertions, 2 deletions
diff --git a/python/examples/kaitai/view.py b/python/examples/kaitai/view.py
index 75952b9b..e1039f31 100644
--- a/python/examples/kaitai/view.py
+++ b/python/examples/kaitai/view.py
@@ -101,6 +101,7 @@ class KaitaiView(QScrollArea, View):
QScrollArea.__init__(self, parent)
View.__init__(self)
+ View.setBinaryDataNavigable(self, True)
self.setupView(self)
# BinaryViewType
@@ -234,8 +235,10 @@ class KaitaiView(QScrollArea, View):
return binaryninjaui.getMonospaceFont(self)
def navigate(self, addr):
- #log.log_debug('navigate()')
- return False
+ self.rootSelectionStart = addr
+ self.rootSelectionEnd = addr+1
+ self.hexWidget.setSelectionRange(addr, addr+1)
+ return True
def navigateToFileOffset(self, offset):
#log.log_debug('navigateToFileOffset()')
diff --git a/python/examples/triage/byte.py b/python/examples/triage/byte.py
index f4a5056a..4caf228f 100644
--- a/python/examples/triage/byte.py
+++ b/python/examples/triage/byte.py
@@ -22,6 +22,7 @@ class ByteView(QAbstractScrollArea, View):
def __init__(self, parent, data):
QAbstractScrollArea.__init__(self, parent)
View.__init__(self)
+ View.setBinaryDataNavigable(self, True)
self.setupView(self)
self.data = data
self.byte_mapping = [