Skip to content

Commit 98a5094

Browse files
committed
initial advanced binary search documentation
1 parent aa4ad79 commit 98a5094

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/guide/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ The normal find dialog also exists as a sidebar panel that allows persistent, ta
410410

411411
The search types are available from a drop-down next to the text input field and include:
412412

413+
- Advanced Binary Search: A new search type using the [bv.search](https://dev-api.binary.ninja/binaryninja.binaryview-module.html#binaryninja.binaryview.BinaryView.search) syntax (supporting regular expressions and wildcard hex strings)
413414
- Escaped: Escaped strings such as `OneString\x09\Tabsx09Another`
414415
- Hex: All values much be valid hex characters such as `ebfffc390` and the bytes will only be searched for in this particular order
415416
- Raw: A simple string search that matches the exact string as specified

docs/img/find.png

24.9 KB
Loading

python/binaryview.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8700,6 +8700,15 @@ def search(self, pattern: str, start: int = None, end: int = None, raw: bool = F
87008700
87018701
:return: A generator object that yields the offset and matched DataBuffer for each match found.
87028702
:rtype: QueueGenerator
8703+
:Example:
8704+
>>> from binaryninja import load
8705+
>>> bv = load('/bin/ls')
8706+
>>> print(bv)
8707+
<BinaryView: '/bin/ls', start 0x100000000, len 0x182f8>
8708+
>>> bytes(list(bv.search("50 ?4"))[0][1]).hex()
8709+
'5004'
8710+
>>> bytes(list(bv.search("[\\x20-\\x25][\\x60-\\x67]"))[0][1]).hex()
8711+
'2062'
87038712
"""
87048713
if start is None:
87058714
start = self.start

0 commit comments

Comments
 (0)