MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / main

Function main

decode_pcapng.py:291–311  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

289
290
291def main(args):
292 [bus_id, dev] = args.bus_dev.split('.')
293 (img1_binary, img2_binary) = decode_pcapng(args.pcap, int(bus_id), int(dev), args.second_first)
294
295 check_assumptions(img1_binary, img2_binary)
296
297 print("Firmware version: {}".format(args.version))
298
299 print_image_info(img1_binary, 1)
300 print_image_info(img2_binary, 2)
301
302 if args.format == 'binary':
303 write_bin("{}-{}.bin".format(args.type, args.version), img1_binary, img2_binary)
304 elif args.format == 'flashimage':
305 write_flashimage("{}-{}.bin".format(args.type, args.version), img1_binary, img2_binary)
306 elif args.format == 'cyacd':
307 write_cyacd("{}-{}-1.cyacd".format(args.type, args.version), img1_binary)
308 write_cyacd("{}-{}-2.cyacd".format(args.type, args.version), img2_binary)
309 else:
310 print(f"Invalid Format {args.format}")
311 sys.exit(1)
312
313if __name__ == "__main__":
314 parser = argparse.ArgumentParser(description='Extract firmware from PCAPNG capture')

Callers 1

decode_pcapng.pyFile · 0.70

Calls 6

decode_pcapngFunction · 0.85
check_assumptionsFunction · 0.85
print_image_infoFunction · 0.85
write_binFunction · 0.85
write_flashimageFunction · 0.85
write_cyacdFunction · 0.85

Tested by

no test coverage detected