mirror of
https://github.com/platomav/BIOSUtilities.git
synced 2025-05-09 13:52:00 -04:00
Fujitsu UPC BIOS Extractor v1.0
Fujitsu UPC BIOS Extractor v1.0 Parses Fujitsu UPC images and extracts their Tiano compressed SPI/BIOS firmware component. The output comprises only a final firmware component which is directly usable by end users. Fujitsu SFX BIOS Extractor v2.1 Small rebranding
This commit is contained in:
parent
7c238274b7
commit
c05a1da05f
3 changed files with 174 additions and 10 deletions
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Fujitsu Package Extractor
|
||||
Fujitsu SFX Packager Extractor
|
||||
Copyright (C) 2019-2020 Plato Mavropoulos
|
||||
Fujitsu SFX Extractor
|
||||
Fujitsu SFX BIOS Extractor
|
||||
Copyright (C) 2019-2021 Plato Mavropoulos
|
||||
"""
|
||||
|
||||
print('Fujitsu SFX Packager Extractor v2.0')
|
||||
print('Fujitsu SFX BIOS Extractor v2.1')
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -75,7 +75,7 @@ for input_file in fjsfx_exec :
|
|||
os.remove('fjsfx_temp.cab') # Remove temporary CAB image
|
||||
|
||||
else :
|
||||
print('\n Error: No Fujitsu SFX Packager found!')
|
||||
print('\n Error: This is not a Fujitsu SFX BIOS image!')
|
||||
continue # Next input file
|
||||
|
||||
else :
|
108
Fujitsu UPC BIOS Extractor/Fujitsu_UPC_Extract.py
Normal file
108
Fujitsu UPC BIOS Extractor/Fujitsu_UPC_Extract.py
Normal file
|
@ -0,0 +1,108 @@
|
|||
#!/usr/bin/env python3
|
||||
#coding=utf-8
|
||||
|
||||
"""
|
||||
Fujitsu UPC Extract
|
||||
Fujitsu UPC BIOS Extractor
|
||||
Copyright (C) 2021 Plato Mavropoulos
|
||||
"""
|
||||
|
||||
title = 'Fujitsu UPC BIOS Extractor v1.0'
|
||||
|
||||
print('\n' + title) # Print script title
|
||||
|
||||
import sys
|
||||
|
||||
# Detect Python version
|
||||
sys_ver = sys.version_info
|
||||
if sys_ver < (3,7) :
|
||||
sys.stdout.write('\n\nError: Python >= 3.7 required, not %d.%d!\n' % (sys_ver[0], sys_ver[1]))
|
||||
(raw_input if sys_ver[0] <= 2 else input)('\nPress enter to exit') # pylint: disable=E0602
|
||||
sys.exit(1)
|
||||
|
||||
import os
|
||||
import ctypes
|
||||
import argparse
|
||||
import traceback
|
||||
import subprocess
|
||||
|
||||
# Pause after any unexpected Python exception
|
||||
# https://stackoverflow.com/a/781074 by Torsten Marek
|
||||
def show_exception_and_exit(exc_type, exc_value, tb) :
|
||||
if exc_type is KeyboardInterrupt :
|
||||
print('\n')
|
||||
else :
|
||||
print('\nError: %s crashed, please report the following:\n' % title)
|
||||
traceback.print_exception(exc_type, exc_value, tb)
|
||||
input('\nPress enter to exit')
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
# Set pause-able Python exception handler
|
||||
sys.excepthook = show_exception_and_exit
|
||||
|
||||
# Set console/shell window title
|
||||
user_os = sys.platform
|
||||
if user_os == 'win32' : ctypes.windll.kernel32.SetConsoleTitleW(title)
|
||||
elif user_os.startswith('linux') or user_os == 'darwin' or user_os.find('bsd') != -1 : sys.stdout.write('\x1b]2;' + title + '\x07')
|
||||
|
||||
# Set argparse Arguments
|
||||
upc_parser = argparse.ArgumentParser()
|
||||
upc_parser.add_argument('upc', type=argparse.FileType('r'), nargs='*')
|
||||
upc_parser.add_argument('-p', '--path', help='parse files within given folder', type=str)
|
||||
upc_params = upc_parser.parse_args()
|
||||
|
||||
# Get all files within path
|
||||
def get_files(path) :
|
||||
inputs = []
|
||||
|
||||
for root, _, files in os.walk(path):
|
||||
for name in files :
|
||||
inputs.append(os.path.join(root, name))
|
||||
|
||||
return inputs
|
||||
|
||||
if len(sys.argv) >= 2 :
|
||||
if bool(upc_params.path) :
|
||||
upc_exec = get_files(upc_params.path) # CLI with --path
|
||||
else :
|
||||
upc_exec = []
|
||||
for executable in upc_params.upc :
|
||||
upc_exec.append(executable.name) # Drag & Drop
|
||||
else :
|
||||
in_path = input('\nEnter the full folder path: ')
|
||||
upc_exec = get_files(in_path) # Direct Run
|
||||
|
||||
# Process each input Fujitsu UPC BIOS image
|
||||
for input_file in upc_exec :
|
||||
input_name,input_extension = os.path.splitext(os.path.basename(input_file))
|
||||
|
||||
print('\n*** %s%s' % (input_name, input_extension))
|
||||
|
||||
# Check if input file exists
|
||||
if not os.path.isfile(input_file) :
|
||||
print('\n Error: This input file does not exist!')
|
||||
continue # Next input file
|
||||
|
||||
with open(input_file, 'rb') as in_file : upc_data = in_file.read()
|
||||
|
||||
if input_extension.upper() != '.UPC' or int.from_bytes(upc_data[0x0:0x4], 'little') + 0x8 != len(upc_data) :
|
||||
print('\n Error: This is not a Fujitsu UPC BIOS image!')
|
||||
continue # Next input file
|
||||
|
||||
output_file = input_file[:-4] + '.bin' # Decompressed filename
|
||||
|
||||
# EFI/Tiano Decompression
|
||||
try :
|
||||
subprocess.run(['TianoCompress', '-d', input_file, '-o', output_file, '--uefi', '-q'], check = True, stdout = subprocess.DEVNULL)
|
||||
|
||||
if os.path.getsize(output_file) != int.from_bytes(upc_data[0x4:0x8], 'little') : raise Exception('EFI_DECOMP_ERROR')
|
||||
except :
|
||||
print('\n Error: Could not extract input file via TianoCompress!')
|
||||
input(' Make sure that "TianoCompress" executable exists!')
|
||||
|
||||
print('\n Extracted Fujitsu UPC BIOS image!')
|
||||
|
||||
input('\nDone!')
|
||||
|
||||
sys.exit(0)
|
66
README.md
66
README.md
|
@ -12,7 +12,8 @@
|
|||
* [**Portwell EFI BIOS Extractor**](#portwell-efi-bios-extractor)
|
||||
* [**Panasonic BIOS Update Extractor**](#panasonic-bios-update-extractor)
|
||||
* [**VAIO Packaging Manager Extractor**](#vaio-packaging-manager-extractor)
|
||||
* [**Fujitsu SFX Packager Extractor**](#fujitsu-sfx-packager-extractor)
|
||||
* [**Fujitsu UPC BIOS Extractor**](#fujitsu-upc-bios-extractor)
|
||||
* [**Fujitsu SFX BIOS Extractor**](#fujitsu-sfx-bios-extractor)
|
||||
* [**Award BIOS Module Extractor**](#award-bios-module-extractor)
|
||||
* [**Apple EFI Sucatalog Link Grabber**](#apple-efi-sucatalog-link-grabber)
|
||||
* [**Apple EFI File Renamer**](#apple-efi-file-renamer)
|
||||
|
@ -609,18 +610,73 @@ At dist folder you should find the final utility executable
|
|||
|
||||
Some Anti-Virus software may claim that the built/frozen/compiled executable contains viruses. Any such detections are false positives, usually of PyInstaller. You can switch to a better Anti-Virus software, report the false positive to their support, add the executable to the exclusions, build/freeze/compile yourself or use the Python script directly.
|
||||
|
||||
## **Fujitsu SFX Packager Extractor**
|
||||
## **Fujitsu UPC BIOS Extractor**
|
||||
|
||||

|
||||
|
||||
#### **Description**
|
||||
|
||||
Parses Fujitsu UPC images and extracts their Tiano compressed SPI/BIOS firmware component. The output comprises only a final firmware component which is directly usable by end users.
|
||||
|
||||
#### **Usage**
|
||||
|
||||
You can either Drag & Drop or manually enter the full path of a folder containing Portwell UEFI Unpacker EFI images. Optional arguments:
|
||||
|
||||
* -h or --help : show help message and exit
|
||||
* -p or --path : parse files within given folder
|
||||
|
||||
#### **Download**
|
||||
|
||||
An already built/frozen/compiled binary is provided by me for Windows only. Thus, **you don't need to manually build/freeze/compile it under Windows**. Instead, download the latest version from the [Releases](https://github.com/platomav/BIOSUtilities/releases) tab. To extract the already built/frozen/compiled archive, you need to use programs which support RAR5 compression. Note that you need to manually apply any prerequisites.
|
||||
|
||||
#### **Compatibility**
|
||||
|
||||
Should work at all Windows, Linux or macOS operating systems which have Python 3.7 support. Windows users who plan to use the already built/frozen/compiled binary must make sure that they have the latest Windows Updates installed which include all required "Universal C Runtime (CRT)" libraries.
|
||||
|
||||
#### **Prerequisites**
|
||||
|
||||
To run the python script or its built/frozen/compiled binary, you need to additionally have the following 3rd party tool at the same directory:
|
||||
|
||||
* [TianoCompress](https://github.com/tianocore/edk2/tree/master/BaseTools/Source/C/TianoCompress/) (i.e. [TianoCompress.exe](https://github.com/tianocore/edk2-BaseTools-win32/))
|
||||
|
||||
#### **Build/Freeze/Compile with PyInstaller**
|
||||
|
||||
PyInstaller can build/freeze/compile the utility at all three supported platforms, it is simple to run and gets updated often.
|
||||
|
||||
1. Make sure Python 3.7.0 or newer is installed:
|
||||
|
||||
> python --version
|
||||
|
||||
2. Use pip to install PyInstaller:
|
||||
|
||||
> pip3 install pyinstaller
|
||||
|
||||
3. Build/Freeze/Compile:
|
||||
|
||||
> pyinstaller --noupx --onefile Fujitsu_UPC_Extract.py
|
||||
|
||||
At dist folder you should find the final utility executable
|
||||
|
||||
#### **Anti-Virus False Positives**
|
||||
|
||||
Some Anti-Virus software may claim that the built/frozen/compiled executable contains viruses. Any such detections are false positives, usually of PyInstaller. You can switch to a better Anti-Virus software, report the false positive to their support, add the executable to the exclusions, build/freeze/compile yourself or use the Python script directly.
|
||||
|
||||
#### **Pictures**
|
||||
|
||||

|
||||
|
||||
## **Fujitsu SFX BIOS Extractor**
|
||||
|
||||

|
||||
<sub><sup>*Icon owned by FUJITSU*</sup></sub>
|
||||
|
||||
#### **Description**
|
||||
|
||||
Parses Fujitsu SFX Packager executables and extracts their contents. The utility automatically uses [Igor Pavlov's 7-Zip](https://www.7-zip.org/) tool in order to decompress the initially obfuscated Microsoft CAB compressed contents.
|
||||
Parses Fujitsu SFX BIOS executables and extracts their contents. The utility automatically uses [Igor Pavlov's 7-Zip](https://www.7-zip.org/) tool in order to decompress the initially obfuscated Microsoft CAB compressed contents.
|
||||
|
||||
#### **Usage**
|
||||
|
||||
You can either Drag & Drop or manually enter the full path of a folder containing Fujitsu SFX Packager executables.
|
||||
You can either Drag & Drop or manually enter the full path of a folder containing Fujitsu SFX BIOS executables.
|
||||
|
||||
#### **Download**
|
||||
|
||||
|
@ -650,7 +706,7 @@ PyInstaller can build/freeze/compile the utility at all three supported platform
|
|||
|
||||
3. Build/Freeze/Compile:
|
||||
|
||||
> pyinstaller --noupx --onefile Fujitsu_Package_Extract.py
|
||||
> pyinstaller --noupx --onefile Fujitsu_SFX_Extract.py
|
||||
|
||||
At dist folder you should find the final utility executable
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue