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
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])
import os import sys import datetime # allows us to run this from the project root sys.path.append(os.path.realpath('.')) from lvfs.models import Test, Firmware, Component, Protocol, ComponentShard from plugins.pecheck import Plugin if __name__ == '__main__': for _argv in sys.argv[1:]: print('Processing', _argv) plugin = Plugin('pecheck') _test = Test(plugin.id) _fw = Firmware() _fw.timestamp = datetime.datetime.utcnow() _md = Component() _md.protocol = Protocol('org.uefi.capsule') _shard = ComponentShard(name=os.path.basename(_argv)) try: with open(_argv, 'rb') as f: _shard.set_blob(f.read()) except IsADirectoryError as _: continue _md.shards.append(_shard) _fw.mds.append(_md) plugin.run_test_on_fw(_test, _fw) for attribute in _test.attributes: print(attribute) for cert in _shard.certificates: