Beispiel #1
0
    def __init__(self, is_strict=True):
        """ default public attributes """

        self.fw = Firmware()
        self.is_strict = is_strict
        self.enable_inf_parsing = True
        self.fwupd_min_version = '0.8.0'  # a guess, but everyone should have this
        self.version_formats = {}
        self.category_map = {'X-Device': 1}
        self.protocol_map = {}

        # strip out any unlisted files
        self.cabarchive_repacked = CabArchive()

        # private
        self._data_size = 0
        self.cabarchive_upload = None
        self._version_inf = None
Beispiel #2
0
        for md in fw.mds:
            if not md.blob:
                continue
            if self._require_test_for_md(md):
                _run_intelme_on_blob(self, test, md)
        db.session.commit()


# run with PYTHONPATH=. ./.env3/bin/python3 plugins/intelme/__init__.py ./firmware.bin
if __name__ == '__main__':
    import sys
    from lvfs.models import Firmware, Component, Protocol, Category

    plugin = Plugin()
    _test = Test('intelme')
    _fw = Firmware()
    _md = Component()
    _md.protocol = Protocol('org.uefi.capsule')
    _md.category = Category('X-ManagementEngine')
    _fw.mds.append(_md)

    with open(sys.argv[1], 'rb') as f:
        _md.blob = f.read()
    plugin.run_test_on_fw(_test, _fw)
    for attribute in _test.attributes:
        print(attribute)
    for _shard in _md.shards:
        if not _shard.checksums:
            continue
        print(_shard.info.guid, _shard.checksums[0])