diff --git a/data/ui/fuzzing.ui b/data/ui/fuzzing.ui
index cae0356bf2..fc2dfc0926 100644
--- a/data/ui/fuzzing.ui
+++ b/data/ui/fuzzing.ui
@@ -6,56 +6,14 @@
0
0
- 825
- 666
+ 523
+ 632
Fuzzing
- -
-
-
-
- 0
- 0
-
-
-
- Fuzzing Label Start Index:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 1
-
-
- 999999999
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Fuzzing Label:
-
-
-
-
@@ -69,63 +27,252 @@
- -
-
-
-
- 0
- 0
-
-
-
- Source Message:
-
+
-
+
+
-
+
+ Add Range of Values
+
+
+ -
+
+ Add Boundaries
+
+
+ -
+
+ Add Random Values from Range
+
+
+ -
+
+ Add De Bruijn Sequence
+
+
- -
-
-
-
- 0
- 0
-
-
+
-
+
- Message to fuzz:
+ Add to Fuzzed Values
- -
-
+
-
+
-
+
0
0
-
- Fuzzing Label End Index:
+
+ 0
+
+
+
+ 6
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Start (Decimal):
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ End (Decimal):
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Step (Decimal):
+
+
+
+
+
+
+
+
+ 6
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Lower Bound
+
+
+ true
+
+
+
+ -
+
+
+ Upper Bound
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Values per Boundary:
+
+
+
+
+
+
+
+
+ 6
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Range Minimum:
+
+
+
+ -
+
+
+ Range Maximum:
+
+
+
+ -
+
+
+ Number Values:
+
+
+
+
+
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- true
-
-
+
-
+
+
-
+
+
+ 1111
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ 1010
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 010101
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
-
@@ -247,257 +394,184 @@
- -
-
-
- QLayout::SetDefaultConstraint
+
-
+
+
+ 0
-
-
-
-
-
- 0
- 0
-
+
+
+
+ 6
-
- Add Range
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Start (Decimal):
-
-
-
- -
-
-
- -
-
-
- End (Decimal):
-
-
-
- -
-
-
- -
-
-
- Step (Decimal):
-
-
-
- -
-
-
- 1
-
-
-
- -
-
-
- Add to Fuzzed Values
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
+
+ 0
-
- Add Boundaries
-
-
-
-
-
-
- Lower Bound
-
-
- true
-
-
-
- -
-
-
- -
-
-
- Upper Bound
-
-
- true
-
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Border Values:
-
-
-
- -
-
-
- 1
-
-
-
- -
-
-
- Add to Fuzzed Values
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
+
+ 0
-
- Add random values from range
-
-
-
-
-
-
- Number:
-
-
-
- -
-
-
- 1
-
-
- 999999999
-
-
-
- -
-
-
- Range Minimum:
-
-
-
- -
-
-
- -
-
-
- Range Maximum:
-
-
-
- -
-
-
- -
-
-
- Add to Fuzzed Values
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- 1111
+
+ 0
-
-
- -
-
-
-
- 0
- 0
-
+
+ 0
-
-
- 75
- true
-
+
-
+
+
+ -
+
+
+ -
+
+
+ 1
+
+
+
+
+
+
+
+
+ 6
-
- 1010
+
+ 0
-
- Qt::AlignCenter
+
+ 0
-
-
- -
-
-
- 010101
+
+ 0
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+ 0
-
-
- -
-
-
- Qt::Horizontal
+
-
+
+
+ -
+
+
+ 13
+
+
+
+ -
+
+
+ 1
+
+
+
+
+
+
+
+
+ 6
-
-
- 40
- 20
-
+
+ 0
-
-
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ -
+
+
+ 42
+
+
+
+ -
+
+
+ 1
+
+
+ 999999999
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Source Message:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Message to fuzz:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Fuzzing Label End Index:
+
+
+
+ -
+
+
+ Strategy:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ true
+
+
-
@@ -515,6 +589,48 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 1
+
+
+ 999999999
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Fuzzing Label Start Index:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Fuzzing Label:
+
+
+
@@ -525,5 +641,38 @@
-
+
+
+ comboBoxStrategy
+ currentIndexChanged(int)
+ stackedWidgetLabels
+ setCurrentIndex(int)
+
+
+ 201
+ 593
+
+
+ 100
+ 614
+
+
+
+
+ comboBoxStrategy
+ currentIndexChanged(int)
+ stackedWidgetSpinboxes
+ setCurrentIndex(int)
+
+
+ 444
+ 591
+
+
+ 809
+ 616
+
+
+
+
diff --git a/src/urh/controller/GeneratorTabController.py b/src/urh/controller/GeneratorTabController.py
index 0cf0186b95..8298695e4a 100644
--- a/src/urh/controller/GeneratorTabController.py
+++ b/src/urh/controller/GeneratorTabController.py
@@ -441,9 +441,14 @@ def show_fuzzing_dialog(self, label_index: int):
fdc = FuzzingDialog(protocol=self.table_model.protocol, label_index=label_index,
msg_index=msg_index, proto_view=view, parent=self)
fdc.show()
- fdc.finished.connect(self.refresh_label_list)
- fdc.finished.connect(self.refresh_table)
- fdc.finished.connect(self.set_fuzzing_ui_status)
+ fdc.finished.connect(self.on_fuzzing_dialog_finished)
+
+ @pyqtSlot()
+ def on_fuzzing_dialog_finished(self):
+ self.refresh_label_list()
+ self.refresh_table()
+ self.set_fuzzing_ui_status()
+ self.ui.tabWidget.setCurrentIndex(2)
@pyqtSlot()
def handle_plabel_fuzzing_state_changed(self):
diff --git a/src/urh/controller/dialogs/FuzzingDialog.py b/src/urh/controller/dialogs/FuzzingDialog.py
index 942e60a35b..fa7b096bf9 100644
--- a/src/urh/controller/dialogs/FuzzingDialog.py
+++ b/src/urh/controller/dialogs/FuzzingDialog.py
@@ -12,7 +12,8 @@
class FuzzingDialog(QDialog):
- def __init__(self, protocol: ProtocolAnalyzerContainer, label_index: int, msg_index: int, proto_view: int, parent=None):
+ def __init__(self, protocol: ProtocolAnalyzerContainer, label_index: int, msg_index: int, proto_view: int,
+ parent=None):
super().__init__(parent)
self.ui = Ui_FuzzingDialog()
self.ui.setupUi(self)
@@ -113,9 +114,7 @@ def create_connects(self):
self.ui.spinBoxRandomMinimum.valueChanged.connect(self.on_random_range_min_changed)
self.ui.spinBoxRandomMaximum.valueChanged.connect(self.on_random_range_max_changed)
self.ui.spinBoxFuzzMessage.valueChanged.connect(self.on_fuzz_msg_changed)
- self.ui.btnAddRange.clicked.connect(self.on_btn_add_range_clicked)
- self.ui.btnAddBoundaries.clicked.connect(self.on_btn_add_boundaries_clicked)
- self.ui.btnAddRandom.clicked.connect(self.on_btn_add_random_clicked)
+ self.ui.btnAddFuzzingValues.clicked.connect(self.on_btn_add_fuzzing_values_clicked)
self.ui.comboBoxFuzzingLabel.editTextChanged.connect(self.set_current_label_name)
def update_message_data_string(self):
@@ -245,11 +244,9 @@ def on_fuzzing_range_end_changed(self, value: int):
def on_lower_bound_checked_changed(self):
if self.ui.checkBoxLowerBound.isChecked():
self.ui.spinBoxLowerBound.setEnabled(True)
- self.ui.btnAddBoundaries.setEnabled(True)
self.ui.spinBoxBoundaryNumber.setEnabled(True)
elif not self.ui.checkBoxUpperBound.isChecked():
self.ui.spinBoxLowerBound.setEnabled(False)
- self.ui.btnAddBoundaries.setEnabled(False)
self.ui.spinBoxBoundaryNumber.setEnabled(False)
else:
self.ui.spinBoxLowerBound.setEnabled(False)
@@ -258,11 +255,9 @@ def on_lower_bound_checked_changed(self):
def on_upper_bound_checked_changed(self):
if self.ui.checkBoxUpperBound.isChecked():
self.ui.spinBoxUpperBound.setEnabled(True)
- self.ui.btnAddBoundaries.setEnabled(True)
self.ui.spinBoxBoundaryNumber.setEnabled(True)
elif not self.ui.checkBoxLowerBound.isChecked():
self.ui.spinBoxUpperBound.setEnabled(False)
- self.ui.btnAddBoundaries.setEnabled(False)
self.ui.spinBoxBoundaryNumber.setEnabled(False)
else:
self.ui.spinBoxUpperBound.setEnabled(False)
@@ -288,14 +283,21 @@ def on_random_range_max_changed(self):
self.ui.spinBoxRandomMinimum.setMaximum(self.ui.spinBoxRandomMaximum.value() - 1)
@pyqtSlot()
- def on_btn_add_range_clicked(self):
+ def on_btn_add_fuzzing_values_clicked(self):
+ if self.ui.comboBoxStrategy.currentIndex() == 0:
+ self.__add_fuzzing_range()
+ elif self.ui.comboBoxStrategy.currentIndex() == 1:
+ self.__add_fuzzing_boundaries()
+ elif self.ui.comboBoxStrategy.currentIndex() == 2:
+ self.__add_random_fuzzing_values()
+
+ def __add_fuzzing_range(self):
start = self.ui.sBAddRangeStart.value()
end = self.ui.sBAddRangeEnd.value()
step = self.ui.sBAddRangeStep.value()
self.fuzz_table_model.add_range(start, end + 1, step)
- @pyqtSlot()
- def on_btn_add_boundaries_clicked(self):
+ def __add_fuzzing_boundaries(self):
lower_bound = -1
if self.ui.spinBoxLowerBound.isEnabled():
lower_bound = self.ui.spinBoxLowerBound.value()
@@ -307,8 +309,7 @@ def on_btn_add_boundaries_clicked(self):
num_vals = self.ui.spinBoxBoundaryNumber.value()
self.fuzz_table_model.add_boundaries(lower_bound, upper_bound, num_vals)
- @pyqtSlot()
- def on_btn_add_random_clicked(self):
+ def __add_random_fuzzing_values(self):
n = self.ui.spinBoxNumberRandom.value()
minimum = self.ui.spinBoxRandomMinimum.value()
maximum = self.ui.spinBoxRandomMaximum.value()
@@ -354,7 +355,7 @@ def on_fuzz_msg_changed(self, index: int):
@pyqtSlot()
def on_btn_repeat_values_clicked(self):
num_repeats, ok = QInputDialog.getInt(self, self.tr("How many times shall values be repeated?"),
- self.tr("Number of repeats:"), 1, 1)
+ self.tr("Number of repeats:"), 1, 1)
if ok:
self.ui.chkBRemoveDuplicates.setChecked(False)
min_row, max_row, _, _ = self.ui.tblFuzzingValues.selection_range()
diff --git a/src/urh/cythonext/util.pyx b/src/urh/cythonext/util.pyx
index 20638d4b59..e58df1337f 100644
--- a/src/urh/cythonext/util.pyx
+++ b/src/urh/cythonext/util.pyx
@@ -12,6 +12,9 @@ from cython.parallel import prange
from libc.math cimport log10,pow
from libcpp cimport bool
+from cpython cimport array
+import array
+
from urh.cythonext.util cimport iq
cpdef tuple minmax(iq[:] arr):
@@ -287,4 +290,40 @@ cpdef tuple get_crc_datarange(uint8_t[:] inpt, uint8_t[:] polynomial, uint64_t v
# No beginning found
return 0, 0
finally:
- free(steps)
\ No newline at end of file
+ free(steps)
+
+cdef db(unsigned int t, unsigned int p, unsigned int k, unsigned int n,
+ uint8_t* a, uint8_t* sequence, uint64_t* current_index):
+ cdef unsigned int i,j
+
+ if t > n:
+ if n % p == 0:
+ for i in range(1, p+1):
+ sequence[current_index[0]] = a[i]
+ current_index[0] += 1
+ else:
+ a[t] = a[t - p]
+ db(t + 1, p, k, n, a, sequence, current_index)
+ for j in range(a[t - p] + 1, k):
+ a[t] = j
+ db(t+1, t, k, n, a, sequence, current_index)
+
+cpdef array.array de_bruijn(unsigned int n):
+ cdef unsigned int k = 2 # Alphabet size is 2 because our alphabet is [0, 1]
+ cdef uint64_t len_sequence = k ** n
+
+ cdef uint8_t* a = calloc(k*n, sizeof(uint8_t))
+
+ cdef array.array array_template = array.array('B', [])
+ cdef array.array sequence
+ sequence = array.clone(array_template, len_sequence, zero=False)
+
+ cdef uint64_t* current_index = calloc(1, sizeof(uint64_t))
+
+ db(1, 1, k, n, a, sequence.data.as_uchars, current_index)
+
+ try:
+ return sequence
+ finally:
+ free(a)
+ free(current_index)
diff --git a/src/urh/models/GeneratorTableModel.py b/src/urh/models/GeneratorTableModel.py
index a27212fcc6..f458a6b171 100644
--- a/src/urh/models/GeneratorTableModel.py
+++ b/src/urh/models/GeneratorTableModel.py
@@ -1,4 +1,5 @@
import array
+import time
from collections import defaultdict
from PyQt5.QtCore import Qt, QModelIndex, pyqtSlot, pyqtSignal
@@ -139,6 +140,27 @@ def add_empty_row_behind(self, row_index: int, num_bits: int):
undo_action = InsertBitsAndPauses(self.protocol, row_index+1, tmp_protocol)
self.undo_stack.push(undo_action)
+ def generate_de_bruijn(self, row_index: int, start: int, end: int):
+ if start < 0 or end < 0:
+ return
+
+ f = 1 if self.proto_view == 0 else 4 if self.proto_view == 1 else 8
+ start, end = f * start, f * end
+
+ de_bruijn_seq = util.de_bruijn(end-start)
+
+ tmp_protocol = ProtocolAnalyzer(None)
+ tmp_protocol.messages = []
+ LINE_BREAK_AFTER = 5000 * f
+ for i in range(0, len(de_bruijn_seq), LINE_BREAK_AFTER):
+ message = Message(plain_bits=de_bruijn_seq[i:i+LINE_BREAK_AFTER],
+ pause=0,
+ message_type=self.protocol.default_message_type)
+ tmp_protocol.messages.append(message)
+
+ undo_action = InsertBitsAndPauses(self.protocol, row_index+1, tmp_protocol)
+ self.undo_stack.push(undo_action)
+
def __set_italic_font_for_label_range(self, row, label, italic: bool):
message = self.protocol.messages[row]
for j in range(*message.get_label_range(lbl=label, view=self.proto_view, decode=False)):
diff --git a/src/urh/ui/ui_fuzzing.py b/src/urh/ui/ui_fuzzing.py
index ff79e15421..bab9a49cd5 100644
--- a/src/urh/ui/ui_fuzzing.py
+++ b/src/urh/ui/ui_fuzzing.py
@@ -11,35 +11,9 @@
class Ui_FuzzingDialog(object):
def setupUi(self, FuzzingDialog):
FuzzingDialog.setObjectName("FuzzingDialog")
- FuzzingDialog.resize(825, 666)
+ FuzzingDialog.resize(523, 632)
self.gridLayout_5 = QtWidgets.QGridLayout(FuzzingDialog)
self.gridLayout_5.setObjectName("gridLayout_5")
- self.lFuzzingStart = QtWidgets.QLabel(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lFuzzingStart.sizePolicy().hasHeightForWidth())
- self.lFuzzingStart.setSizePolicy(sizePolicy)
- self.lFuzzingStart.setObjectName("lFuzzingStart")
- self.gridLayout_5.addWidget(self.lFuzzingStart, 3, 0, 1, 1)
- self.spinBoxFuzzingStart = QtWidgets.QSpinBox(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.spinBoxFuzzingStart.sizePolicy().hasHeightForWidth())
- self.spinBoxFuzzingStart.setSizePolicy(sizePolicy)
- self.spinBoxFuzzingStart.setMinimum(1)
- self.spinBoxFuzzingStart.setMaximum(999999999)
- self.spinBoxFuzzingStart.setObjectName("spinBoxFuzzingStart")
- self.gridLayout_5.addWidget(self.spinBoxFuzzingStart, 3, 1, 1, 1)
- self.lFuzzingLabel = QtWidgets.QLabel(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lFuzzingLabel.sizePolicy().hasHeightForWidth())
- self.lFuzzingLabel.setSizePolicy(sizePolicy)
- self.lFuzzingLabel.setObjectName("lFuzzingLabel")
- self.gridLayout_5.addWidget(self.lFuzzingLabel, 0, 0, 1, 1)
self.spinBoxFuzzMessage = QtWidgets.QSpinBox(FuzzingDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -49,40 +23,119 @@ def setupUi(self, FuzzingDialog):
self.spinBoxFuzzMessage.setMaximum(999999999)
self.spinBoxFuzzMessage.setObjectName("spinBoxFuzzMessage")
self.gridLayout_5.addWidget(self.spinBoxFuzzMessage, 2, 1, 1, 1)
- self.lSourceBlock = QtWidgets.QLabel(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
+ self.comboBoxStrategy = QtWidgets.QComboBox(FuzzingDialog)
+ self.comboBoxStrategy.setObjectName("comboBoxStrategy")
+ self.comboBoxStrategy.addItem("")
+ self.comboBoxStrategy.addItem("")
+ self.comboBoxStrategy.addItem("")
+ self.comboBoxStrategy.addItem("")
+ self.gridLayout_5.addWidget(self.comboBoxStrategy, 6, 1, 1, 1)
+ self.btnAddFuzzingValues = QtWidgets.QPushButton(FuzzingDialog)
+ self.btnAddFuzzingValues.setObjectName("btnAddFuzzingValues")
+ self.gridLayout_5.addWidget(self.btnAddFuzzingValues, 9, 1, 1, 1)
+ self.stackedWidgetLabels = QtWidgets.QStackedWidget(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lSourceBlock.sizePolicy().hasHeightForWidth())
- self.lSourceBlock.setSizePolicy(sizePolicy)
- self.lSourceBlock.setObjectName("lSourceBlock")
- self.gridLayout_5.addWidget(self.lSourceBlock, 1, 0, 1, 1)
- self.lFuzzingReferenceBlock = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy.setHeightForWidth(self.stackedWidgetLabels.sizePolicy().hasHeightForWidth())
+ self.stackedWidgetLabels.setSizePolicy(sizePolicy)
+ self.stackedWidgetLabels.setObjectName("stackedWidgetLabels")
+ self.pageAddRangeLabel = QtWidgets.QWidget()
+ self.pageAddRangeLabel.setObjectName("pageAddRangeLabel")
+ self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.pageAddRangeLabel)
+ self.verticalLayout_3.setContentsMargins(0, 0, -1, 0)
+ self.verticalLayout_3.setSpacing(6)
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.lStart = QtWidgets.QLabel(self.pageAddRangeLabel)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lFuzzingReferenceBlock.sizePolicy().hasHeightForWidth())
- self.lFuzzingReferenceBlock.setSizePolicy(sizePolicy)
- self.lFuzzingReferenceBlock.setObjectName("lFuzzingReferenceBlock")
- self.gridLayout_5.addWidget(self.lFuzzingReferenceBlock, 2, 0, 1, 1)
- self.lFuzzingEnd = QtWidgets.QLabel(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHeightForWidth(self.lStart.sizePolicy().hasHeightForWidth())
+ self.lStart.setSizePolicy(sizePolicy)
+ self.lStart.setObjectName("lStart")
+ self.verticalLayout_3.addWidget(self.lStart)
+ self.lEnd = QtWidgets.QLabel(self.pageAddRangeLabel)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lFuzzingEnd.sizePolicy().hasHeightForWidth())
- self.lFuzzingEnd.setSizePolicy(sizePolicy)
- self.lFuzzingEnd.setObjectName("lFuzzingEnd")
- self.gridLayout_5.addWidget(self.lFuzzingEnd, 4, 0, 1, 1)
- self.comboBoxFuzzingLabel = QtWidgets.QComboBox(FuzzingDialog)
+ sizePolicy.setHeightForWidth(self.lEnd.sizePolicy().hasHeightForWidth())
+ self.lEnd.setSizePolicy(sizePolicy)
+ self.lEnd.setObjectName("lEnd")
+ self.verticalLayout_3.addWidget(self.lEnd)
+ self.lStep = QtWidgets.QLabel(self.pageAddRangeLabel)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lStep.sizePolicy().hasHeightForWidth())
+ self.lStep.setSizePolicy(sizePolicy)
+ self.lStep.setObjectName("lStep")
+ self.verticalLayout_3.addWidget(self.lStep)
+ self.stackedWidgetLabels.addWidget(self.pageAddRangeLabel)
+ self.pageAddBoundariesLabel = QtWidgets.QWidget()
+ self.pageAddBoundariesLabel.setObjectName("pageAddBoundariesLabel")
+ self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.pageAddBoundariesLabel)
+ self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
+ self.verticalLayout_4.setSpacing(6)
+ self.verticalLayout_4.setObjectName("verticalLayout_4")
+ self.checkBoxLowerBound = QtWidgets.QCheckBox(self.pageAddBoundariesLabel)
+ self.checkBoxLowerBound.setChecked(True)
+ self.checkBoxLowerBound.setObjectName("checkBoxLowerBound")
+ self.verticalLayout_4.addWidget(self.checkBoxLowerBound)
+ self.checkBoxUpperBound = QtWidgets.QCheckBox(self.pageAddBoundariesLabel)
+ self.checkBoxUpperBound.setChecked(True)
+ self.checkBoxUpperBound.setObjectName("checkBoxUpperBound")
+ self.verticalLayout_4.addWidget(self.checkBoxUpperBound)
+ self.lNumberBoundaries = QtWidgets.QLabel(self.pageAddBoundariesLabel)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.comboBoxFuzzingLabel.sizePolicy().hasHeightForWidth())
- self.comboBoxFuzzingLabel.setSizePolicy(sizePolicy)
- self.comboBoxFuzzingLabel.setMaximumSize(QtCore.QSize(16777215, 16777215))
- self.comboBoxFuzzingLabel.setEditable(True)
- self.comboBoxFuzzingLabel.setObjectName("comboBoxFuzzingLabel")
- self.gridLayout_5.addWidget(self.comboBoxFuzzingLabel, 0, 1, 1, 1)
+ sizePolicy.setHeightForWidth(self.lNumberBoundaries.sizePolicy().hasHeightForWidth())
+ self.lNumberBoundaries.setSizePolicy(sizePolicy)
+ self.lNumberBoundaries.setObjectName("lNumberBoundaries")
+ self.verticalLayout_4.addWidget(self.lNumberBoundaries)
+ self.stackedWidgetLabels.addWidget(self.pageAddBoundariesLabel)
+ self.pageAddRandomLabel = QtWidgets.QWidget()
+ self.pageAddRandomLabel.setObjectName("pageAddRandomLabel")
+ self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.pageAddRandomLabel)
+ self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
+ self.verticalLayout_6.setSpacing(6)
+ self.verticalLayout_6.setObjectName("verticalLayout_6")
+ self.lRandomMin = QtWidgets.QLabel(self.pageAddRandomLabel)
+ self.lRandomMin.setObjectName("lRandomMin")
+ self.verticalLayout_6.addWidget(self.lRandomMin)
+ self.lRandomMax = QtWidgets.QLabel(self.pageAddRandomLabel)
+ self.lRandomMax.setObjectName("lRandomMax")
+ self.verticalLayout_6.addWidget(self.lRandomMax)
+ self.lNumRandom = QtWidgets.QLabel(self.pageAddRandomLabel)
+ self.lNumRandom.setObjectName("lNumRandom")
+ self.verticalLayout_6.addWidget(self.lNumRandom)
+ self.stackedWidgetLabels.addWidget(self.pageAddRandomLabel)
+ self.gridLayout_5.addWidget(self.stackedWidgetLabels, 7, 0, 2, 1)
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.lPreBits = QtWidgets.QLabel(FuzzingDialog)
+ self.lPreBits.setObjectName("lPreBits")
+ self.horizontalLayout_2.addWidget(self.lPreBits)
+ self.lFuzzedBits = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lFuzzedBits.sizePolicy().hasHeightForWidth())
+ self.lFuzzedBits.setSizePolicy(sizePolicy)
+ font = QtGui.QFont()
+ font.setBold(True)
+ font.setWeight(75)
+ self.lFuzzedBits.setFont(font)
+ self.lFuzzedBits.setAlignment(QtCore.Qt.AlignCenter)
+ self.lFuzzedBits.setObjectName("lFuzzedBits")
+ self.horizontalLayout_2.addWidget(self.lFuzzedBits)
+ self.lPostBits = QtWidgets.QLabel(FuzzingDialog)
+ self.lPostBits.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
+ self.lPostBits.setObjectName("lPostBits")
+ self.horizontalLayout_2.addWidget(self.lPostBits)
+ spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem)
+ self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 1, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.lFuzzedValues = QtWidgets.QLabel(FuzzingDialog)
@@ -122,8 +175,8 @@ def setupUi(self, FuzzingDialog):
self.tblFuzzingValues.horizontalHeader().setHighlightSections(False)
self.tblFuzzingValues.verticalHeader().setHighlightSections(False)
self.gridLayout_4.addWidget(self.tblFuzzingValues, 0, 0, 4, 1)
- spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
- self.gridLayout_4.addItem(spacerItem, 3, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridLayout_4.addItem(spacerItem1, 3, 1, 1, 1)
self.btnAddRow = QtWidgets.QToolButton(FuzzingDialog)
icon = QtGui.QIcon.fromTheme("list-add")
self.btnAddRow.setIcon(icon)
@@ -136,144 +189,100 @@ def setupUi(self, FuzzingDialog):
self.gridLayout_4.addWidget(self.btnRepeatValues, 2, 1, 1, 1)
self.verticalLayout.addLayout(self.gridLayout_4)
self.gridLayout_5.addLayout(self.verticalLayout, 5, 0, 1, 2)
- self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_4.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
- self.horizontalLayout_4.setObjectName("horizontalLayout_4")
- self.groupBoxAddRange = QtWidgets.QGroupBox(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.groupBoxAddRange.sizePolicy().hasHeightForWidth())
- self.groupBoxAddRange.setSizePolicy(sizePolicy)
- self.groupBoxAddRange.setObjectName("groupBoxAddRange")
- self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBoxAddRange)
- self.gridLayout_2.setObjectName("gridLayout_2")
- self.lStart = QtWidgets.QLabel(self.groupBoxAddRange)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lStart.sizePolicy().hasHeightForWidth())
- self.lStart.setSizePolicy(sizePolicy)
- self.lStart.setObjectName("lStart")
- self.gridLayout_2.addWidget(self.lStart, 0, 0, 1, 1)
- self.sBAddRangeStart = QtWidgets.QSpinBox(self.groupBoxAddRange)
+ self.stackedWidgetSpinboxes = QtWidgets.QStackedWidget(FuzzingDialog)
+ self.stackedWidgetSpinboxes.setObjectName("stackedWidgetSpinboxes")
+ self.pageAddRange = QtWidgets.QWidget()
+ self.pageAddRange.setObjectName("pageAddRange")
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.pageAddRange)
+ self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
+ self.verticalLayout_2.setSpacing(6)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.sBAddRangeStart = QtWidgets.QSpinBox(self.pageAddRange)
self.sBAddRangeStart.setObjectName("sBAddRangeStart")
- self.gridLayout_2.addWidget(self.sBAddRangeStart, 0, 1, 1, 1)
- self.lEnd = QtWidgets.QLabel(self.groupBoxAddRange)
- self.lEnd.setObjectName("lEnd")
- self.gridLayout_2.addWidget(self.lEnd, 1, 0, 1, 1)
- self.sBAddRangeEnd = QtWidgets.QSpinBox(self.groupBoxAddRange)
+ self.verticalLayout_2.addWidget(self.sBAddRangeStart)
+ self.sBAddRangeEnd = QtWidgets.QSpinBox(self.pageAddRange)
self.sBAddRangeEnd.setObjectName("sBAddRangeEnd")
- self.gridLayout_2.addWidget(self.sBAddRangeEnd, 1, 1, 1, 1)
- self.lStep = QtWidgets.QLabel(self.groupBoxAddRange)
- self.lStep.setObjectName("lStep")
- self.gridLayout_2.addWidget(self.lStep, 2, 0, 1, 1)
- self.sBAddRangeStep = QtWidgets.QSpinBox(self.groupBoxAddRange)
+ self.verticalLayout_2.addWidget(self.sBAddRangeEnd)
+ self.sBAddRangeStep = QtWidgets.QSpinBox(self.pageAddRange)
self.sBAddRangeStep.setMinimum(1)
self.sBAddRangeStep.setObjectName("sBAddRangeStep")
- self.gridLayout_2.addWidget(self.sBAddRangeStep, 2, 1, 1, 1)
- self.btnAddRange = QtWidgets.QPushButton(self.groupBoxAddRange)
- self.btnAddRange.setObjectName("btnAddRange")
- self.gridLayout_2.addWidget(self.btnAddRange, 3, 0, 1, 2)
- self.horizontalLayout_4.addWidget(self.groupBoxAddRange)
- self.groupBox = QtWidgets.QGroupBox(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth())
- self.groupBox.setSizePolicy(sizePolicy)
- self.groupBox.setObjectName("groupBox")
- self.gridLayout = QtWidgets.QGridLayout(self.groupBox)
- self.gridLayout.setObjectName("gridLayout")
- self.checkBoxLowerBound = QtWidgets.QCheckBox(self.groupBox)
- self.checkBoxLowerBound.setChecked(True)
- self.checkBoxLowerBound.setObjectName("checkBoxLowerBound")
- self.gridLayout.addWidget(self.checkBoxLowerBound, 0, 0, 1, 1)
- self.spinBoxLowerBound = QtWidgets.QSpinBox(self.groupBox)
+ self.verticalLayout_2.addWidget(self.sBAddRangeStep)
+ self.stackedWidgetSpinboxes.addWidget(self.pageAddRange)
+ self.pageAddBoundaries = QtWidgets.QWidget()
+ self.pageAddBoundaries.setObjectName("pageAddBoundaries")
+ self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.pageAddBoundaries)
+ self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
+ self.verticalLayout_5.setSpacing(6)
+ self.verticalLayout_5.setObjectName("verticalLayout_5")
+ self.spinBoxLowerBound = QtWidgets.QSpinBox(self.pageAddBoundaries)
self.spinBoxLowerBound.setObjectName("spinBoxLowerBound")
- self.gridLayout.addWidget(self.spinBoxLowerBound, 0, 1, 1, 1)
- self.checkBoxUpperBound = QtWidgets.QCheckBox(self.groupBox)
- self.checkBoxUpperBound.setChecked(True)
- self.checkBoxUpperBound.setObjectName("checkBoxUpperBound")
- self.gridLayout.addWidget(self.checkBoxUpperBound, 1, 0, 1, 1)
- self.spinBoxUpperBound = QtWidgets.QSpinBox(self.groupBox)
+ self.verticalLayout_5.addWidget(self.spinBoxLowerBound)
+ self.spinBoxUpperBound = QtWidgets.QSpinBox(self.pageAddBoundaries)
+ self.spinBoxUpperBound.setProperty("value", 13)
self.spinBoxUpperBound.setObjectName("spinBoxUpperBound")
- self.gridLayout.addWidget(self.spinBoxUpperBound, 1, 1, 1, 1)
- self.lNumberBoundaries = QtWidgets.QLabel(self.groupBox)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lNumberBoundaries.sizePolicy().hasHeightForWidth())
- self.lNumberBoundaries.setSizePolicy(sizePolicy)
- self.lNumberBoundaries.setObjectName("lNumberBoundaries")
- self.gridLayout.addWidget(self.lNumberBoundaries, 2, 0, 1, 1)
- self.spinBoxBoundaryNumber = QtWidgets.QSpinBox(self.groupBox)
+ self.verticalLayout_5.addWidget(self.spinBoxUpperBound)
+ self.spinBoxBoundaryNumber = QtWidgets.QSpinBox(self.pageAddBoundaries)
self.spinBoxBoundaryNumber.setMinimum(1)
self.spinBoxBoundaryNumber.setObjectName("spinBoxBoundaryNumber")
- self.gridLayout.addWidget(self.spinBoxBoundaryNumber, 2, 1, 1, 1)
- self.btnAddBoundaries = QtWidgets.QPushButton(self.groupBox)
- self.btnAddBoundaries.setObjectName("btnAddBoundaries")
- self.gridLayout.addWidget(self.btnAddBoundaries, 3, 0, 1, 2)
- self.horizontalLayout_4.addWidget(self.groupBox)
- self.groupBoxxRandom = QtWidgets.QGroupBox(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.groupBoxxRandom.sizePolicy().hasHeightForWidth())
- self.groupBoxxRandom.setSizePolicy(sizePolicy)
- self.groupBoxxRandom.setObjectName("groupBoxxRandom")
- self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBoxxRandom)
- self.gridLayout_3.setObjectName("gridLayout_3")
- self.lNumRandom = QtWidgets.QLabel(self.groupBoxxRandom)
- self.lNumRandom.setObjectName("lNumRandom")
- self.gridLayout_3.addWidget(self.lNumRandom, 0, 0, 1, 1)
- self.spinBoxNumberRandom = QtWidgets.QSpinBox(self.groupBoxxRandom)
+ self.verticalLayout_5.addWidget(self.spinBoxBoundaryNumber)
+ self.stackedWidgetSpinboxes.addWidget(self.pageAddBoundaries)
+ self.pageAddRandom = QtWidgets.QWidget()
+ self.pageAddRandom.setObjectName("pageAddRandom")
+ self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.pageAddRandom)
+ self.verticalLayout_7.setContentsMargins(0, 0, 0, 0)
+ self.verticalLayout_7.setSpacing(6)
+ self.verticalLayout_7.setObjectName("verticalLayout_7")
+ self.spinBoxRandomMinimum = QtWidgets.QSpinBox(self.pageAddRandom)
+ self.spinBoxRandomMinimum.setObjectName("spinBoxRandomMinimum")
+ self.verticalLayout_7.addWidget(self.spinBoxRandomMinimum)
+ self.spinBoxRandomMaximum = QtWidgets.QSpinBox(self.pageAddRandom)
+ self.spinBoxRandomMaximum.setProperty("value", 42)
+ self.spinBoxRandomMaximum.setObjectName("spinBoxRandomMaximum")
+ self.verticalLayout_7.addWidget(self.spinBoxRandomMaximum)
+ self.spinBoxNumberRandom = QtWidgets.QSpinBox(self.pageAddRandom)
self.spinBoxNumberRandom.setMinimum(1)
self.spinBoxNumberRandom.setMaximum(999999999)
self.spinBoxNumberRandom.setObjectName("spinBoxNumberRandom")
- self.gridLayout_3.addWidget(self.spinBoxNumberRandom, 0, 1, 1, 1)
- self.lRandomMin = QtWidgets.QLabel(self.groupBoxxRandom)
- self.lRandomMin.setObjectName("lRandomMin")
- self.gridLayout_3.addWidget(self.lRandomMin, 1, 0, 1, 1)
- self.spinBoxRandomMinimum = QtWidgets.QSpinBox(self.groupBoxxRandom)
- self.spinBoxRandomMinimum.setObjectName("spinBoxRandomMinimum")
- self.gridLayout_3.addWidget(self.spinBoxRandomMinimum, 1, 1, 1, 1)
- self.lRandomMax = QtWidgets.QLabel(self.groupBoxxRandom)
- self.lRandomMax.setObjectName("lRandomMax")
- self.gridLayout_3.addWidget(self.lRandomMax, 2, 0, 1, 1)
- self.spinBoxRandomMaximum = QtWidgets.QSpinBox(self.groupBoxxRandom)
- self.spinBoxRandomMaximum.setObjectName("spinBoxRandomMaximum")
- self.gridLayout_3.addWidget(self.spinBoxRandomMaximum, 2, 1, 1, 1)
- self.btnAddRandom = QtWidgets.QPushButton(self.groupBoxxRandom)
- self.btnAddRandom.setObjectName("btnAddRandom")
- self.gridLayout_3.addWidget(self.btnAddRandom, 3, 0, 1, 2)
- self.horizontalLayout_4.addWidget(self.groupBoxxRandom)
- self.gridLayout_5.addLayout(self.horizontalLayout_4, 6, 0, 1, 2)
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- self.lPreBits = QtWidgets.QLabel(FuzzingDialog)
- self.lPreBits.setObjectName("lPreBits")
- self.horizontalLayout_2.addWidget(self.lPreBits)
- self.lFuzzedBits = QtWidgets.QLabel(FuzzingDialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ self.verticalLayout_7.addWidget(self.spinBoxNumberRandom)
+ self.stackedWidgetSpinboxes.addWidget(self.pageAddRandom)
+ self.gridLayout_5.addWidget(self.stackedWidgetSpinboxes, 7, 1, 2, 1)
+ self.lSourceBlock = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.lFuzzedBits.sizePolicy().hasHeightForWidth())
- self.lFuzzedBits.setSizePolicy(sizePolicy)
- font = QtGui.QFont()
- font.setBold(True)
- font.setWeight(75)
- self.lFuzzedBits.setFont(font)
- self.lFuzzedBits.setAlignment(QtCore.Qt.AlignCenter)
- self.lFuzzedBits.setObjectName("lFuzzedBits")
- self.horizontalLayout_2.addWidget(self.lFuzzedBits)
- self.lPostBits = QtWidgets.QLabel(FuzzingDialog)
- self.lPostBits.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
- self.lPostBits.setObjectName("lPostBits")
- self.horizontalLayout_2.addWidget(self.lPostBits)
- spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout_2.addItem(spacerItem1)
- self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 1, 1, 1)
+ sizePolicy.setHeightForWidth(self.lSourceBlock.sizePolicy().hasHeightForWidth())
+ self.lSourceBlock.setSizePolicy(sizePolicy)
+ self.lSourceBlock.setObjectName("lSourceBlock")
+ self.gridLayout_5.addWidget(self.lSourceBlock, 1, 0, 1, 1)
+ self.lFuzzingReferenceBlock = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lFuzzingReferenceBlock.sizePolicy().hasHeightForWidth())
+ self.lFuzzingReferenceBlock.setSizePolicy(sizePolicy)
+ self.lFuzzingReferenceBlock.setObjectName("lFuzzingReferenceBlock")
+ self.gridLayout_5.addWidget(self.lFuzzingReferenceBlock, 2, 0, 1, 1)
+ self.lFuzzingEnd = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lFuzzingEnd.sizePolicy().hasHeightForWidth())
+ self.lFuzzingEnd.setSizePolicy(sizePolicy)
+ self.lFuzzingEnd.setObjectName("lFuzzingEnd")
+ self.gridLayout_5.addWidget(self.lFuzzingEnd, 4, 0, 1, 1)
+ self.lStrategy = QtWidgets.QLabel(FuzzingDialog)
+ self.lStrategy.setObjectName("lStrategy")
+ self.gridLayout_5.addWidget(self.lStrategy, 6, 0, 1, 1)
+ self.comboBoxFuzzingLabel = QtWidgets.QComboBox(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.comboBoxFuzzingLabel.sizePolicy().hasHeightForWidth())
+ self.comboBoxFuzzingLabel.setSizePolicy(sizePolicy)
+ self.comboBoxFuzzingLabel.setMaximumSize(QtCore.QSize(16777215, 16777215))
+ self.comboBoxFuzzingLabel.setEditable(True)
+ self.comboBoxFuzzingLabel.setObjectName("comboBoxFuzzingLabel")
+ self.gridLayout_5.addWidget(self.comboBoxFuzzingLabel, 0, 1, 1, 1)
self.spinBoxFuzzingEnd = QtWidgets.QSpinBox(FuzzingDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -284,41 +293,71 @@ def setupUi(self, FuzzingDialog):
self.spinBoxFuzzingEnd.setMaximum(999999999)
self.spinBoxFuzzingEnd.setObjectName("spinBoxFuzzingEnd")
self.gridLayout_5.addWidget(self.spinBoxFuzzingEnd, 4, 1, 1, 1)
+ self.spinBoxFuzzingStart = QtWidgets.QSpinBox(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.spinBoxFuzzingStart.sizePolicy().hasHeightForWidth())
+ self.spinBoxFuzzingStart.setSizePolicy(sizePolicy)
+ self.spinBoxFuzzingStart.setMinimum(1)
+ self.spinBoxFuzzingStart.setMaximum(999999999)
+ self.spinBoxFuzzingStart.setObjectName("spinBoxFuzzingStart")
+ self.gridLayout_5.addWidget(self.spinBoxFuzzingStart, 3, 1, 1, 1)
+ self.lFuzzingStart = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lFuzzingStart.sizePolicy().hasHeightForWidth())
+ self.lFuzzingStart.setSizePolicy(sizePolicy)
+ self.lFuzzingStart.setObjectName("lFuzzingStart")
+ self.gridLayout_5.addWidget(self.lFuzzingStart, 3, 0, 1, 1)
+ self.lFuzzingLabel = QtWidgets.QLabel(FuzzingDialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lFuzzingLabel.sizePolicy().hasHeightForWidth())
+ self.lFuzzingLabel.setSizePolicy(sizePolicy)
+ self.lFuzzingLabel.setObjectName("lFuzzingLabel")
+ self.gridLayout_5.addWidget(self.lFuzzingLabel, 0, 0, 1, 1)
self.retranslateUi(FuzzingDialog)
+ self.stackedWidgetLabels.setCurrentIndex(0)
+ self.stackedWidgetSpinboxes.setCurrentIndex(0)
+ self.comboBoxStrategy.currentIndexChanged['int'].connect(self.stackedWidgetLabels.setCurrentIndex)
+ self.comboBoxStrategy.currentIndexChanged['int'].connect(self.stackedWidgetSpinboxes.setCurrentIndex)
def retranslateUi(self, FuzzingDialog):
_translate = QtCore.QCoreApplication.translate
FuzzingDialog.setWindowTitle(_translate("FuzzingDialog", "Fuzzing"))
- self.lFuzzingStart.setText(_translate("FuzzingDialog", "Fuzzing Label Start Index:"))
- self.lFuzzingLabel.setText(_translate("FuzzingDialog", "Fuzzing Label:"))
- self.lSourceBlock.setText(_translate("FuzzingDialog", "Source Message:"))
- self.lFuzzingReferenceBlock.setText(_translate("FuzzingDialog", "Message to fuzz:"))
- self.lFuzzingEnd.setText(_translate("FuzzingDialog", "Fuzzing Label End Index:"))
- self.lFuzzedValues.setText(_translate("FuzzingDialog", "Fuzzed Values"))
- self.chkBRemoveDuplicates.setText(_translate("FuzzingDialog", "Remove Duplicates"))
- self.btnDelRow.setToolTip(_translate("FuzzingDialog", "Remove selected values or last value if nothing is selected."))
- self.btnDelRow.setText(_translate("FuzzingDialog", "..."))
- self.btnAddRow.setToolTip(_translate("FuzzingDialog", "Add a new value."))
- self.btnAddRow.setText(_translate("FuzzingDialog", "..."))
- self.btnRepeatValues.setToolTip(_translate("FuzzingDialog", "Repeat selected values or all values if nothing is selected."))
- self.btnRepeatValues.setText(_translate("FuzzingDialog", "..."))
- self.groupBoxAddRange.setTitle(_translate("FuzzingDialog", "Add Range"))
+ self.comboBoxStrategy.setItemText(0, _translate("FuzzingDialog", "Add Range of Values"))
+ self.comboBoxStrategy.setItemText(1, _translate("FuzzingDialog", "Add Boundaries"))
+ self.comboBoxStrategy.setItemText(2, _translate("FuzzingDialog", "Add Random Values from Range"))
+ self.comboBoxStrategy.setItemText(3, _translate("FuzzingDialog", "Add De Bruijn Sequence"))
+ self.btnAddFuzzingValues.setText(_translate("FuzzingDialog", "Add to Fuzzed Values"))
self.lStart.setText(_translate("FuzzingDialog", "Start (Decimal):"))
self.lEnd.setText(_translate("FuzzingDialog", "End (Decimal):"))
self.lStep.setText(_translate("FuzzingDialog", "Step (Decimal):"))
- self.btnAddRange.setText(_translate("FuzzingDialog", "Add to Fuzzed Values"))
- self.groupBox.setTitle(_translate("FuzzingDialog", "Add Boundaries"))
self.checkBoxLowerBound.setText(_translate("FuzzingDialog", "Lower Bound"))
self.checkBoxUpperBound.setText(_translate("FuzzingDialog", "Upper Bound"))
- self.lNumberBoundaries.setText(_translate("FuzzingDialog", "Border Values:"))
- self.btnAddBoundaries.setText(_translate("FuzzingDialog", "Add to Fuzzed Values"))
- self.groupBoxxRandom.setTitle(_translate("FuzzingDialog", "Add random values from range"))
- self.lNumRandom.setText(_translate("FuzzingDialog", "Number:"))
+ self.lNumberBoundaries.setText(_translate("FuzzingDialog", "Values per Boundary:"))
self.lRandomMin.setText(_translate("FuzzingDialog", "Range Minimum:"))
self.lRandomMax.setText(_translate("FuzzingDialog", "Range Maximum:"))
- self.btnAddRandom.setText(_translate("FuzzingDialog", "Add to Fuzzed Values"))
+ self.lNumRandom.setText(_translate("FuzzingDialog", "Number Values:"))
self.lPreBits.setText(_translate("FuzzingDialog", "1111"))
self.lFuzzedBits.setText(_translate("FuzzingDialog", "1010"))
self.lPostBits.setText(_translate("FuzzingDialog", "010101"))
+ self.lFuzzedValues.setText(_translate("FuzzingDialog", "Fuzzed Values"))
+ self.chkBRemoveDuplicates.setText(_translate("FuzzingDialog", "Remove Duplicates"))
+ self.btnDelRow.setToolTip(_translate("FuzzingDialog", "Remove selected values or last value if nothing is selected."))
+ self.btnDelRow.setText(_translate("FuzzingDialog", "..."))
+ self.btnAddRow.setToolTip(_translate("FuzzingDialog", "Add a new value."))
+ self.btnAddRow.setText(_translate("FuzzingDialog", "..."))
+ self.btnRepeatValues.setToolTip(_translate("FuzzingDialog", "Repeat selected values or all values if nothing is selected."))
+ self.btnRepeatValues.setText(_translate("FuzzingDialog", "..."))
+ self.lSourceBlock.setText(_translate("FuzzingDialog", "Source Message:"))
+ self.lFuzzingReferenceBlock.setText(_translate("FuzzingDialog", "Message to fuzz:"))
+ self.lFuzzingEnd.setText(_translate("FuzzingDialog", "Fuzzing Label End Index:"))
+ self.lStrategy.setText(_translate("FuzzingDialog", "Strategy:"))
+ self.lFuzzingStart.setText(_translate("FuzzingDialog", "Fuzzing Label Start Index:"))
+ self.lFuzzingLabel.setText(_translate("FuzzingDialog", "Fuzzing Label:"))
from urh.ui.views.FuzzingTableView import FuzzingTableView
diff --git a/src/urh/ui/views/GeneratorTableView.py b/src/urh/ui/views/GeneratorTableView.py
index 867f20c6f6..133260b5d4 100644
--- a/src/urh/ui/views/GeneratorTableView.py
+++ b/src/urh/ui/views/GeneratorTableView.py
@@ -184,6 +184,10 @@ def create_context_menu(self) -> QMenu:
self.encoding_actions[ea] = decoding
ea.triggered.connect(self.on_encoding_action_triggered)
+ menu.addSeparator()
+ de_bruijn_action = menu.addAction("Generate De Bruijn Sequence from Selection")
+ de_bruijn_action.triggered.connect(self.on_de_bruijn_action_triggered)
+
return menu
@pyqtSlot()
@@ -200,6 +204,16 @@ def on_encoding_action_triggered(self):
self.model().protocol.messages[row].decoder = self.encoding_actions[self.sender()]
self.encodings_updated.emit()
+ @pyqtSlot()
+ def on_de_bruijn_action_triggered(self):
+ self.setCursor(Qt.WaitCursor)
+
+ row = self.rowAt(self.context_menu_pos.y())
+ _, _, start, end = self.selection_range()
+ self.model().generate_de_bruijn(row, start, end)
+
+ self.unsetCursor()
+
@pyqtSlot()
def on_add_message_action_triggered(self):
row = self.rowAt(self.context_menu_pos.y())
diff --git a/src/urh/util/util.py b/src/urh/util/util.py
index caab18feb7..6a9ebe645d 100644
--- a/src/urh/util/util.py
+++ b/src/urh/util/util.py
@@ -7,6 +7,7 @@
import time
from xml.dom import minidom
from xml.etree import ElementTree as ET
+import urh.cythonext.util as c_util
import numpy as np
from PyQt5.QtCore import Qt
@@ -472,3 +473,7 @@ def calc_x_y_scale(rect, parent):
scale_y = view_rect.height() / parent_height
return scale_x, scale_y
+
+
+def de_bruijn(n: int) -> array.array:
+ return c_util.de_bruijn(n)
diff --git a/tests/test_fuzzing_dialog.py b/tests/test_fuzzing_dialog.py
index 13825bdbb2..9f15ad101b 100644
--- a/tests/test_fuzzing_dialog.py
+++ b/tests/test_fuzzing_dialog.py
@@ -110,7 +110,7 @@ def test_adding_fuzzing_range(self):
self.dialog.ui.sBAddRangeStart.setValue(10)
self.dialog.ui.sBAddRangeEnd.setValue(100)
self.dialog.ui.sBAddRangeStep.setValue(20)
- self.dialog.ui.btnAddRange.click()
+ self.dialog.ui.btnAddFuzzingValues.click()
self.assertEqual(6, self.dialog.fuzz_table_model.rowCount())
def test_adding_fuzzing_boundaries(self):
@@ -118,13 +118,15 @@ def test_adding_fuzzing_boundaries(self):
self.dialog.ui.spinBoxLowerBound.setValue(2)
self.dialog.ui.spinBoxUpperBound.setValue(200)
self.dialog.ui.spinBoxBoundaryNumber.setValue(2)
- self.dialog.ui.btnAddBoundaries.click()
+ self.dialog.ui.comboBoxStrategy.setCurrentIndex(1)
+ self.dialog.ui.btnAddFuzzingValues.click()
self.assertEqual(5, self.dialog.fuzz_table_model.rowCount())
def test_adding_fuzzing_random_values(self):
self.assertEqual(self.dialog.fuzz_table_model.data[0], "00010110010100010100") # serial part 1
self.dialog.ui.spinBoxNumberRandom.setValue(10)
- self.dialog.ui.btnAddRandom.click()
+ self.dialog.ui.comboBoxStrategy.setCurrentIndex(2)
+ self.dialog.ui.btnAddFuzzingValues.click()
self.assertEqual(11, self.dialog.fuzz_table_model.rowCount())
def test_remove_duplicates(self):
@@ -132,12 +134,12 @@ def test_remove_duplicates(self):
self.dialog.ui.sBAddRangeStart.setValue(10)
self.dialog.ui.sBAddRangeEnd.setValue(50)
self.dialog.ui.sBAddRangeStep.setValue(5)
- self.dialog.ui.btnAddRange.click()
+ self.dialog.ui.btnAddFuzzingValues.click()
self.assertEqual(10, self.dialog.fuzz_table_model.rowCount())
- self.dialog.ui.btnAddRange.click()
- self.dialog.ui.btnAddRange.click()
+ self.dialog.ui.btnAddFuzzingValues.click()
+ self.dialog.ui.btnAddFuzzingValues.click()
self.assertEqual(28, self.dialog.fuzz_table_model.rowCount())
self.dialog.ui.chkBRemoveDuplicates.click()
self.assertEqual(10, self.dialog.fuzz_table_model.rowCount())
- self.dialog.ui.btnAddRange.click()
+ self.dialog.ui.btnAddFuzzingValues.click()
self.assertEqual(10, self.dialog.fuzz_table_model.rowCount())
diff --git a/tests/test_util.py b/tests/test_util.py
index 955754e489..b3cedeaa32 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,3 +1,4 @@
+import array
import copy
import os
import sys
@@ -69,6 +70,10 @@ def test_write_pcap(self):
pcap = PCAP()
pcap.write_packets(proto_analyzer.messages, os.path.join(tempfile.gettempdir(), "test.pcap"), 1e6)
+ def test_de_bruijn_fuzzing(self):
+ self.assertEqual(util.de_bruijn(3), array.array("B", [0, 0, 0, 1, 0, 1, 1, 1]))
+ self.assertEqual(util.de_bruijn(4), array.array("B", [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]))
+
def test_native_backends_installed(self):
from urh.util import util