From ecd89a5a312c277a5b35fa2dea3bc52f3765e4a6 Mon Sep 17 00:00:00 2001 From: Jelle Vergeer Date: Tue, 9 May 2017 17:04:59 +0200 Subject: [PATCH 1/2] - Option for shift selection in UploadAll dialog --- first_plugin_ida/first.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/first_plugin_ida/first.py b/first_plugin_ida/first.py index 0cc5c48..77477dd 100644 --- a/first_plugin_ida/first.py +++ b/first_plugin_ida/first.py @@ -2669,6 +2669,7 @@ def __init__(self, header, data, parent=None): self.select_all_flag = False self.rows_selected = set() + self.last_selected_row = None def set_row_selected(self, row): '''Causes a row to be selected or deselected. @@ -3113,10 +3114,7 @@ def __init__(self, dialog): def __data(self, thread, data): if ('failed' in data) and data['failed']: - if 'msg' not in data: - return - - msg = '[1st] Error: {}'.format(data['msg']) + msg = '[1st] Error: {}'.format(result['msg']) idaapi.execute_ui_requests((FIRSTUI.Requests.Print(msg),)) return @@ -4109,7 +4107,14 @@ def table_clicked(self, index, table_view, data_model): self.select_all.setChecked(False) self.select_all.stateChanged.connect(self.select_all_callback) - data_model.set_row_selected(index.row()) + modifiers = QtGui.QGuiApplication.keyboardModifiers() + row_nr = index.row() + if modifiers == Qt.ShiftModifier and data_model.last_selected_row is not None: + for x in range(data_model.last_selected_row + 1, row_nr + 1): + data_model.set_row_selected(x) + else: + data_model.set_row_selected(row_nr) + data_model.last_selected_row = row_nr table_view.reset() def get_selected_data(self): From e51b03347bbe559537da704061dcc0b255fc4186 Mon Sep 17 00:00:00 2001 From: Jelle Vergeer Date: Tue, 9 May 2017 21:52:47 +0200 Subject: [PATCH 2/2] - Back selection --- first_plugin_ida/first.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/first_plugin_ida/first.py b/first_plugin_ida/first.py index 77477dd..b2a8f93 100644 --- a/first_plugin_ida/first.py +++ b/first_plugin_ida/first.py @@ -66,6 +66,9 @@ from hashlib import sha256, md5, sha1 from base64 import b64encode, b64decode +from requests.packages.urllib3.exceptions import InsecureRequestWarning +requests.packages.urllib3.disable_warnings(InsecureRequestWarning) + # Constants #------------------------------------------------------------------------------- FIRST_INDEX = { @@ -4110,8 +4113,12 @@ def table_clicked(self, index, table_view, data_model): modifiers = QtGui.QGuiApplication.keyboardModifiers() row_nr = index.row() if modifiers == Qt.ShiftModifier and data_model.last_selected_row is not None: - for x in range(data_model.last_selected_row + 1, row_nr + 1): - data_model.set_row_selected(x) + if row_nr >= data_model.last_selected_row: + for x in xrange(data_model.last_selected_row + 1, row_nr + 1): + data_model.set_row_selected(x) + else: + for x in xrange(row_nr, data_model.last_selected_row): + data_model.set_row_selected(x) else: data_model.set_row_selected(row_nr) data_model.last_selected_row = row_nr