summaryrefslogtreecommitdiff
path: root/python/examples
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples')
-rwxr-xr-xpython/examples/export_svg.py10
-rw-r--r--python/examples/triage/byte.py6
2 files changed, 2 insertions, 14 deletions
diff --git a/python/examples/export_svg.py b/python/examples/export_svg.py
index 8166b27a..62fc1045 100755
--- a/python/examples/export_svg.py
+++ b/python/examples/export_svg.py
@@ -25,10 +25,7 @@ def escape(toescape):
# handle extended unicode
toescape = toescape.encode('ascii', 'xmlcharrefreplace')
# still escape the basics
- if sys.version_info[0] == 3:
- return ''.join(escape_table.get(chr(i), chr(i)) for i in toescape)
- else:
- return ''.join(escape_table.get(i, i) for i in toescape)
+ return ''.join(escape_table.get(chr(i), chr(i)) for i in toescape)
def save_svg(bv, function):
@@ -91,10 +88,7 @@ def instruction_data_flow(function, address):
# TODO: Extract data flow information
length = function.view.get_instruction_length(address)
func_bytes = function.view.read(address, length)
- if sys.version_info[0] == 3:
- hex = func_bytes.hex()
- else:
- hex = func_bytes.encode('hex')
+ hex = func_bytes.hex()
padded = ' '.join([hex[i:i + 2] for i in range(0, len(hex), 2)])
return 'Opcode: {bytes}'.format(bytes=padded)
diff --git a/python/examples/triage/byte.py b/python/examples/triage/byte.py
index 0cc00485..13e5d153 100644
--- a/python/examples/triage/byte.py
+++ b/python/examples/triage/byte.py
@@ -47,12 +47,6 @@ class ByteView(QAbstractScrollArea, View):
u'≡', u'±', u'≥', u'≤', u'⌠', u'⌡', u'÷', u'≈', u'°', u'∙', u'·', u'√', u'ⁿ', u'²', u'■', u' '
]
- if sys.version_info.major == 2:
- mapping = {}
- for i in range(0, 256):
- mapping[chr(i)] = self.byte_mapping[i]
- self.byte_mapping = mapping
-
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.setFocusPolicy(Qt.StrongFocus)