Award BIOS Module Extractor v1.2

Added 7zip parameter to automatically rename extracted files with the same name
This commit is contained in:
Plato Mavropoulos 2019-01-10 19:42:19 +02:00
parent 2bcd917314
commit bbfe1d3cc7

View file

@ -3,13 +3,13 @@
""" """
Award BIOS Extract Award BIOS Extract
Award BIOS Module Extractor Award BIOS Module Extractor
Copyright (C) 2018 Plato Mavropoulos Copyright (C) 2018-2019 Plato Mavropoulos
http://www.onicos.com/staff/iz/formats/lzh.html http://www.onicos.com/staff/iz/formats/lzh.html
https://ist.uwaterloo.ca/~schepers/formats/LHA.TXT https://ist.uwaterloo.ca/~schepers/formats/LHA.TXT
https://sites.google.com/site/pinczakko/pinczakko-s-guide-to-award-bios-reverse-engineering https://sites.google.com/site/pinczakko/pinczakko-s-guide-to-award-bios-reverse-engineering
""" """
print('Award BIOS Module Extractor v1.1\n') print('Award BIOS Module Extractor v1.2\n')
import os import os
import re import re
@ -41,6 +41,8 @@ for in_file in awd_images :
file_ext = os.path.splitext(file_path)[1] file_ext = os.path.splitext(file_path)[1]
match_lzh_list = [] match_lzh_list = []
print('\nFile: %s%s' % (file_name, file_ext))
with open(in_file, 'rb') as awd_img : buffer = awd_img.read() with open(in_file, 'rb') as awd_img : buffer = awd_img.read()
match_lzh_list += pat_lzh.finditer(buffer) # Detect LZH patterns match_lzh_list += pat_lzh.finditer(buffer) # Detect LZH patterns
@ -53,11 +55,11 @@ for in_file in awd_images :
with open('mod_temp.bin', 'wb') as lzh_img : lzh_img.write(mod_data) with open('mod_temp.bin', 'wb') as lzh_img : lzh_img.write(mod_data)
try : try :
decomp = subprocess.run(['7z', 'x', '-bso0', '-bse0', '-bsp0', '-o%s' % os.path.join(extr_path, file_name), 'mod_temp.bin']) # 7-Zip decomp = subprocess.run(['7z', 'x', '-aou', '-bso0', '-bse0', '-bsp0', '-o%s' % os.path.join(extr_path, file_name), 'mod_temp.bin']) # 7-Zip
except : except :
print('Error: Could not decompress LZH image at %s!' % file_name) print('Error: Could not decompress LZH image at %s!' % file_name)
print(' Make sure that "7z" executable exists!\n') print(' Make sure that "7z" executable exists!\n')
os.remove('mod_temp.bin') # Remove temporary LZH image os.remove('mod_temp.bin') # Remove temporary LZH image
input('Done!') input('\nDone!')