Created
February 25, 2025 12:09
-
-
Save LukeZGD/32d403353e020605a8bc3a8956c56ce7 to your computer and use it in GitHub Desktop.
diff between theapplewiki and fwkeydb ivkeys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# diff between theapplewiki and fwkeydb ivkeys | |
types=(iPhone1,1 iPhone1,2 iPhone2,1 iPhone3,1 iPhone3,2 iPhone3,3 iPhone4,1 iPhone5,1 iPhone5,2 iPhone5,3 iPhone5,4 | |
iPad1,1 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 | |
iPod1,1 iPod2,1 iPod3,1 iPod4,1 iPod5,1) | |
#types=(iPhone2,1) | |
comps=(AppleLogo BatteryCharging BatteryCharging0 BatteryCharging1 BatteryFull BatteryLow0 BatteryLow1 BatteryPlugin DeviceTree KernelCache LLB RecoveryMode EraseRamdisk iBEC iBSS iBoot UpgradeRamdisk) | |
diffcomp() { | |
what="$1" | |
comp="$2" | |
comp2="$3" | |
device_type="$4" | |
proc="$5" | |
build="$6" | |
jq -r ".keys[] | select(.image == \"$comp2\") | .$what" $build > ${what}1 | |
jq -r ".keys[] | select(.names[] == \"$comp\") | .$what" fwkeydb/keys/firmware/$device_type/0x$proc/$build > ${what}2 | |
diff ${what}1 ${what}2 > ${what}c | |
cat ${what}c | |
if [[ -s ${what}c ]]; then | |
if [[ $(cat ${what}c | grep -c '>') != 0 && $what != "kbag" ]]; then | |
echo "$comp2-$what" >> ${device_type}-${build} | |
cat ${what}c >> ${device_type}-${build} | |
echo "" >> ${device_type}-${build} | |
#mv ${what}c ${device_type}-${build}-$comp-$what | |
fi | |
fi | |
rm -f ${what}1 ${what}2 ${what}c | |
} | |
if [[ ! -d fwkeydb ]]; then | |
git clone https://github.com/tihmstar/fwkeydb | |
fi | |
for device_type in ${types[@]}; do | |
case $device_type in | |
iPhone1* | iPod1,1 ) proc=8900;; | |
iPod2,1 ) proc=8720;; | |
iPhone2,1 ) proc=8920;; | |
iPod3,1 ) proc=8922;; | |
iPhone3* | iPad1,1 | iPod4,1 ) proc=8930;; | |
iPhone4,1 | iPad2,[123] ) proc=8940;; | |
iPad2* | iPod5,1 ) proc=8942;; | |
iPad3,[123] ) proc=8945;; | |
iPhone5* ) proc=8950;; | |
iPad3* ) proc=8955;; | |
esac | |
echo "$device_type 0x$proc" | |
: ' | |
json=$(curl "https://api.ipsw.me/v4/device/${device_type}?type=ipsw") | |
len=$(echo "$json" | jq -r ".firmwares | length") | |
builds=() | |
i=0 | |
while (( i < len )); do | |
builds+=($(echo "$json" | jq -r ".firmwares[$i].buildid")) | |
((i++)) | |
done | |
' | |
builds=($(ls fwkeydb/keys/firmware/$device_type/0x$proc)) | |
for build in ${builds[@]}; do | |
case $build in | |
1[AC]* | [345]* | 14* ) continue;; | |
esac | |
echo "$build" | |
curl -LO https://api.m1sta.xyz/wikiproxy/$device_type/$build | |
#cat $build | |
for comp in ${comps[@]}; do | |
case $comp in | |
"UpgradeRamdisk" ) comp2="UpdateRamdisk";; | |
"EraseRamdisk" ) comp2="RestoreRamdisk";; | |
"BatteryCharging" ) comp2="GlyphCharging";; | |
"BatteryPlugin" ) comp2="GlyphPlugin";; | |
"KernelCache" ) comp2="Kernelcache";; | |
* ) comp2="$comp";; | |
esac | |
case $build in | |
8[GHJKL]* ) | |
if [[ $comp == *"Ramdisk" ]]; then | |
continue | |
fi | |
;; | |
esac | |
echo "$comp ($comp2 in wikiproxy)" | |
diffcomp iv $comp $comp2 $device_type $proc $build | |
diffcomp key $comp $comp2 $device_type $proc $build | |
#diffcomp kbag $comp $comp2 $device_type $proc $build | |
#diffcomp filename $comp $comp2 $device_type $proc $build | |
done | |
echo | |
rm $build | |
done | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment