How to use the urh.constants.SETTINGS function in urh

To help you get started, we’ve selected a few urh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jopohl / urh / src / urh / ui / actions / Fuzz.py View on Github external
def redo(self):
        if constants.SETTINGS.value('use_default_fuzzing_pause', True, bool):
            default_pause = constants.SETTINGS.value("default_fuzzing_pause", 10**6, int)
        else:
            default_pause = None

        if self.fuz_mode == "Successive":
            added_indices = self.proto_analyzer_container.fuzz_successive(default_pause=default_pause)
        elif self.fuz_mode == "Concurrent":
            added_indices = self.proto_analyzer_container.fuzz_concurrent(default_pause=default_pause)
        elif self.fuz_mode == "Exhaustive":
            added_indices = self.proto_analyzer_container.fuzz_exhaustive(default_pause=default_pause)
        else:
            added_indices = []

        self.added_message_indices.extend(added_indices)
github jopohl / urh / src / urh / controller / dialogs / OptionsDialog.py View on Github external
def on_checkbox_confirm_close_dialog_clicked(self, checked: bool):
        constants.SETTINGS.setValue("not_show_close_dialog", not checked)
github jopohl / urh / src / urh / colormaps.py View on Github external
def write_selected_colormap_to_settings(colormap_name: str):
    constants.SETTINGS.setValue("spectrogram_colormap", colormap_name)
github jopohl / urh / src / urh / dev / gr / AbstractBaseThread.py View on Github external
self._bandwidth = bandwidth
        self._freq_correction = 1
        self._direct_sampling_mode = 0
        self._antenna_index = 0
        self._channel_index = 0
        self._receiving = receiving  # False for Sender-Thread
        self.device_args = ""  # e.g. addr=192.168.10.2
        self.device = "USRP"
        self.current_index = 0

        self.continuous_mode = False

        self.context = None
        self.socket = None

        if constants.SETTINGS.value("use_gnuradio_install_dir", False, bool):
            gnuradio_dir = constants.SETTINGS.value("gnuradio_install_dir", "")
            with open(os.path.join(tempfile.gettempdir(), "gnuradio_path.txt"), "w") as f:
                f.write(gnuradio_dir)
            self.python2_interpreter = os.path.join(gnuradio_dir, "gr-python27", "python.exe")
        else:
            self.python2_interpreter = constants.SETTINGS.value("python2_exe", "")

        self.queue = Queue()
        self.data = None  # Placeholder for SenderThread
        self.current_iteration = 0  # Counts number of Sendings in SenderThread

        self.tb_process = None
github jopohl / urh / src / urh / controller / dialogs / DecoderDialog.py View on Github external
def save_to_file(self):
        if self.project_manager.project_file:
            self.project_manager.decodings = self.decodings
        else:
            prefix = os.path.realpath(os.path.join(constants.SETTINGS.fileName(), ".."))
            with open(os.path.join(prefix, constants.DECODINGS_FILE), "w") as f:
                for i in range(0, self.ui.combobox_decodings.count()):
                    str = ""
                    for j in self.decodings[i].get_chain():
                        str += repr(j) + ", "
                    str += "\n"
                    f.write(str)
github jopohl / urh / src / urh / dev / gr / AbstractBaseThread.py View on Github external
self._direct_sampling_mode = 0
        self._antenna_index = 0
        self._channel_index = 0
        self._receiving = receiving  # False for Sender-Thread
        self.device_args = ""  # e.g. addr=192.168.10.2
        self.device = "USRP"
        self.current_index = 0

        self.is_in_spectrum_mode = False

        self.context = None
        self.socket = None

        gnuradio_path_file = os.path.join(tempfile.gettempdir(), "gnuradio_path.txt")
        if constants.SETTINGS.value("use_gnuradio_install_dir", False, bool):
            gnuradio_dir = constants.SETTINGS.value("gnuradio_install_dir", "")
            with open(gnuradio_path_file, "w") as f:
                f.write(gnuradio_dir)
            if os.path.isfile(os.path.join(gnuradio_dir, "gr-python27", "pythonw.exe")):
                self.python2_interpreter = os.path.join(gnuradio_dir, "gr-python27", "pythonw.exe")
            else:
                self.python2_interpreter = os.path.join(gnuradio_dir, "gr-python27", "python.exe")
        else:
            try:
                os.remove(gnuradio_path_file)
            except OSError:
                pass
            self.python2_interpreter = constants.SETTINGS.value("python2_exe", "")

        self.queue = Queue()
        self.data = None  # Placeholder for SenderThread
        self.current_iteration = 0  # Counts number of Sendings in SenderThread
github jopohl / urh / src / urh / controller / ProtocolSniffDialogController.py View on Github external
completer.setModel(QDirModel(completer))
        self.ui.lineEdit_sniff_OutputFile.setCompleter(completer)

        self.setWindowTitle(self.tr("Sniff Protocol"))
        self.setWindowIcon(QIcon.fromTheme(":/icons/icons/sniffer.svg"))

        self.encodings = encodings
        for encoding in self.encodings:
            self.ui.comboBox_sniff_encoding.addItem(encoding.name)

        self.create_connects()

        if encoding_index > -1:
            self.ui.comboBox_sniff_encoding.setCurrentIndex(encoding_index)

        self.ui.comboBox_sniff_viewtype.setCurrentIndex(constants.SETTINGS.value('default_view', 0, int))
        self.ui.txtEd_sniff_Preview.setFont(util.get_monospace_font())
github jopohl / urh / src / urh / ui / views / SelectableGraphicView.py View on Github external
def hold_shift_to_drag(self) -> bool:
        return constants.SETTINGS.value('hold_shift_to_drag', True, type=bool)
github jopohl / urh / src / urh / controller / SendRecvDialogController.py View on Github external
self.ui.splitter.setHandleWidth(6)

        self.set_sniff_ui_items_visible(False)

        self.graphics_view = None  # type: QGraphicsView
        self.__device = None  # type: VirtualDevice

        self.backend_handler = BackendHandler()

        self.ui.btnStop.setEnabled(False)
        self.ui.btnClear.setEnabled(False)
        self.ui.btnSave.setEnabled(False)

        self.start = 0

        self.bw_sr_are_locked = constants.SETTINGS.value("lock_bandwidth_sample_rate", True, bool)

        self.ui.spinBoxFreq.setValue(project_manager.device_conf["frequency"])
        self.ui.spinBoxSampleRate.setValue(project_manager.device_conf["sample_rate"])
        self.ui.spinBoxBandwidth.setValue(project_manager.device_conf["bandwidth"])
        self.ui.spinBoxGain.setValue(project_manager.device_conf["gain"])
        try:
            if_gain = project_manager.device_conf["if_gain"]
        except KeyError:
            if_gain = config.DEFAULT_IF_GAIN
        self.ui.spinBoxIFGain.setValue(if_gain)

        try:
            baseband_gain = project_manager.device_conf["baseband_gain"]
        except KeyError:
            baseband_gain = config.DEFAULT_BB_GAIN
        self.ui.spinBoxBasebandGain.setValue(baseband_gain)
github jopohl / urh / src / urh / util / ProjectManager.py View on Github external
def load_decodings(self):
        if self.project_file:
            return
        else:
            prefix = os.path.realpath(os.path.join(constants.SETTINGS.fileName(), ".."))

        fallback = [Encoding(["Non Return To Zero (NRZ)"]),

                    Encoding(["Non Return To Zero Inverted (NRZ-I)",
                              constants.DECODING_INVERT]),

                    Encoding(["Manchester I",
                              constants.DECODING_EDGE]),

                    Encoding(["Manchester II",
                              constants.DECODING_EDGE,
                              constants.DECODING_INVERT]),

                    Encoding(["Differential Manchester",
                              constants.DECODING_EDGE,
                              constants.DECODING_DIFFERENTIAL])