mirror of
https://github.com/platomav/BIOSUtilities.git
synced 2025-05-13 22:54:46 -04:00
Added AMI PFAT RSA 3K signed blocks support
Added AMI PFAT nested detection at each file Added Award BIOS payload naming at each file Switched Panasonic BIOS LZNT1 external library Improved Panasonic LZNT1 detection and length Improved Dell PFS code structure and fixed bugs Improved code exception handling (raise, catch) Improved code definitions (PEP8, docs, types) Fixed some arguments missing from help screens
This commit is contained in:
parent
03ae0cf070
commit
d85a7f82dc
37 changed files with 2897 additions and 2174 deletions
|
@ -1,68 +1,84 @@
|
|||
#!/usr/bin/env python3
|
||||
#coding=utf-8
|
||||
#!/usr/bin/env python3 -B
|
||||
# coding=utf-8
|
||||
|
||||
"""
|
||||
Copyright (C) 2022 Plato Mavropoulos
|
||||
Copyright (C) 2022-2024 Plato Mavropoulos
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from common.text_ops import padder, to_string
|
||||
|
||||
# Get Python Version (tuple)
|
||||
|
||||
def get_py_ver():
|
||||
""" Get Python Version (tuple) """
|
||||
|
||||
return sys.version_info
|
||||
|
||||
# Get OS Platform (string)
|
||||
|
||||
def get_os_ver():
|
||||
""" Get OS Platform (string) """
|
||||
|
||||
sys_os = sys.platform
|
||||
|
||||
|
||||
is_win = sys_os == 'win32'
|
||||
|
||||
is_lnx = sys_os.startswith('linux') or sys_os == 'darwin' or sys_os.find('bsd') != -1
|
||||
|
||||
|
||||
return sys_os, is_win, is_win or is_lnx
|
||||
|
||||
# Check for --auto-exit|-e
|
||||
|
||||
def is_auto_exit():
|
||||
""" Check for --auto-exit|-e """
|
||||
|
||||
return bool('--auto-exit' in sys.argv or '-e' in sys.argv)
|
||||
|
||||
# Check Python Version
|
||||
|
||||
def check_sys_py():
|
||||
""" # Check Python Version """
|
||||
|
||||
sys_py = get_py_ver()
|
||||
|
||||
if sys_py < (3,10):
|
||||
|
||||
if sys_py < (3, 10):
|
||||
sys.stdout.write(f'\nError: Python >= 3.10 required, not {sys_py[0]}.{sys_py[1]}!')
|
||||
|
||||
|
||||
if not is_auto_exit():
|
||||
# noinspection PyUnresolvedReferences
|
||||
(raw_input if sys_py[0] <= 2 else input)('\nPress enter to exit') # pylint: disable=E0602
|
||||
|
||||
(raw_input if sys_py[0] <= 2 else input)('\nPress enter to exit') # pylint: disable=E0602
|
||||
|
||||
sys.exit(125)
|
||||
|
||||
# Check OS Platform
|
||||
|
||||
def check_sys_os():
|
||||
os_tag,os_win,os_sup = get_os_ver()
|
||||
|
||||
""" Check OS Platform """
|
||||
|
||||
os_tag, os_win, os_sup = get_os_ver()
|
||||
|
||||
if not os_sup:
|
||||
printer(f'Error: Unsupported platform "{os_tag}"!')
|
||||
|
||||
|
||||
if not is_auto_exit():
|
||||
input('\nPress enter to exit')
|
||||
|
||||
sys.exit(126)
|
||||
|
||||
|
||||
sys.exit(126)
|
||||
|
||||
# Fix Windows Unicode console redirection
|
||||
if os_win:
|
||||
# noinspection PyUnresolvedReferences
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
# Show message(s) while controlling padding, newline, pausing & separator
|
||||
def printer(in_message='', padd_count=0, new_line=True, pause=False, sep_char=' '):
|
||||
message = to_string(in_message, sep_char)
|
||||
|
||||
padding = padder(padd_count)
|
||||
|
||||
|
||||
def printer(message=None, padd=0, new_line=True, pause=False, sep_char=' '):
|
||||
""" Show message(s), controlling padding, newline, pausing & separator """
|
||||
|
||||
message_input = '' if message is None else message
|
||||
|
||||
string = to_string(message_input, sep_char)
|
||||
|
||||
padding = padder(padd)
|
||||
|
||||
newline = '\n' if new_line else ''
|
||||
|
||||
output = newline + padding + message
|
||||
|
||||
(input if pause and not is_auto_exit() else print)(output)
|
||||
|
||||
message_output = newline + padding + string
|
||||
|
||||
(input if pause and not is_auto_exit() else print)(message_output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue