diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2018-05-29 14:32:08 -0400 |
|---|---|---|
| committer | Ryan Snyder <ryan@vector35.com> | 2018-07-10 18:11:08 -0400 |
| commit | 1c03ac08aa94f5bedf21ec8f48ee1ec998e0e50c (patch) | |
| tree | 0c10026079b3f0a50affb6b5d42cc3684056e5fc /python/interaction.py | |
| parent | d4d1fbb390c9a31045cea8e612c02e242d11c438 (diff) | |
addition 3 compatibility changes
Diffstat (limited to 'python/interaction.py')
| -rw-r--r-- | python/interaction.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/python/interaction.py b/python/interaction.py index da6f792a..5b78b278 100644 --- a/python/interaction.py +++ b/python/interaction.py @@ -25,6 +25,9 @@ import traceback from binaryninja import _binaryninjacore as core from binaryninja.enums import FormInputFieldType, MessageBoxIcon, MessageBoxButtonSet, MessageBoxButtonResult +# 2-3 compatibility +from six.moves import range + class LabelField(object): """ @@ -160,7 +163,7 @@ class ChoiceField(object): value.type = FormInputFieldType.ChoiceFormField value.prompt = self.prompt choice_buf = (ctypes.c_char_p * len(self.choices))() - for i in xrange(0, len(self.choices)): + for i in range(0, len(self.choices)): choice_buf[i] = str(self.choices[i]) value.choices = choice_buf value.count = len(self.choices) @@ -330,7 +333,7 @@ class InteractionHandler(object): def _get_choice_input(self, ctxt, result, prompt, title, choice_buf, count): try: choices = [] - for i in xrange(0, count): + for i in range(0, count): choices.append(choice_buf[i]) value = self.get_choice_input(prompt, title, choices) if value is None: @@ -373,7 +376,7 @@ class InteractionHandler(object): def _get_form_input(self, ctxt, fields, count, title): try: field_objs = [] - for i in xrange(0, count): + for i in range(0, count): if fields[i].type == FormInputFieldType.LabelFormField: field_objs.append(LabelField(fields[i].prompt)) elif fields[i].type == FormInputFieldType.SeparatorFormField: @@ -391,7 +394,7 @@ class InteractionHandler(object): field_objs.append(AddressField(fields[i].prompt, view, fields[i].currentAddress)) elif fields[i].type == FormInputFieldType.ChoiceFormField: choices = [] - for j in xrange(0, fields[i].count): + for j in range(0, fields[i].count): choices.append(fields[i].choices[j]) field_objs.append(ChoiceField(fields[i].prompt, choices)) elif fields[i].type == FormInputFieldType.OpenFileNameFormField: @@ -404,7 +407,7 @@ class InteractionHandler(object): field_objs.append(LabelField(fields[i].prompt)) if not self.get_form_input(field_objs, title): return False - for i in xrange(0, count): + for i in range(0, count): field_objs[i]._fill_core_result(fields[i]) return True except: @@ -613,7 +616,7 @@ def get_choice_input(prompt, title, choices): 0L """ choice_buf = (ctypes.c_char_p * len(choices))() - for i in xrange(0, len(choices)): + for i in range(0, len(choices)): choice_buf[i] = str(choices[i]) value = ctypes.c_ulonglong() if not core.BNGetChoiceInput(value, prompt, title, choice_buf, len(choices)): @@ -728,7 +731,7 @@ def get_form_input(fields, title): Peter 1337 0 """ value = (core.BNFormInputField * len(fields))() - for i in xrange(0, len(fields)): + for i in range(0, len(fields)): if isinstance(fields[i], str): LabelField(fields[i])._fill_core_struct(value[i]) elif fields[i] is None: @@ -737,7 +740,7 @@ def get_form_input(fields, title): fields[i]._fill_core_struct(value[i]) if not core.BNGetFormInput(value, len(fields), title): return False - for i in xrange(0, len(fields)): + for i in range(0, len(fields)): if not (isinstance(fields[i], str) or (fields[i] is None)): fields[i]._get_result(value[i]) core.BNFreeFormInputResults(value, len(fields)) |
