This commit is contained in:
LukeeGD 2020-03-31 13:46:59 +08:00
parent 7e090ff1d0
commit 9f1411aa5d
2 changed files with 179 additions and 126 deletions

View File

@ -1,5 +1,55 @@
#!/bin/bash
# 8.4.1 iBSS IV and Keys
IV_k93=781b9672a86ba1b41f8b7fa0af714c94 #iPad2,1
Key_k93=bbd7bf676dbcc6ba93c76d496b7af39ae7772eaaad2ec9fb71dc1fd004827784
IV_k94=883c92ed915e4d2481570a062583495b #iPad2,2
Key_k94=ccfadf3732904885d38f963cce035d7e03b387b67212d526503c85773b58e52f
IV_k95=460116385cca6d5596221c58ae122669 #iPad2,3
Key_k95=7852f1fd93d9d49ebea44021081e8f1dffa336d0d3e9517374f8be451dd92eb7
IV_k93a=976aa656929ac699fff36715de96876d #iPad2,4
Key_k93a=5fe5c47b5620c2b40b1ca2bd1764a92d568901a24e1caf8faf0cf0f84ae11b4e
IV_p105=b21abc8689b0dea8f6e613f9f970e241 #iPad2,5
Key_p105=b9ed63e4a31f5d9d4d7dddc527e65fd31d1ea48c70204e6b44551c1e6dfc52b5
IV_p106=56231fd62c6296ed0c8c411bcef602e0 #iPad2,6
Key_p106=cdb2142489e5e936fa8f3540bd036f62ed0f27ddb6fec96b9fbfec5a65bc5f17
IV_p107=fa39c596b6569e572d90f0820e4e4357 #iPad2,7
Key_p107=34b359fcc729a0f0d2853e786a78b245ed36a9212c8296aaab95dc0401cf07de
IV_j1=c3ea87ed43788dfc3e268abdf1af27dd #iPad3,1
Key_j1=cd3dd7eee07b9ce8b180d1526632cf86dc7fef7d52352d06af354598ab9cf2ef
IV_j2=32fcd912cb9a472ef2a6db72596ae01c #iPad3,2
Key_j2=076720d5a07e8011bdda6f6eafaf4845b40a441615cd1d7c1a9cca438ce7db17
IV_j2a=e6b041970cd611c8a1561a4c210bc476 #iPad3,3
Key_j2a=aec6a888d45bd26106ac620d7d4ec0c160ab80276deedc1b50ce8f5d99dcc9af
IV_p101=a5892a58c90b6d3fb0e0b20db95070d7 #iPad3,4
Key_p101=75612774968009e3f85545ac0088d0d0bb9cb4e2c2970e8f88489be0b9dfe103
IV_p102=fba6d9aaec7237891c80390e6ffa88bf #iPad3,5
Key_p102=92909dca9bfdb9193131f9ad9b628b1a4971b1cbab52c0ddd114a6253fad96c0
IV_p103=1d99e780d96c32a25ca7e4b1c7fe14c0 #iPad3,6
Key_p103=4e2c14927693d61e1da375e340061521c9376007163f6ab55afbe1a03b901fd3
IV_n94=147cdef921ed14a5c10631c5e6e02d1e #iPhone4,1
Key_n94=6ea1eb62a9f403ee212c1f6b3039df093963b46739c6093407190fe3d750c69c
IV_n41=bd0c8b039a819604a30f0d39adf88572 #iPhone5,1
Key_n41=baf05fe0282f78c18c2e3842be4f9021919d586b55594281f5b5abd0f6e61495
IV_n42=fdad2b7a35384fa2ffc7221213ca1082 #iPhone5,2
Key_n42=74cd68729b800a20b1f8e8a3cb5517024a09f074eaa05b099db530fb5783275e
IV_n48=dbecd5f265e031835584e6bfbdb4c47f #iPhone5,3
Key_n48=248f86d983626b75d26718fa52732eca64466ab73df048f278e034a272041f7e
IV_n49=039241f2b0212bb7c7b62ab4deec263f #iPhone5,4
Key_n49=d0b49d366469ae2b1580d7d31b1bcf783d835e4fac13cfe9f9a160fa95010ac4
IV_n78=e0175b03bc29817adc312638884e0898 #iPod5,1
Key_n78=0a0e0aedc8171669c9af6a229930a395959df55dcd8a3ee1fe0f4c009007df3c
# 6.1.3 iBSS IV and Keys
IV_k93_613=b69f753dccd09c9b98d345ec73bbf044 #iPad2,1
Key_k93_613=6e4cce9ea6f2ec346cba0b279beab1b43e44a0680f1fde789a00f66a1e68ffab
IV_k94_613=bc3c9f168d7fb86aa219b7ad8039584b #iPad2,2
Key_k94_613=b1bd1dc5e6076054392be054d50711ae70e8fcf31a47899fb90ab0ff3111b687
IV_k95_613=56f964ee19bfd31f06e43e9d8fe93902 #iPad2,3
Key_k95_613=0bb841b8f1922ae73d85ed9ed0d7a3583a10af909787857c15af2691b39bba30
IV_n94_613=d3fe01e99bd0967e80dccfc0739f93d5 #iPhone4,1
Key_n94_613=35343d5139e0313c81ee59dbae292da26e739ed75b3da5db9da7d4d26046498c
devices=(iPhone4,1 iPhone5,1 iPhone5,2
iPad2,1 iPad2,2 iPad2,3 iPad2,4 iPad2,5 iPad2,6 iPad2,7
iPad3,1 iPad3,2 iPad3,3 iPad3,4 iPad3,5 iPad3,6 iPod5,1
@ -12,27 +62,94 @@ elif [[ $OSTYPE == "darwin"* ]]; then
platform='macos'
fi
function HWModel {
if [ $ProductType == iPad2,1 ]; then
HWModelLower=k93
elif [ $ProductType == iPad2,2 ]; then
HWModelLower=k94
elif [ $ProductType == iPad2,3 ]; then
HWModelLower=k95
elif [ $ProductType == iPad2,4 ]; then
HWModelLower=k93a
elif [ $ProductType == iPad2,5 ]; then
HWModelLower=p105
elif [ $ProductType == iPad2,6 ]; then
HWModelLower=p106
elif [ $ProductType == iPad2,7 ]; then
HWModelLower=p107
elif [ $ProductType == iPad3,1 ]; then
HWModelLower=j1
elif [ $ProductType == iPad3,2 ]; then
HWModelLower=j2
elif [ $ProductType == iPad3,3 ]; then
HWModelLower=j2a
elif [ $ProductType == iPad3,4 ]; then
HWModelLower=p101
elif [ $ProductType == iPad3,5 ]; then
HWModelLower=p102
elif [ $ProductType == iPad3,6 ]; then
HWModelLower=p103
elif [ $ProductType == iPhone4,1 ]; then
HWModelLower=n94
elif [ $ProductType == iPhone5,1 ]; then
HWModelLower=n41
elif [ $ProductType == iPhone5,2 ]; then
HWModelLower=n42
elif [ $ProductType == iPhone5,3 ]; then
HWModelLower=n48
elif [ $ProductType == iPhone5,4 ]; then
HWModelLower=n49
elif [ $ProductType == iPod5,1 ]; then
HWModelLower=n78
fi
}
echo "32bit-OTA-Downgrader BuildManifest and Firmware Keys Saver"
echo "- by LukeZGD"
for ProductType in "${devices[@]}"
do
dllink=$(curl -I -Ls -o /dev/null -w %{url_effective} https://api.ipsw.me/v4/ota/download/${ProductType}/12H321?prerequisite=12H143)
tools/pzb_$platform -g AssetData/boot/BuildManifest.plist -o BuildManifest_${ProductType}_8.4.1.plist $dllink
mkdir -p firmware/$ProductType/12H321
curl -L https://firmware-keys.ipsw.me/firmware/$ProductType/12H321 -o firmware/$ProductType/12H321/index.html
#dllink=$(curl -I -Ls -o /dev/null -w %{url_effective} https://api.ipsw.me/v4/ota/download/${ProductType}/12H321?prerequisite=12H143)
#tools/pzb_$platform -g AssetData/boot/BuildManifest.plist -o BuildManifest_${ProductType}_8.4.1.plist $dllink
#curl -L https://firmware-keys.ipsw.me/firmware/$ProductType/12H321 -o firmware/$ProductType/12H321/index.html
curl -L https://api.ipsw.me/v2.1/${ProductType}/12H321/sha1sum -o firmware/$ProductType/12H321/sha1sum
curl -L https://api.ipsw.me/v2.1/${ProductType}/12H321/url -o firmware/$ProductType/12H321/url
HWModel
IV=IV_$HWModelLower
Key=Key_$HWModelLower
echo ${!Key} | tee firmware/$ProductType/12H321/key
echo ${!IV} | tee firmware/$ProductType/12H321/iv
done
for ProductType in "${devices613[@]}"
do
dllink=$(curl -I -Ls -o /dev/null -w %{url_effective} https://api.ipsw.me/v4/ota/download/${ProductType}/10B329?prerequisite=10B146)
tools/pzb_$platform -g AssetData/boot/BuildManifest.plist -o BuildManifest_${ProductType}_6.1.3.plist $dllink
mkdir -p firmware/$ProductType/10B329
curl -L https://firmware-keys.ipsw.me/firmware/$ProductType/10B329 -o firmware/$ProductType/10B329/index.html
#dllink=$(curl -I -Ls -o /dev/null -w %{url_effective} https://api.ipsw.me/v4/ota/download/${ProductType}/10B329?prerequisite=10B146)
#tools/pzb_$platform -g AssetData/boot/BuildManifest.plist -o BuildManifest_${ProductType}_6.1.3.plist $dllink
#curl -L https://firmware-keys.ipsw.me/firmware/$ProductType/10B329 -o firmware/$ProductType/10B329/index.html
curl -L https://api.ipsw.me/v2.1/${ProductType}/10B329/sha1sum -o firmware/$ProductType/10B329/sha1sum
curl -L https://api.ipsw.me/v2.1/${ProductType}/10B329/url -o firmware/$ProductType/10B329/url
HWModel
IV=IV_${HWModelLower}_613
Key=Key_${HWModelLower}_613
echo ${!Key} | tee firmware/$ProductType/10B329/key
echo ${!IV} | tee firmware/$ProductType/10B329/iv
done
mkdir -p firmware/iPad2,2/13G36
curl -L https://api.ipsw.me/v2.1/iPad2,2/13G36/url -o firmware/iPad2,2/13G36/url
for ProductType in iPad2,3 iPad2,6 iPad2,7 iPhone4,1
do
mkdir -p firmware/$ProductType/13G37
curl -L https://api.ipsw.me/v2.1/${ProductType}/13G37/url -o firmware/$ProductType/13G37/url
done
for ProductType in iPhone5,1 iPhone5,2 iPad3,5 iPad3,6
do
mkdir -p firmware/$ProductType/14G61
curl -L https://api.ipsw.me/v2.1/${ProductType}/14G61/url -o firmware/$ProductType/14G61/url
done
mkdir manifests

View File

@ -1,83 +1,22 @@
#!/bin/bash
# 8.4.1 iBSS IV and Keys
iv_k93=781b9672a86ba1b41f8b7fa0af714c94 #iPad2,1
key_k93=bbd7bf676dbcc6ba93c76d496b7af39ae7772eaaad2ec9fb71dc1fd004827784
iv_k94=883c92ed915e4d2481570a062583495b #iPad2,2
key_k94=ccfadf3732904885d38f963cce035d7e03b387b67212d526503c85773b58e52f
iv_k95=460116385cca6d5596221c58ae122669 #iPad2,3
key_k95=7852f1fd93d9d49ebea44021081e8f1dffa336d0d3e9517374f8be451dd92eb7
iv_k93a=976aa656929ac699fff36715de96876d #iPad2,4
key_k93a=5fe5c47b5620c2b40b1ca2bd1764a92d568901a24e1caf8faf0cf0f84ae11b4e
iv_p105=b21abc8689b0dea8f6e613f9f970e241 #iPad2,5
key_p105=b9ed63e4a31f5d9d4d7dddc527e65fd31d1ea48c70204e6b44551c1e6dfc52b5
iv_p106=56231fd62c6296ed0c8c411bcef602e0 #iPad2,6
key_p106=cdb2142489e5e936fa8f3540bd036f62ed0f27ddb6fec96b9fbfec5a65bc5f17
iv_p107=fa39c596b6569e572d90f0820e4e4357 #iPad2,7
key_p107=34b359fcc729a0f0d2853e786a78b245ed36a9212c8296aaab95dc0401cf07de
iv_j1=c3ea87ed43788dfc3e268abdf1af27dd #iPad3,1
key_j1=cd3dd7eee07b9ce8b180d1526632cf86dc7fef7d52352d06af354598ab9cf2ef
iv_j2=32fcd912cb9a472ef2a6db72596ae01c #iPad3,2
key_j2=076720d5a07e8011bdda6f6eafaf4845b40a441615cd1d7c1a9cca438ce7db17
iv_j2a=e6b041970cd611c8a1561a4c210bc476 #iPad3,3
key_j2a=aec6a888d45bd26106ac620d7d4ec0c160ab80276deedc1b50ce8f5d99dcc9af
iv_p101=a5892a58c90b6d3fb0e0b20db95070d7 #iPad3,4
key_p101=75612774968009e3f85545ac0088d0d0bb9cb4e2c2970e8f88489be0b9dfe103
iv_p102=fba6d9aaec7237891c80390e6ffa88bf #iPad3,5
key_p102=92909dca9bfdb9193131f9ad9b628b1a4971b1cbab52c0ddd114a6253fad96c0
iv_p103=1d99e780d96c32a25ca7e4b1c7fe14c0 #iPad3,6
key_p103=4e2c14927693d61e1da375e340061521c9376007163f6ab55afbe1a03b901fd3
iv_n94=147cdef921ed14a5c10631c5e6e02d1e #iPhone4,1
key_n94=6ea1eb62a9f403ee212c1f6b3039df093963b46739c6093407190fe3d750c69c
iv_n41=bd0c8b039a819604a30f0d39adf88572 #iPhone5,1
key_n41=baf05fe0282f78c18c2e3842be4f9021919d586b55594281f5b5abd0f6e61495
iv_n42=fdad2b7a35384fa2ffc7221213ca1082 #iPhone5,2
key_n42=74cd68729b800a20b1f8e8a3cb5517024a09f074eaa05b099db530fb5783275e
iv_n48=dbecd5f265e031835584e6bfbdb4c47f #iPhone5,3
key_n48=248f86d983626b75d26718fa52732eca64466ab73df048f278e034a272041f7e
iv_n49=039241f2b0212bb7c7b62ab4deec263f #iPhone5,4
key_n49=d0b49d366469ae2b1580d7d31b1bcf783d835e4fac13cfe9f9a160fa95010ac4
iv_n78=e0175b03bc29817adc312638884e0898 #iPod5,1
key_n78=0a0e0aedc8171669c9af6a229930a395959df55dcd8a3ee1fe0f4c009007df3c
# 6.1.3 iBSS IV and Keys
iv_k93_613=b69f753dccd09c9b98d345ec73bbf044 #iPad2,1
key_k93_613=6e4cce9ea6f2ec346cba0b279beab1b43e44a0680f1fde789a00f66a1e68ffab
iv_k94_613=bc3c9f168d7fb86aa219b7ad8039584b #iPad2,2
key_k94_613=b1bd1dc5e6076054392be054d50711ae70e8fcf31a47899fb90ab0ff3111b687
iv_k95_613=56f964ee19bfd31f06e43e9d8fe93902 #iPad2,3
key_k95_613=0bb841b8f1922ae73d85ed9ed0d7a3583a10af909787857c15af2691b39bba30
iv_n94_613=d3fe01e99bd0967e80dccfc0739f93d5 #iPhone4,1
key_n94_613=35343d5139e0313c81ee59dbae292da26e739ed75b3da5db9da7d4d26046498c
function BasebandDetect {
BasebandURL=$(cat resources/firmware/${ProductType}/13G37/url 2>/dev/null)
if [ $ProductType == iPad2,2 ]; then
BasebandURL=http://appldnld.apple.com/iOS9.3.5/031-74153-20160825-1250B23E-6717-11E6-AB83-973F34D2D062/iPad2,2_9.3.5_13G36_Restore.ipsw
Baseband=Firmware/ICE3_04.12.09_BOOT_02.13.Release.bbfw
BasebandURL=$(cat resources/firmware/${ProductType}/13G36/url)
Baseband=ICE3_04.12.09_BOOT_02.13.Release.bbfw
elif [ $ProductType == iPad2,3 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/041-80042-20190722-68F07B91-8EA1-4A3B-A930-35314A006ECB/iPad2,3_9.3.6_13G37_Restore.ipsw
Baseband=Firmware/Phoenix-3.6.03.Release.bbfw
elif [ $ProductType == iPad2,6 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/041-80040-20190722-B1E89CC8-5209-40C3-AEE9-63C29D38BDEB/iPad2,6_9.3.6_13G37_Restore.ipsw
Baseband=Firmware/Mav5-11.80.00.Release.bbfw
elif [ $ProductType == iPad2,7 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/041-80041-20190722-673B8756-0A63-4BB6-9855-ACE2381695AF/iPad2,7_9.3.6_13G37_Restore.ipsw
Baseband=Firmware/Mav5-11.80.00.Release.bbfw
elif [ $ProductType == iPad3,2 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/041-80039-20190722-E632D5D2-2F3C-498F-B83F-7067D9D90B33/iPad3,2_9.3.6_13G37_Restore.ipsw
Baseband=Firmware/Mav4-6.7.00.Release.bbfw
elif [ $ProductType == iPad3,3 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/041-80044-20190722-6C65AD27-69D8-499C-BC15-DE7AC74DE2BD/iPad3,3_9.3.6_13G37_Restore.ipsw
Baseband=Firmware/Mav4-6.7.00.Release.bbfw
elif [ $ProductType == iPad3,5 ] || [ $ProductType == iPad3,6 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/091-25014-20190722-0C1B95A6-992C-11E9-A2EE-E1C9A77C2E40/iPad_32bit_10.3.4_14G61_Restore.ipsw
Baseband=Firmware/Mav5-11.80.00.Release.bbfw
Baseband=Phoenix-3.6.03.Release.bbfw
elif [ $ProductType == iPad2,6 ] || [ $ProductType == iPad2,7 ]; then
Baseband=Mav5-11.80.00.Release.bbfw
elif [ $ProductType == iPad3,2 ] || [ $ProductType == iPad3,3 ]; then
Baseband=Mav4-6.7.00.Release.bbfw
elif [ $ProductType == iPhone4,1 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/041-80043-20190722-6C65AD27-69D8-499C-BC15-DE7AC74DE2BD/iPhone4,1_9.3.6_13G37_Restore.ipsw
Baseband=Firmware/Trek-6.7.00.Release.bbfw
elif [ $ProductType == iPhone5,1 ] || [ $ProductType == iPhone5,2 ]; then
BasebandURL=http://updates-http.cdn-apple.com/2019/ios/091-25277-20190722-0C1B94DE-992C-11E9-A2EE-E2C9A77C2E40/iPhone_4.0_32bit_10.3.4_14G61_Restore.ipsw
Baseband=Firmware/Mav5-11.80.00.Release.bbfw
Baseband=Trek-6.7.00.Release.bbfw
elif [ $ProductType == iPad3,5 ] || [ $ProductType == iPad3,6 ] ||
[ $ProductType == iPhone5,1 ] || [ $ProductType == iPhone5,2 ]; then
BasebandURL=$(cat resources/firmware/${ProductType}/14G61/url)
Baseband=Mav5-11.80.00.Release.bbfw
else # For Wi-Fi only devices
Baseband=0
fi
@ -85,7 +24,7 @@ function BasebandDetect {
function Clean {
# Clean up files (called on MainMenu and trap dependency)
rm -rf iP*/ tmp/ $(ls ${UniqueChipID}_${ProductType}_${DowngradeVersion}-*.shsh2 2>/dev/null) $(ls *.bbfw 2>/dev/null) BuildManifest.plist
rm -rf iP*/ tmp/ $(ls ${UniqueChipID}_${ProductType}_${DowngradeVer}-*.shsh2 2>/dev/null) $(ls *.bbfw 2>/dev/null) BuildManifest.plist
}
function MainMenu {
@ -119,22 +58,23 @@ function MainMenu {
echo "Main Menu"
echo
echo "HardwareModel: $HardwareModel"
echo "HardwareModel: $HWModel"
echo "ProductType: $ProductType"
echo "ProductVersion: $ProductVersion"
echo "ProductVersion: $ProductVer"
echo "UniqueChipID (ECID): $UniqueChipID"
echo
echo "[Input] Select an option:"
select opt in "Downgrade device" "Save OTA blobs" "Just put device in kDFU mode" "(Re-)Install Dependencies" "Exit"; do
case $opt in
"Downgrade device" ) Mode='Downgrade'; SelectVersion; break;;
"Save OTA blobs" ) Mode='SaveOTABlobs'; SelectVersion; break;;
"Just put device in kDFU mode" ) Mode='kDFU'; Select841; break;;
"(Re-)Install Dependencies" ) InstallDependencies; break;;
"Downgrade device" ) Mode='Downgrade'; break;;
"Save OTA blobs" ) Mode='SaveOTABlobs'; break;;
"Just put device in kDFU mode" ) Mode='kDFU'; break;;
"(Re-)Install Dependencies" ) InstallDependencies;;
"Exit" ) exit;;
*) MainMenu;;
esac
done
SelectVersion
}
function SelectVersion {
@ -151,7 +91,7 @@ function SelectVersion {
*) SelectVersion;;
esac
done
else
elif [[ $Mode != 'kDFU' ]]; then
select opt in "iOS 8.4.1" "iOS 6.1.3" "Back"; do
case $opt in
"iOS 8.4.1" ) Select841; break;;
@ -160,6 +100,8 @@ function SelectVersion {
*) SelectVersion;;
esac
done
else
Select841
fi
elif [[ $Mode == 'Downgrade' ]]; then
echo "[Input] Select iOS version:"
@ -178,37 +120,35 @@ function SelectVersion {
function Select841 {
echo "iOS 8.4.1 $Mode"
iBSS="iBSS.$HardwareModelLower.RELEASE"
DowngradeVersion="8.4.1"
iBSS="iBSS.$HWModelLower.RELEASE"
DowngradeVer="8.4.1"
DowngradeBuildVer="12H321"
iv=iv_$HardwareModelLower
key=key_$HardwareModelLower
Action
}
function Select613 {
echo "iOS 6.1.3 $Mode"
iBSS="iBSS.${HardwareModelLower}ap.RELEASE"
DowngradeVersion="6.1.3"
iBSS="iBSS.${HWModelLower}ap.RELEASE"
DowngradeVer="6.1.3"
DowngradeBuildVer="10B329"
iv=iv_${HardwareModelLower}_613
key=key_${HardwareModelLower}_613
Action
}
function SelectOther {
echo "Other $Mode"
iBSS="iBSS.$HardwareModelLower.RELEASE"
iv=iv_$HardwareModelLower
key=key_$HardwareModelLower
iBSS="iBSS.$HWModelLower.RELEASE"
NotOTA=1
read -p "[Input] Path to IPSW (drag IPSW to terminal window): " IPSW
IPSW="$(basename "$IPSW" .ipsw)"
read -p "[Input] Path to SHSH (drag SHSH to terminal window): " SHSH
Downgrade
Action
}
function Action {
Firmware=resources/firmware/${ProductType}/${DowngradeBuildVer}
IV=$(cat $Firmware/iv)
Key=$(cat $Firmware/key)
if [[ $Mode == 'Downgrade' ]]; then
Downgrade
elif [[ $Mode == 'SaveOTABlobs' ]]; then
@ -219,13 +159,13 @@ function Action {
}
function SaveOTABlobs {
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${DowngradeVersion}.plist"
echo "[Log] Saving $DowngradeVersion blobs with tsschecker..."
env "LD_PRELOAD=libcurl.so.3" resources/tools/tsschecker_$platform -d $ProductType -i $DowngradeVersion -o -s -e $UniqueChipID -m $BuildManifest
SHSH=$(ls ${UniqueChipID}_${ProductType}_${DowngradeVersion}-*.shsh2)
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${DowngradeVer}.plist"
echo "[Log] Saving $DowngradeVer blobs with tsschecker..."
env "LD_PRELOAD=libcurl.so.3" resources/tools/tsschecker_$platform -d $ProductType -i $DowngradeVer -o -s -e $UniqueChipID -m $BuildManifest
SHSH=$(ls ${UniqueChipID}_${ProductType}_${DowngradeVer}-*.shsh2)
if [ ! -e "$SHSH" ]; then
echo "[Error] Saving $DowngradeVersion blobs failed. Please run the script again"
echo "It is also possible that $DowngradeVersion for $ProductType is no longer signed"
echo "[Error] Saving $DowngradeVer blobs failed. Please run the script again"
echo "It is also possible that $DowngradeVer for $ProductType is no longer signed"
exit
fi
mkdir -p saved/shsh 2>/dev/null
@ -237,15 +177,14 @@ function kDFU {
# Downloading 8.4.1 iBSS for "other" downgrades
# This is because this script only provides 8.4.1 iBSS IV and Keys
echo "[Log] Downloading iBSS..."
dllink=$(cat resources/firmware/${ProductType}/${DowngradeBuildVer}/url)
resources/tools/pzb_$platform -g Firmware/dfu/${iBSS}.dfu -o $iBSS.dfu $dllink
resources/tools/pzb_$platform -g Firmware/dfu/${iBSS}.dfu -o $iBSS.dfu $(cat $Firmware/url)
mkdir -p saved/$ProductType 2>/dev/null
mv $iBSS.dfu saved/$ProductType
fi
echo "[Log] Decrypting iBSS..."
echo "IV = ${!iv}"
echo "Key = ${!key}"
resources/tools/xpwntool_$platform saved/$ProductType/$iBSS.dfu tmp/iBSS.dec -k ${!key} -iv ${!iv} -decrypt
echo "IV = ${!IV}"
echo "Key = ${!Key}"
resources/tools/xpwntool_$platform saved/$ProductType/$iBSS.dfu tmp/iBSS.dec -k ${!Key} -iv ${!IV} -decrypt
dd bs=64 skip=1 if=tmp/iBSS.dec of=tmp/iBSS.dec2
echo "[Log] Patching iBSS..."
bspatch tmp/iBSS.dec2 tmp/pwnediBSS resources/patches/$iBSS.patch
@ -324,26 +263,23 @@ function Downgrade {
curl -L https://github.com/LukeZGD/32bit-OTA-Downgrader/archive/firmware.zip -o tmp/firmware.zip
unzip -q tmp/firmware.zip -d tmp
mkdir resources/firmware
mv tmp/32bit-OTA-Downgrader-firmware/firmware/* resources/firmware
mv tmp/32bit-OTA-Downgrader-firmware/* resources/firmware
if [ ! $NotOTA ]; then
SaveOTABlobs
IPSW="${ProductType}_${DowngradeVersion}_${DowngradeBuildVer}_Restore"
IPSW="${ProductType}_${DowngradeVer}_${DowngradeBuildVer}_Restore"
if [ ! -e "$IPSW.ipsw" ]; then
echo "[Log] iOS $DowngradeVersion IPSW is missing, downloading IPSW..."
curl -L $(cat resources/firmware/${ProductType}/${DowngradeBuildVer}/url) -o tmp/$IPSW.ipsw
echo "[Log] iOS $DowngradeVer IPSW is missing, downloading IPSW..."
curl -L $(cat $Firmware/url) -o tmp/$IPSW.ipsw
mv tmp/$IPSW.ipsw .
fi
echo "[Log] Verifying IPSW..."
SHA1IPSW=$(cat resources/firmware/${ProductType}/${DowngradeBuildVer}/sha1sum)
SHA1IPSW=$(cat $Firmware/sha1sum)
SHA1IPSWL=$(sha1sum "$IPSW.ipsw" | awk '{print $1}')
if [ $SHA1IPSW != $SHA1IPSWL ]; then
echo "[Error] SHA1 of IPSW does not match!"
read -p "[Input] Continue anyway? (y/N)" Continue
if [[ $Continue != y ]] && [[ $Continue != Y ]]; then
echo "[Error] SHA1 of IPSW does not match. Please run the script again"
exit
fi
fi
echo "[Log] Extracting iBSS from IPSW..."
mkdir -p saved/$ProductType 2>/dev/null
unzip -o -j "$IPSW.ipsw" Firmware/dfu/$iBSS.dfu -d saved/$ProductType
@ -368,7 +304,7 @@ function Downgrade {
else
if [ ! -e saved/$ProductType/*.bbfw ]; then
echo "[Log] Downloading baseband..."
resources/tools/pzb_$platform -g $Baseband -o $Baseband $BasebandURL
resources/tools/pzb_$platform -g Firmware/$Baseband -o $Baseband $BasebandURL
resources/tools/pzb_$platform -g BuildManifest.plist -o BuildManifest.plist $BasebandURL
mkdir -p saved/$ProductType 2>/dev/null
cp $(ls *.bbfw) BuildManifest.plist saved/$ProductType
@ -503,12 +439,12 @@ if [[ $(uname -m) != 'x86_64' ]]; then
exit
fi
HardwareModel=$(ideviceinfo -s | grep 'HardwareModel' | cut -c 16-)
HardwareModelLower=$(echo $HardwareModel | tr '[:upper:]' '[:lower:]' | sed 's/.\{2\}$//')
HWModel=$(ideviceinfo -s | grep 'HWModel' | cut -c 16-)
HWModelLower=$(echo $HWModel | tr '[:upper:]' '[:lower:]' | sed 's/.\{2\}$//')
ProductType=$(ideviceinfo -s | grep 'ProductType' | cut -c 14-)
[ ! $ProductType ] && ProductType=$(ideviceinfo | grep 'ProductType' | cut -c 14-)
ProductVersion=$(ideviceinfo -s | grep 'ProductVersion' | cut -c 17-)
VersionDetect=$(echo $ProductVersion | cut -c 1)
ProductVer=$(ideviceinfo -s | grep 'ProductVer' | cut -c 17-)
VersionDetect=$(echo $ProductVer | cut -c 1)
UniqueChipID=$(ideviceinfo -s | grep 'UniqueChipID' | cut -c 15-)
if [ ! $(which bspatch) ] || [ ! $(which ideviceinfo) ] || [ ! $(which lsusb) ] || [ ! $(which ssh) ] || [ ! $(which python3) ]; then