From 54992bb376598951cb7f317ae25a1cad10d7c71b Mon Sep 17 00:00:00 2001 From: Tamas K Lengyel Date: Tue, 17 Nov 2020 10:24:57 -0500 Subject: [PATCH] Add copy-pastable python example --- pybddisasm/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pybddisasm/README.md b/pybddisasm/README.md index 04c532f..7645dba 100644 --- a/pybddisasm/README.md +++ b/pybddisasm/README.md @@ -19,6 +19,26 @@ from pybddisasm.bddisasm import * instr = nd_decode_ex2(buff, arch, arch, arch, vendor, current_rip) ``` +## Example + +```python +from pybddisasm.bddisasm import * +from sys import * + +buff = b"\x55\x48\x8b\x05\xb8\x13\x00\x00" +offset = 0 + +while offset < getsizeof(buff): + instr = nd_decode_ex2(buff[offset:], 64, 64, 64) + + if instr is None: + break + + print(instr.Text) + + offset += instr.Length +``` + ## Pip Use pip to install the package: