Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
HikariCalyx authored May 5, 2021
1 parent 3f4e2a9 commit f9cf02e
Show file tree
Hide file tree
Showing 18 changed files with 631 additions and 83 deletions.
45 changes: 35 additions & 10 deletions Client/OSTRemote_Client/Localization/0409.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set h0006= -n [nb0_file], --nb0file=[nb0_file] : Specify the path of nb0 format
set h0007= -e, --erase-user-data : Erase user data during flashing procedure.
set h0008a= -s [skuid], --skuid=[skuid] : Change SKUID to desired value. Leave empty in
set h0008b= SKUID value for automatic SKUID definition.
set h0009= -f, --erase-frp : Erase FRP and bbox during flashing procedure.
set h0009= -f, --erase-frp : Erase FRP during flashing procedure.
set h0010a= -o, --override : Skip flashing security check. NOT RECOMMENDED
set h0010b= for inexperienced end-users.
set h0011= -t [otp_code], --token=[otp_code] : Specify OTP code given by HCTSW Care.
Expand All @@ -25,20 +25,24 @@ set h0015b= service bootloader, -e, -s an
set h0016= -D, --disable-fac-mode : Disable Factory Bar Code mode.
set h0017a= -H, --halt : Power off the phone. if specified with firmware
set h0017b= flashing, it will power off the phone after procedure.
set h0018a= -i1 [imei1], --imei1=[imei1] : Change IMEI1 to desired value. You must specify the
set h0018b= path of firmware file to use it.
set h0019a= -i2 [imei2], --imei2=[imei2] : Change IMEI2 to desired value. You must specify the
set h0020a= -m [meid], --meid=[meid] : Change MEID to desired value. You must specify the
set h0021a= -w [wlan_mac], --wlan=[wlan_mac] : Change WLAN MAC to desired value. You must specify the
set h0022a= -b [bt_addr], --bluetooth=[bt_addr] : Change Bluetooth Address to desired value. You must
set h0022b= specify the path of firmware file to use it.
set h0018a= -c, --no-checksum : The md4 and md5 partition will not be flashed during flash
set h0018b= with this parameter enabled.
set h0019a= -y, --stay : Stay at Fastboot Mode after flash. Phone will not be rebooted.
set h0019b= -H parameter will not function with this parameter enabled.
set h0020a= -u, --unlock-bootloader : Unlock the bootloader with given firmware.
set h0021a= -afu, --anti-force-update : Inject anti-force update code into firmware. Firmwares that
set h0021b= push updates via Google are unsupported.
set h0022= -F, --ftm : Enter FTM mode.
set h0023= -q [qlz_file], --qlzfile=[qlz_file] : Specify the path of QLZ format firmware file used by NOST.
set h0024= -k, --keep-firmware : When using nb0 or QLZ firmware file, keep unpacked firmware.
set hf0001=
set ex0001=Examples:
set ex0002a=Flash DRG-415C-0-00WW-B01.mlf into the phone:
set ex0002b=-m C:\path\to\FIHSW_DRG-415C-0-00WW-B01\DRG-415C-0-00WW-B01.mlf -e -s 600WW
set ex0003a=Flash E2M-0390-0-00WW-B02.nb0 into the phone with unlocked bootloader:
set ex0003b=-n C:\path\to\E2M-0390-0-00WW-B02.nb0 -e -S
set ex0004a=Erase FRP and format userdata under service bootloader:
set ex0004b=-a -e -f
set ex0004a=Flash T-virus-20201108.qlz into the phone with unlocked bootloader:
set ex0004b=-q C:\path\to\t-virus-20201108.qlz -e -S
set ex0005a=Flash HH6-350D-0-00A0-B01.mlf into the phone and power it off:
set ex0005b=-m C:\path\to\FIHSW_HH6-350D-0-00A0-B01\HH6-350D-0-00A0-B01.mlf -e -H
set override_notice=If you'd like to take your own risk, please add -o or --override parameter to skip safety check, or this tool will not work.
Expand Down Expand Up @@ -105,6 +109,27 @@ set t0058=ERROR: Outdated Fastboot Binary in environment variable detected. Dele
set t0059=You have requested FRP erase during flash, for that we need you to acknowledge something.
set t0060=Erasing FRP...
set t0061=Authentication Only Mode
set t0062=Emergency Download Mode
set t0063=Sending firehose...
set t0064=Writing rawprogram...
set t0065=Writing patch...
set t0066=Rebooting phone...
set t0067=ERROR: Cannot find any Qualcomm EDL Port.
set t0068=EDL Port is
set t0069=ERROR: This firmware is only meant for MediaTek model. Please use SP Flash Tool to operate manually.
set t0070=ERROR: An error has occurred during flash. Please do judgement from the failure reason given above.
set t0071=Current Battery Capacity is
set t0072=ERROR: Battery capacity might be insufficient for flashing.
set t0073=ERROR: You cannot skip authentication procedure for bootloader unlock.
set t0074=ERROR: Python 3 is not installed on this PC.
set t0075=HCTSW Care does not recommend you to utilize nb0 firmware. Initializing firmware file...
set t0076=HCTSW Care does not recommend you to utilize QLZ firmware. Initializing firmware file...
set t0077=HMDSW DEVICE DETECTED, PLEASE USE CODENAME "DK2"
set t0078=ERROR: HMDSW Device is unsupported by this tool.
set t0079a=No parameters defined. Please execute
set t0079b=-h" to show usage.
set t0080a=ERROR: Emergency Download failed. Please read
set t0080b=for troubleshooting.
set yes=Yes
set no=No
set z0001=========== PLEASE COPY CONTENT BELOW TO HCTSW CARE ==========
Expand Down
19 changes: 18 additions & 1 deletion Client/OSTRemote_Client/auth_utility/autoskuid.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@echo off

::Override_Enabled_read_FVER
if "%override%"=="1" goto overridereadfver

:defines
::Rules

::Brand0
Expand Down Expand Up @@ -38,6 +42,7 @@ if "%fver:~0,3%"=="CTL" set sku_brand=6
if "%fver:~0,3%"=="TAS" set sku_brand=6
if "%fver:~0,3%"=="NB1" set sku_brand=6
if "%fver:~0,3%"=="A1N" set sku_brand=6
if "%fver:~0,3%"=="PNX" set sku_brand=6
if "%fver:~0,3%"=="AOP" set sku_brand=6

::Carrier
Expand Down Expand Up @@ -69,4 +74,16 @@ if "%fver:~0,3%"=="EAG" set sku_locales=US
if "%fver:~0,3%"=="RHD" set sku_locales=US
if "%fver:~0,3%"=="HH6" set sku_locales=KR

set targetskuid=%sku_brand%%sku_carrier%%sku_locales%
set targetskuid=%sku_brand%%sku_carrier%%sku_locales%
goto eof

:overridereadfver
if exist "%fwfilepath%systeminfo.img" set fverfile="%fwfilepath%systeminfo.img"
if exist "%fwfilepath%fver" set fverfile="%fwfilepath%fver"
findstr MLF %fverfile% > %temp%\fver.txt
set /p fver= < %temp%\fver.txt
del %temp%\fver.txt
set fver=%fver:~4,19%
goto defines

:eof
38 changes: 27 additions & 11 deletions Client/OSTRemote_Client/auth_utility/call_auth.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
echo.
echo %t0055%
echo.
if "%auth_only%"=="1" goto authonly_mode
:authonly_mode
fb2 oem alive 2>nul

:Workaround for MTK devices
:Need to wait few seconds to ensure USB traffic become stable
if "%psn:~0,3%"=="NE1" set mtkdev=1
if "%psn:~0,3%"=="FRT" set mtkdev=1
if "%psn:~0,3%"=="ES2" set mtkdev=1
if "%psn:~0,3%"=="CO2" set mtkdev=1
if "%psn:~0,3%"=="PDA" set mtkdev=1
if "%psn:~0,3%"=="ROO" set mtkdev=1
if "%psn:~0,3%"=="ANT" set mtkdev=1
if "%psn:~0,3%"=="012" set mtkdev=1
if "%mtkdev%"=="1" timeout /t 2 /nobreak > nul

fb2 oem getBootloaderType 2>&1 | findstr getBootloaderType | findstr /V FAILED > %temp%\bldrtype.txt
set /p bldrtype=<%temp%\bldrtype.txt
For /f "tokens=1* delims= " %%A in ( %temp%\bldrtype.txt ) Do set bldrtype=%%B
del %temp%\bldrtype.txt
fb2 oem getSecurityVersion 2>&1 | findstr getSecurityVersion | findstr /V FAILED > %temp%\secver.txt
For /f "tokens=1* delims= " %%A in ( %temp%\secver.txt ) Do set secver=%%B
del %temp%\secver.txt

:sec1
fb2 oem getProjectCode 2>&1 | findstr FAILED > nul
if "%errorlevel%"=="0" set secver=0001

:returnX
if %bldrtype%==commercial if %secver%==0001 call sec1-verity.cmd
if %bldrtype%==commercial if %secver%==0004 call sec4-veracity.cmd
Expand All @@ -11,14 +37,4 @@ if %bldrtype%==service if %secver%==0004 call sec4-encuid.cmd
if %bldrtype%==service if %secver%==0008 call sec8-encuid.cmd
goto eof

:authonly_mode
fb2 oem getBootloaderType 2>&1 | findstr getBootloaderType > %temp%\bldrtype.txt
set /p bldrtype=<%temp%\bldrtype.txt
For /f "tokens=1* delims= " %%A in ( %temp%\bldrtype.txt ) Do set bldrtype=%%B
del %temp%\bldrtype.txt
fb2 oem getSecurityVersion 2>&1 | findstr getSecurityVersion > %temp%\secver.txt
For /f "tokens=1* delims= " %%A in ( %temp%\secver.txt ) Do set secver=%%B
del %temp%\secver.txt
goto returnX

:eof
4 changes: 3 additions & 1 deletion Client/OSTRemote_Client/auth_utility/fbdirect.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ echo.
fastboot !target!
echo.
if "!target:~0,6!"=="reboot" timeout /t 5 /nobreak
fb2 oem alive 2>nul
) else (
fastboot !target! 2>nul
if "!target:~0,6!"=="reboot" timeout /t 5 /nobreak >nul
)
fb2 oem alive 2>nul
)
7 changes: 7 additions & 0 deletions Client/OSTRemote_Client/auth_utility/fberase.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
if "%service_auth%"=="0" goto skipauth
:precaution_for_mtk_device
fb2 oem getBootloaderType 2>&1 | findstr service > nul
if "%errorlevel%"=="0" fb2 oem getRootStatus 2>&1 | findstr Disable > nul
if "%errorlevel%"=="0" call call_auth.cmd
:skipauth

echo %t0038% "fastboot erase !target!"...
if %verbose_mode%==1 (
echo.
Expand Down
21 changes: 20 additions & 1 deletion Client/OSTRemote_Client/auth_utility/fbflash.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
if "%service_auth%"=="0" goto skipauth
:precaution_for_mtk_device
fb2 oem getBootloaderType 2>&1 | findstr service > nul
if "%errorlevel%"=="0" fb2 oem getRootStatus 2>&1 | findstr Disable > nul
if "%errorlevel%"=="0" call call_auth.cmd
:skipauth

if "!target:~0,3!"=="md4" (
if "%resultverify%"=="0" goto eof
echo %t0049%
goto noechox
)
if "!target:~0,3!"=="md5" (
if "%resultverify%"=="0" goto eof
echo %t0049%
goto noechox
)
echo %t0038% "fastboot flash !target!"...
:noechox
if %verbose_mode%==1 (
echo.
if "%msm8937value%"=="1" (
if "!target:~0,6!"=="system" (
fastboot erase !target!
)
)
fastboot flash !target!
if "!errorlevel!"=="1" (
set errorflash=1
Expand All @@ -18,10 +32,15 @@ goto eof
)
echo.
) else (
if "%msm8937value%"=="1" (
if "!target:~0,6!"=="system" (
fastboot erase !target! 2>nul
)
)
fastboot flash !target! 2>&1 | findstr FAILED
if "!errorlevel!"=="0" (
set errorflash=1
echo errorflash>%temp%\eflash.txt
echo errorflash>%temp%\eflash2.txt
goto eof
)
)
Expand Down
23 changes: 22 additions & 1 deletion Client/OSTRemote_Client/auth_utility/fbformat.cmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
if "%service_auth%"=="0" goto skipauth
:precaution_for_mtk_device
fb2 oem getBootloaderType 2>&1 | findstr service > nul
if "%errorlevel%"=="0" fb2 oem getRootStatus 2>&1 | findstr Disable > nul
if "%errorlevel%"=="0" call call_auth.cmd
:skipauth

if "!target:~0,8!"=="userdata" (
echo %t0038% "fastboot -w"...
if %verbose_mode%==1 (
echo.
fastboot -w
echo.
) else (
fastboot -w 1>nul 2>nul
)
goto eof
)

echo %t0038% "fastboot format !target!"...
if %verbose_mode%==1 (
echo.
fastboot format !target!
echo.
) else (
fastboot format !target! 1>nul 2>nul
)
)

:eof
7 changes: 7 additions & 0 deletions Client/OSTRemote_Client/auth_utility/hmdsw_check.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fb2 oem getsecurityversion 2>&1 | findstr FAILED > nul
if not %errorlevel%==0 (
echo === %t0077% ===
echo.
echo hmdsw > %temp%\hmdsw_flag
)
:eof
49 changes: 39 additions & 10 deletions Client/OSTRemote_Client/auth_utility/mlf-parser.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
setlocal enabledelayedexpansion
set errorflash=0
set PATH=%PATH%;%~dp0\bin
findstr "^OPTION" "%mlffile%" | sed "s/OPTION = //g" > %temp%\1.txt
findstr "^BOOT_NAME" "%mlffile%" | sed "s/BOOT_NAME = //g" > %temp%\2.txt
findstr "^IMAGE_FILE" "%mlffile%" | sed "s/IMAGE_FILE = //g" > %temp%\3.txt
echo %fwfilepath%| sed "s/ /\" \"/g" > %temp%\spacepath.txt
set /p quotefwfp=<%temp%\spacepath.txt
if "%nb0mode%"=="1" set mlffile=%quotefwfp%%mlffile%
if "%qlzmode%"=="1" set mlffile=%quotefwfp%%mlffile%
findstr "^OPTION" %mlffile% | sed "s/OPTION = //g" > %temp%\1.txt
findstr "^BOOT_NAME" %mlffile% | sed "s/BOOT_NAME = //g" > %temp%\2.txt
findstr "^IMAGE_FILE" %mlffile% | sed "s/IMAGE_FILE = //g" > %temp%\3.txt
awk "NR==FNR{a[NR]=$0;nr=NR;}NR>FNR{print a[NR-nr]\",\"$0}" %temp%\1.txt %temp%\2.txt > %temp%\2x.txt
awk "NR==FNR{a[NR]=$0;nr=NR;}NR>FNR{print a[NR-nr]\" \"$0}" %temp%\2x.txt %temp%\3.txt > %temp%\3x.txt
sed -i "s/\"//g" %temp%\3x.txt
Expand All @@ -18,11 +22,32 @@ findstr zip %temp%\5.txt > %temp%\servicebootloaderzip.txt
del %temp%\5.txt
if exist %temp%\extractedsbl.txt del %temp%\extractedsbl.txt
for /f "tokens=1* delims= " %%i in ( %temp%\servicebootloaderzip.txt ) do zipinfo -1 "%fwfilepath%%%i" >> %temp%\extractedsbl.txt
for /f "tokens=1* delims= " %%i in ( %temp%\servicebootloaderzip.txt ) do unzip -q -P WLBGFIH123 -o "%fwfilepath%%%i" -d %fwfilepath%
for /f "tokens=1* delims= " %%i in ( %temp%\servicebootloaderzip.txt ) do unzip -q -P WLBGFIH123 -o "%fwfilepath%%%i" -d %quotefwfp%
if exist %temp%\replacement.txt del %temp%\replacement.txt
awk "NR==FNR{a[NR]=$0;nr=NR;}NR>FNR{print a[NR-nr]\",\"$0}" %temp%\servicebootloaderzip.txt %temp%\extractedsbl.txt | sed "s/ ,/\//g" > %temp%\replacement.txt
for /f %%i in ( %temp%\replacement.txt ) do bin\sed -i "s/%%i/g" %temp%\servicebootloader.txt
for /f %%i in ( %temp%\replacement.txt ) do bin\sed -i "s/%%i/g" %temp%\regular.txt
for /f %%i in ( %temp%\replacement.txt ) do sed -i "s/%%i/g" %temp%\servicebootloader.txt
:workaround_for_msm8937_device
if "%msm8937value%"=="1" (
findstr /V abootbak %temp%\servicebootloader.txt > %temp%\sbl2.txt
del %temp%\servicebootloader.txt
>nul move %temp%\sbl2.txt %temp%\servicebootloader.txt
)
for /f %%i in ( %temp%\replacement.txt ) do sed -i "s/%%i/g" %temp%\regular.txt
if "%afu%"=="1" (
>%temp%\99.txt set /p=99<nul
if exist %quotefwfp%\systeminfo.img (
copy %quotefwfp%\systeminfo.img %quotefwfp%\systeminfo_b99.img
2>nul dd if=%temp%\99.txt of=%quotefwfp%\systeminfo_b99.img bs=1 seek=21
sed -i "s/systeminfo.img/systeminfo_b99.img/g" %temp%\regular.txt
del %temp%\99.txt
)
if exist %quotefwfp%\fver (
copy %quotefwfp%\fver %quotefwfp%\fver
2>nul dd if=%temp%\99.txt of=%quotefwfp%\fver bs=1 seek=21
sed -i "s/fver/fver_b99/g" %temp%\regular.txt
del %temp%\99.txt
)
)
del %temp%\servicebootloaderzip.txt
del %temp%\replacement.txt
del %temp%\extractedsbl.txt
Expand All @@ -39,7 +64,7 @@ del %temp%\bldrtype.txt
fb2 oem getSecurityVersion 2>&1 | findstr getSecurityVersion > %temp%\secver.txt
For /f "tokens=1* delims= " %%A in ( %temp%\secver.txt ) Do set secver=%%B
del %temp%\secver.txt
cd /d %fwfilepath%
cd /d "%fwfilepath%"
if %bldrtype%==service goto directflash
if "%service_auth%"=="1" call call_auth.cmd
for /f "tokens=1* delims=," %%a in ( %temp%\servicebootloader.txt ) do (
Expand All @@ -55,6 +80,7 @@ echo.
) else (
fastboot reboot-bootloader 2>nul
)
fb2 oem alive 2>nul
timeout /t 2 /nobreak > nul
echo %t0040%
fb2 oem getBootloaderType 2>&1 | findstr getBootloaderType > %temp%\bldrtype.txt
Expand All @@ -70,12 +96,12 @@ echo ,>>%temp%\regular.txt
for /f "tokens=1* delims=," %%a in ( %temp%\regular.txt ) do (
if "!errorflash!"=="1" goto eof
set target=%%b
if %%a==0x1000000000000000 if %service_auth%==1 call fbdirect.cmd
if %%a==0x1000000000000000 call fbdirect.cmd
if %%a==0x1000000000000004 if %service_auth%==1 call call_auth.cmd
if %%a==0x1000000000000044 if %service_auth%==1 call call_auth.cmd
if %%a==0x2 call fbflash.cmd
if %%a==0x4 call fberase.cmd
if %%a==0x40 call fberase.cmd
if %%a==0x40 call fbflash.cmd
if %%a==0x1000 call fbflash.cmd
if %%a==0x40000 call fbflash.cmd
if %%a==0x4000 (
Expand All @@ -88,11 +114,14 @@ call fbflash.cmd
)
)
if %%a==0x8 if %erase%==1 (
if "%msm8937value%"=="1" (
call fberase.cmd
) else (
if "!target:~0,8!"=="userdata" (
call fbformat.cmd
) else (
call fberase.cmd
) )
) ) )
if %%a==0x100000 call fbflash.cmd
if %%a==0x200000 call fbflash.cmd
if %%a==0x400000 call fbflash.cmd
Expand Down
Loading

0 comments on commit f9cf02e

Please sign in to comment.