mirror of
https://github.com/86Box/bios-tools.git
synced 2026-02-24 02:18:21 -07:00
Improve Award signatures, fixes missing v4.20 (oops)
This commit is contained in:
@@ -903,7 +903,10 @@ class AwardAnalyzer(Analyzer):
|
||||
self._gigabyte_bif_pattern = re.compile(b'''\\$BIF[\\x00-\\xFF]{5}([\\x20-\\x7E]+)\\x00.([\\x20-\\x7E]+)\\x00''')
|
||||
self._gigabyte_eval_pattern = re.compile('''\\([a-zA-Z0-9]{1,8}\\) EVALUATION ROM - NOT FOR SALE$''')
|
||||
self._gigabyte_hefi_pattern = re.compile(b'''EFI CD/DVD Boot Option''')
|
||||
self._id_block_pattern = re.compile(b'''(?:(?:Award | Award|Phoeni)[\\x00-\\xFF]{8}| Award Softwar)IBM COMPATIBLE |[0-9]{2}/[0-9]{2}/[0-9]{4} {4}IBM COMPATIBLE [0-9]+ BIOS COPYRIGHT Award Software Inc\\.|Award SoftwareIBM COMPATIBLEftware Inc\\.''')
|
||||
self._id_block_pattern = re.compile( # whatever has "Phoenix" instead of "Award" was lost to time
|
||||
b'''(?:''' + util.rotate_pattern(b'Award Software Inc. ', 6) + b'''|''' + util.rotate_pattern(b'Phoenix Technologies, Ltd ', 6) + b''')[\\x00-\\xFF]{8}IBM COMPATIBLE|'''
|
||||
b'''[0-9]{2}/[0-9]{2}/[0-9]{4} {4}IBM COMPATIBLE (?:[0-9]+ )?BIOS COPYRIGHT Award Software Inc\\.'''
|
||||
)
|
||||
self._ignore_pattern = re.compile(b'search=f000,0,ffff,S,"|VGA BIOS Version (?:[^\r]+)\r\n(?:Copyright \\(c\\) (?:[^\r]+)\r\n)?Copyright \\(c\\) (?:NCR \\& )?Award', re.M)
|
||||
self._romby_date_pattern = re.compile(b'''N((?:[0-9]{2})/(?:[0-9]{2})/)([0-9]{2})([0-9]{2})(\\1\\3)''')
|
||||
self._string_date_pattern = re.compile('''(?:[0-9]{2})/(?:[0-9]{2})/([0-9]{2,4})-''')
|
||||
|
||||
@@ -238,6 +238,20 @@ def remove_extension(file_name):
|
||||
else:
|
||||
return file_name
|
||||
|
||||
def rotate_pattern(s, length):
|
||||
"""Generate a regex pattern to match all rotated permutations of s for length characters."""
|
||||
if type(s) == bytes:
|
||||
regex_sanitize = lambda x: x.replace(b'\\', b'\\\\').replace(b'.', b'\\.')
|
||||
else:
|
||||
regex_sanitize = lambda x: x.replace('\\', '\\\\').replace('.', '\\.')
|
||||
ret = []
|
||||
for offset in range(len(s)):
|
||||
this_offset = s[offset:offset + length]
|
||||
while len(this_offset) < length:
|
||||
this_offset += s[:length - len(this_offset)]
|
||||
ret.append(regex_sanitize(this_offset))
|
||||
return (type(s) == bytes and b'|' or '|').join(ret)
|
||||
|
||||
def try_makedirs(dir_path):
|
||||
"""Try to create dir_path. Returns True if successful, False if not."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user