def get_pp(firmware_path, workers): """Get a list of proprietary protocols in the UEFI firmware. The result is saved to .json file.""" if not workers: workers = 8 clear_all() get_efi_images(firmware_path) analyse_all('log_pp_guids.py', workers) get_log('get-pp', firmware_path)
def get_info(firmware_path, workers): """Analyze the entire UEFI firmware. The analysis result is saved to .json file.""" if not workers: workers = 8 clear_all() get_efi_images(firmware_path) analyse_all('log_all.py', workers) get_log('get-info', firmware_path)
def main(): click.echo(click.style('UEFI_RETool', fg='cyan')) click.echo( click.style('A tool for UEFI firmware analysis with IDA Pro', fg='cyan')) program = 'python ' + os.path.basename(__file__) parser = argparse.ArgumentParser(prog=program) parser.add_argument('firmware_path', type=str, help='path to UEFI firmware for analysis') parser.add_argument('--all', action='store_true', help='''analyse of all UEFI firmware modules and output of information to .{sep}log{sep}ida_log_all.md file (example: python analyse_fw_ida.py --all <firmware_path>)'''.format( sep=os.sep)) parser.add_argument('--pp_guids', action='store_true', help='''analyse all UEFI firmware modules and save a table with proprietry protocols to .{sep}log{sep}ida_pp_guids.md file (example: python analyse_fw_ida.py --pp_guids <firmware_path>)'''.format( sep=os.sep)) parser.add_argument('--get_efi_images', action='store_true', help='''get all executable images from UEFI firmware (images are stored in .{sep}modules directory, example: python analyse_fw_ida.py --get_efi_images <firmware_path>)'''. format(sep=os.sep)) args = parser.parse_args() if (args.all and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) analyse_all('log_all.py') print('Check .{sep}log{sep}ida_log_all.md file'.format(sep=os.sep)) clear_all() if (args.pp_guids and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) analyse_all('log_pp_guids.py') print('Check .{sep}log{sep}ida_pp_guids.md file'.format(sep=os.sep)) clear_all() if (args.get_efi_images and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) print('Check .{sep}modules directory'.format(sep=os.sep))
def main(): click.echo(click.style("UEFI_RETool", fg="cyan")) click.echo( click.style("A tool for UEFI firmware analysis with radare2", fg="cyan")) program = "python " + os.path.basename(__file__) parser = argparse.ArgumentParser(prog=program) parser.add_argument("firmware_path", type=str, help="path to UEFI firmware for analysis") parser.add_argument("--all", action="store_true", help="""analyse of all UEFI firmware modules and output of information to .{sep}log{sep}r2_log_all.md file (example: python analyse_fw_r2.py --all <firmware_path>)""".format( sep=os.sep)) parser.add_argument("--pp_guids", action="store_true", help="""analyse all UEFI firmware modules and save a table with proprietary protocols to .{sep}log{sep}r2_pp_guids.md file (example: python analyse_fw_r2.py --pp_guids <firmware_path>)""".format( sep=os.sep)) parser.add_argument("--pp_guids_num", action="store_true", help="""analyse all UEFI firmware modules and get number of proprietary protocols (example: python analyse_fw_r2.py --pp_guids_num <firmware_path>)""".format( sep=os.sep)) parser.add_argument("--get_efi_images", action="store_true", help="""get all executable images from UEFI firmware (images are stored in .{sep}modules directory, example: python analyse_fw_r2.py --get_efi_images <firmware_path>)""".format( sep=os.sep)) parser.add_argument("--update_edk2_guids", metavar="EDK2_PATH", type=str, help="""update list of GUIDs from EDK2 (example: git clone https://github.com/tianocore/edk2, python analyse_fw_r2.py --update_edk2_guids edk2)""") args = parser.parse_args() if (args.all and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) """ log all information """ analyse_all() clear_all() if (args.pp_guids and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) """ log proprietary protocols list """ get_pp_guids() clear_all() if (args.pp_guids_num and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) """ print number of proprietary protocols """ get_pp_guids_num() clear_all() if (args.get_efi_images and os.path.isfile(args.firmware_path)): clear_all() get_efi_images(args.firmware_path) print("Check .{sep}modules directory".format(sep=os.sep)) if (args.update_edk2_guids): edk2_path = args.update_edk2_guids if os.path.isdir(edk2_path): data_path = "conf" guids_path = "r2_uefi_re{sep}guids".format(sep=os.sep) update(edk2_path, data_path, guids_path)
def get_images(firmware_path): """Get executable images from UEFI firmware. Images are stored in "modules" directory.""" clear_all() get_efi_images(firmware_path) print('{res} check .{sep}modules directory'.format(res=DONE, sep=os.sep))
def get_images(firmware_path): """Get executable images from UEFI firmware. Images are stored in "modules" directory.""" clear_all() get_efi_images(firmware_path) print(f"{DONE} check .{os.sep}modules directory")