(args)
| 289 | |
| 290 | |
| 291 | def 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 | |
| 313 | if __name__ == "__main__": |
| 314 | parser = argparse.ArgumentParser(description='Extract firmware from PCAPNG capture') |
no test coverage detected