mirror of
https://github.com/platomav/BIOSUtilities.git
synced 2025-05-13 06:34:42 -04:00
Fixes at title/version display
This commit is contained in:
parent
d02de2ac57
commit
672b4b2321
4 changed files with 17 additions and 34 deletions
|
@ -7,7 +7,7 @@ AMI BIOS Guard Extractor
|
|||
Copyright (C) 2018-2022 Plato Mavropoulos
|
||||
"""
|
||||
|
||||
title = 'AMI BIOS Guard Extractor v4.0_a4'
|
||||
title = 'AMI BIOS Guard Extractor v4.0_a5'
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -23,7 +23,7 @@ from common.num_ops import get_ordinal
|
|||
from common.path_ops import safe_name
|
||||
from common.patterns import PAT_AMI_PFAT
|
||||
from common.struct_ops import get_struct, char, uint8_t, uint16_t, uint32_t
|
||||
from common.system import script_init, script_title, argparse_init, printer
|
||||
from common.system import script_init, argparse_init, printer
|
||||
|
||||
class AmiBiosGuardHeader(ctypes.LittleEndianStructure):
|
||||
_pack_ = 1
|
||||
|
@ -305,15 +305,12 @@ PFAT_BLK_HDR_LEN = ctypes.sizeof(IntelBiosGuardHeader)
|
|||
PFAT_BLK_S2K_LEN = ctypes.sizeof(IntelBiosGuardSignature2k)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Show script title
|
||||
script_title(title)
|
||||
|
||||
# Set argparse Arguments
|
||||
argparser = argparse_init()
|
||||
arguments = argparser.parse_args()
|
||||
|
||||
# Initialize script (must be after argparse)
|
||||
input_files,output_path,padding = script_init(arguments, 4)
|
||||
input_files,output_path,padding = script_init(title, arguments, 4)
|
||||
|
||||
for input_file in input_files:
|
||||
input_name = os.path.basename(input_file)
|
||||
|
|
|
@ -7,7 +7,7 @@ AMI UCP BIOS Extractor
|
|||
Copyright (C) 2021-2022 Plato Mavropoulos
|
||||
"""
|
||||
|
||||
title = 'AMI UCP BIOS Extractor v2.0_a5'
|
||||
title = 'AMI UCP BIOS Extractor v2.0_a6'
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -26,7 +26,7 @@ from common.efi_comp import efi_decompress, is_efi_compressed
|
|||
from common.path_ops import safe_name
|
||||
from common.patterns import PAT_AMI_UCP, PAT_INTEL_ENG
|
||||
from common.struct_ops import get_struct, char, uint8_t, uint16_t, uint32_t
|
||||
from common.system import script_init, script_title, argparse_init, printer
|
||||
from common.system import script_init, argparse_init, printer
|
||||
|
||||
from AMI_PFAT_Extract import get_ami_pfat, parse_pfat_file
|
||||
|
||||
|
@ -482,9 +482,6 @@ UAF_TAG_DICT = {
|
|||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Show script title
|
||||
script_title(title)
|
||||
|
||||
# Set argparse Arguments
|
||||
argparser = argparse_init()
|
||||
argparser.add_argument('-c', '--checksum', help='verify AMI UCP Checksums (slow)', action='store_true')
|
||||
|
@ -493,7 +490,7 @@ if __name__ == '__main__':
|
|||
is_checksum = arguments.checksum # Set Checksum verification optional argument
|
||||
|
||||
# Initialize script (must be after argparse)
|
||||
input_files,output_path,padding = script_init(arguments, 4)
|
||||
input_files,output_path,padding = script_init(title, arguments, 4)
|
||||
|
||||
for input_file in input_files:
|
||||
input_name = os.path.basename(input_file)
|
||||
|
@ -514,6 +511,4 @@ if __name__ == '__main__':
|
|||
|
||||
ucp_extract(main_uaf_bin, extract_path, main_uaf_tag, padding, is_checksum)
|
||||
|
||||
printer('Extracted AMI UCP BIOS executable!', padding)
|
||||
|
||||
printer('Done!', pause=True)
|
||||
|
|
|
@ -7,7 +7,7 @@ Dell PFS Update Extractor
|
|||
Copyright (C) 2018-2022 Plato Mavropoulos
|
||||
"""
|
||||
|
||||
title = 'Dell PFS Update Extractor v6.0_a3'
|
||||
title = 'Dell PFS Update Extractor v6.0_a4'
|
||||
|
||||
import os
|
||||
import io
|
||||
|
@ -25,7 +25,7 @@ from common.checksums import get_chk_8_xor
|
|||
from common.path_ops import safe_name
|
||||
from common.patterns import PAT_DELL_HDR, PAT_DELL_FTR, PAT_DELL_PKG
|
||||
from common.struct_ops import get_struct, char, uint8_t, uint16_t, uint32_t, uint64_t
|
||||
from common.system import script_init, script_title, argparse_init, printer
|
||||
from common.system import script_init, argparse_init, printer
|
||||
|
||||
from AMI_PFAT_Extract import IntelBiosGuardHeader, IntelBiosGuardSignature2k, parse_bg_script
|
||||
|
||||
|
@ -913,9 +913,6 @@ PFAT_HDR_LEN = ctypes.sizeof(IntelBiosGuardHeader)
|
|||
PFAT_SIG_LEN = ctypes.sizeof(IntelBiosGuardSignature2k)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Show script title
|
||||
script_title(title)
|
||||
|
||||
# Set argparse arguments
|
||||
argparser = argparse_init()
|
||||
argparser.add_argument('-a', '--advanced', help='extract signatures and metadata', action='store_true')
|
||||
|
@ -926,7 +923,7 @@ if __name__ == '__main__':
|
|||
is_structure = arguments.structure # Set Structure output mode optional argument
|
||||
|
||||
# Initialize script (must be after argparse)
|
||||
input_files,output_path,padding = script_init(arguments, 4)
|
||||
input_files,output_path,padding = script_init(title, arguments, 4)
|
||||
|
||||
for input_file in input_files:
|
||||
input_name = os.path.basename(input_file)
|
||||
|
@ -970,6 +967,4 @@ if __name__ == '__main__':
|
|||
# Call the PFS ZLIB Section Parser function
|
||||
pfs_section_parse(input_buffer, offset, extract_path, extract_name, 1, 1, False, padding, is_structure, is_advanced)
|
||||
|
||||
printer('Extracted Dell PFS Update image!', padding)
|
||||
|
||||
printer('Done!', pause=True)
|
||||
|
|
|
@ -66,18 +66,8 @@ def argparse_init():
|
|||
|
||||
return argparser
|
||||
|
||||
# Show Script Title
|
||||
def script_title(title):
|
||||
printer(title)
|
||||
|
||||
_,os_win,_ = get_os_ver()
|
||||
|
||||
# Set console/shell window title
|
||||
if os_win: ctypes.windll.kernel32.SetConsoleTitleW(title)
|
||||
else: sys.stdout.write('\x1b]2;' + title + '\x07')
|
||||
|
||||
# Initialize Script (must be after argparse)
|
||||
def script_init(arguments, padding=0):
|
||||
def script_init(title, arguments, padding=0):
|
||||
# Pretty Python exception handler
|
||||
sys.excepthook = nice_exc_handler
|
||||
|
||||
|
@ -87,9 +77,15 @@ def script_init(arguments, padding=0):
|
|||
# Check OS Platform
|
||||
check_sys_os()
|
||||
|
||||
# Show Script Title
|
||||
printer(title, new_line=False)
|
||||
|
||||
# Show Utility Version on demand
|
||||
if arguments.version: sys.exit(0)
|
||||
|
||||
# Set console/terminal window title (Windows only)
|
||||
if get_os_ver()[1]: ctypes.windll.kernel32.SetConsoleTitleW(title)
|
||||
|
||||
# Process input files and generate output path
|
||||
input_files,output_path = process_input_files(arguments, sys.argv)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue