diff --git a/keypatch.py b/keypatch.py index 8b4c29b..abba11e 100644 --- a/keypatch.py +++ b/keypatch.py @@ -119,7 +119,6 @@ font_mono = QFont('Courier New') font_mono.setStyleHint(QFont.TypeWriter) - # ------------------------------------------------------------------------------ # utilities # ------------------------------------------------------------------------------ @@ -132,7 +131,6 @@ def bv_to_arch(bview): return bview.arch.name - # test if given address is valid binaryview address def is_valid_addr(bview, addr): # if the binaryview has sections, validity is whether the address is in a section @@ -148,7 +146,6 @@ def is_valid_addr(bview, addr): else: return addr >= bview.start and addr < (bview.start + len(bview)) - # given a valid address, return least address after the valid that is invalid def get_invalid_addr(bview, addr): if not is_valid_addr(bview, addr): @@ -166,7 +163,6 @@ def get_invalid_addr(bview, addr): else: return bview.start + len(bv) - # disassemble using binaryninja # returns (, ) def disassemble_binja_single(bview, addr): @@ -185,7 +181,6 @@ def disassemble_binja_single(bview, addr): strs = [' ' if s.isspace() else s for s in strs] return (''.join(strs), length) - # disassemble using capstone # returns (, ) # returns (None, None) if unable to disassemble @@ -206,7 +201,6 @@ def disassemble_capstone_single(bview, addr): # fixed bug , is 'size',not 'length' return (mnemonic + ' ' + op_str, size) - # disassemble data using capstone # returns (, ) # returns (None, None) if unable to disassemble @@ -221,27 +215,22 @@ def disassemble_capstone_single_data(bview, data, addr): return (None, None) return (mnemonic + ' ' + op_str, size) - # get length of instruction at addr # returns None if unable to disassemble def disassemble_length(bview, addr): (instxt, length) = disassemble_binja_single(bview, addr) return length - def error(msg): show_message_box('KEYPATCH', msg, MessageBoxButtonSet.OKButtonSet, MessageBoxIcon.ErrorIcon) - # b'\xaa\xbb\xcc\xdd' -> 'AA BB CC DD' def bytes_to_str(data): return ' '.join(['%02X' % x for x in data]) - def strbytes_pretty(string): return ' '.join(['%02X' % ord(x) for x in string]) - def fixup(bview, assembly): reserved = arch_to_reserved[bv_to_arch(bview)] @@ -283,7 +272,6 @@ def fixup(bview, assembly): # done return assembly - # arch is keystone namespace def get_nop(arch): if arch in ['x16', 'x32', 'x64', 'x16att', 'x32att', 'x64att', 'x16nasm', 'x32nasm', 'x64nasm']: @@ -313,7 +301,6 @@ def get_nop(arch): raise Exception('no NOP for architecture: %s' % arch) - # ------------------------------------------------------------------------------ # GUI # ------------------------------------------------------------------------------ @@ -479,7 +466,6 @@ def re_assemble(self): except Exception as e: self.error(str(e)) - # Add a new function # update the self.qle_data.text() and self.qle_fixedup.text() through self.edit_bytes.text() def re_disassemble(self): try: @@ -537,7 +523,6 @@ def error(self, msg): self.qle_data.setText(msg) self.qle_data.home(True) - # ------------------------------------------------------------------------------ # fill range tool # ------------------------------------------------------------------------------ @@ -671,7 +656,6 @@ def interval(self): return errval return (a, b, b - a) - # Add a new function # get the left, right, and length(size) of the entered fill interval # calculate right through left and length(size) def interval_by_size_change(self): @@ -771,7 +755,6 @@ def preview(self): self.qle_preview.home(True) - # Add a new function def preview_by_size_change(self): (st, ed, fill_len) = self.interval_by_size_change() if not fill_len: return None @@ -816,7 +799,6 @@ def fill(self): # print('writing 0x%X bytes to 0x%X' % (len(data), left)) self.bv.write(left, data) - # ------------------------------------------------------------------------------ # search tool # ------------------------------------------------------------------------------ @@ -929,7 +911,6 @@ def results_clicked(self, item): addr = int(m.group(1), 16) self.bv.navigate(self.bv.view, addr) - # ------------------------------------------------------------------------------ # top level tab gui # ------------------------------------------------------------------------------ @@ -961,7 +942,6 @@ def __init__(self, context, parent=None): self.tab1.setFocus() self.tab1.qle_assembly.setFocus() - # ------------------------------------------------------------------------------ # exported functions # ------------------------------------------------------------------------------ diff --git a/plugin.json b/plugin.json index d915b6e..b6de9e8 100644 --- a/plugin.json +++ b/plugin.json @@ -31,6 +31,6 @@ "capstone" ] }, - "version": "1.4", + "version": "1.5", "minimumbinaryninjaversion": 2660 }