Attempt to fix ECID reading in DFU/recovery

- for #197
- also add new arg: "EntryDevice" to enter ProductType and ECID manually
- also handle more than one arg
This commit is contained in:
LukeZGD 2022-07-22 17:43:40 +08:00
parent 804a3e73ae
commit c7c542729e
2 changed files with 26 additions and 9 deletions

View File

@ -46,10 +46,10 @@ GetDeviceValues() {
Log "Finding device in Normal mode..."
DeviceState=
ideviceinfo2=$($ideviceinfo -s)
if [[ $? != 0 && $1 != "NoDevice" ]]; then
if [[ $? != 0 && $NoDevice != 1 ]]; then
Log "Finding device in DFU/recovery mode..."
DeviceState="$($irecovery -q 2>/dev/null | grep -w "MODE" | cut -c 7-)"
elif [[ $1 == "NoDevice" ]]; then
elif [[ $NoDevice == 1 ]]; then
Log "NoDevice argument detected. Skipping device detection"
DeviceState="NoDevice"
elif [[ -n $ideviceinfo2 ]]; then
@ -61,7 +61,7 @@ GetDeviceValues() {
ProductType=$($irecovery -qv 2>&1 | grep "Connected to iP" | cut -c 14-)
[[ $(echo $ProductType | cut -c 3) == 'h' ]] && ProdCut=9
ProductType=$(echo $ProductType | cut -c -$ProdCut)
UniqueChipID=$((16#$(echo $($irecovery -q | grep "ECID" | cut -c 7-) | cut -c 3-)))
UniqueChipID=$((16#$($irecovery -q | grep "ECID" | cut -c 9-)))
ProductVer="Unknown"
elif [[ $DeviceState == "Normal" ]]; then
ProductType=$(echo "$ideviceinfo2" | grep "ProductType" | cut -c 14-)
@ -72,6 +72,11 @@ GetDeviceValues() {
version="(iOS $ProductVer) "
fi
if [[ $EntryDevice == 1 ]]; then
ProductType=
UniqueChipID=
fi
if [[ ! $DeviceState ]]; then
echo -e "\n${Color_R}[Error] No device detected. Please put the device in normal mode before proceeding. ${Color_N}"
echo "${Color_Y}* Make sure to also trust this computer by selecting \"Trust\" at the pop-up. ${Color_N}"

View File

@ -9,7 +9,19 @@ cd "$(dirname $0)"
. ./resources/downgrade.sh
. ./resources/ipsw.sh
if [[ $1 != "NoColor" && $2 != "NoColor" ]]; then
for i in "$@"; do
if [[ $i == "EntryDevice" ]]; then
EntryDevice=1
elif [[ $i == "NoColor" ]]; then
NoColor=1
elif [[ $i == "NoDevice" ]]; then
NoDevice=1
elif [[ $i == "PwnedDevice" ]]; then
PwnedDevice=1
fi
done
if [[ $NoColor != 1 ]]; then
TERM=xterm-256color
Color_R=$(tput setaf 9)
Color_G=$(tput setaf 10)
@ -105,17 +117,17 @@ Main() {
InstallDepends
fi
GetDeviceValues $1
GetDeviceValues
Clean
mkdir tmp
if [[ -n $1 && $1 != "NoColor" && $1 != "NoDevice" && $1 != "PwnedDevice" ]]; then
if [[ -n $1 && $1 != "NoColor" && $1 != *"Device" ]]; then
Mode="$1"
else
[[ $1 != "NoDevice" ]] && Selection+=("Downgrade Device")
[[ $NoDevice != 1 ]] && Selection+=("Downgrade Device")
[[ $DeviceProc != 4 ]] && Selection+=("Save OTA Blobs")
if [[ $ProductType == "iPhone3,1" && $1 != "NoDevice" ]]; then
if [[ $ProductType == "iPhone3,1" && $NoDevice != 1 ]]; then
Selection+=("Disable/Enable Exploit" "Restore to 7.1.2")
[[ $platform != "win" ]] && Selection+=("SSH Ramdisk")
fi
@ -229,7 +241,7 @@ Main() {
fi
elif [[ $DeviceState == "DFU" ]]; then
if [[ $1 != "PwnedDevice" ]]; then
if [[ $PwnedDevice != 1 ]]; then
echo -e "\n${Color_R}[Error] 32-bit A${DeviceProc} device detected in DFU mode. ${Color_N}"
echo "${Color_Y}* Please put the device in normal mode and jailbroken before proceeding. ${Color_N}"
echo "${Color_Y}* Exit DFU mode by holding the TOP and HOME buttons for 15 seconds. ${Color_N}"