示例#1
0
def parse_project_file(file_path: str):
    import xml.etree.ElementTree as ET
    from urh.util.ProjectManager import ProjectManager

    result = defaultdict(lambda: None)
    if not file_path or not os.path.isfile(file_path):
        return result

    try:
        tree = ET.parse(file_path)
        root = tree.getroot()
    except Exception as e:
        logger.error("Could not read project file {}: {}".format(file_path, e))
        return result

    ProjectManager.read_device_conf_dict(root.find("device_conf"),
                                         target_dict=result)
    result["device"] = result["name"]

    modulators = ProjectManager.read_modulators_from_file(file_path)
    if len(modulators) > 0:
        modulator = modulators[0]
        result["carrier_frequency"] = modulator.carrier_freq_hz
        result["carrier_amplitude"] = modulator.carrier_amplitude
        result["carrier_phase"] = modulator.carrier_phase_deg
        result["parameter_zero"] = modulator.param_for_zero
        result["parameter_one"] = modulator.param_for_one
        result["modulation_type"] = modulator.modulation_type_str

    return result
示例#2
0
 def load_from_file(self, filename: str):
     try:
         self.modulators = ProjectManager.read_modulators_from_file(filename)
         self.table_model.protocol.from_xml_file(filename)
         self.refresh_pause_list()
         self.refresh_estimated_time()
         self.refresh_modulators()
         self.show_modulation_info()
         self.refresh_table()
         self.set_fuzzing_ui_status()
     except:
         logger.error("You done something wrong to the xml fuzzing profile.")
 def load_from_file(self, filename: str):
     try:
         self.modulators = ProjectManager.read_modulators_from_file(filename)
         self.table_model.protocol.from_xml_file(filename)
         self.refresh_pause_list()
         self.refresh_estimated_time()
         self.refresh_modulators()
         self.show_modulation_info()
         self.refresh_table()
         self.set_fuzzing_ui_status()
     except:
         logger.error("You done something wrong to the xml fuzzing profile.")