add linux fix usb

This commit is contained in:
edwin 2023-04-13 19:41:06 -04:00
parent 9a2cd230c3
commit b2b8c1d5d5
4 changed files with 101 additions and 15 deletions

BIN
binaries/Darwin/futurerestore Normal file → Executable file

Binary file not shown.

Binary file not shown.

View file

@ -16,8 +16,8 @@ echo "[*] Command ran:`if [ $EUID = 0 ]; then echo " sudo"; fi` ./downr1n.sh $@"
# =========
# Variables
# =========
ipsw="ipsw/*.ipsw" # put your ipsw
version="1.0"
ipsw=$(ls ipsw/*.ipsw) # put your ipsw
version="2.0"
os=$(uname)
dir="$(pwd)/binaries/$os"
max_args=2
@ -555,9 +555,9 @@ fi
cd ..
if [ -a $ipsw ] || [ "${ipsw: -5}" == ".ipsw" ]; then
echo "Continuing..."
echo "[*] Continuing..."
else
_eexit $ipsw "is not a valid ipsw file."
_eexit $ipsw "[-] is not a valid ipsw file."
fi
if [ "$downgrade" = "1" ] || [ "$jailbreak" = "1" ]; then
@ -790,7 +790,7 @@ if [ true ]; then
"$dir"/pzb -g "$(awk "/""${model}""/{x=1}x&&/DeviceTree[.]/{print;exit}" BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1)" "$ipswurl"
"$dir"/pzb -g "$(awk "/""${model}""/{x=1}x&&/kernelcache.release/{print;exit}" BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1)" "$ipswurl"
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
"$dir"/img4 -i "$extractedIpsw"/Firmware/"$(/usr/bin/plutil -extract "BuildIdentities".0."Manifest"."OS"."Info"."Path" xml1 -o - work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | head -1)".trustcache -o work/trustcache.img4 -M work/IM4M
else
"$dir"/img4 -i "$extractedIpsw"/Firmware/"$(binaries/Linux/PlistBuddy work/BuildManifest.plist -c "Print BuildIdentities:0:Manifest:OS:Info:Path" | sed 's/"//g')".trustcache -o work/trustcache.img4 -M work/IM4M
@ -803,7 +803,7 @@ if [ true ]; then
cp "$extractedIpsw$(awk "/""${model}""/{x=1}x&&/DeviceTree[.]/{print;exit}" work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1)" "work/"
cp "$extractedIpsw$(awk "/""${model}""/{x=1}x&&/kernelcache.release/{print;exit}" work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1)" "work/"
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
"$dir"/img4 -i "$extractedIpsw"/Firmware/"$(/usr/bin/plutil -extract "BuildIdentities".0."Manifest"."OS"."Info"."Path" xml1 -o - work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | head -1)".trustcache -o work/trustcache.img4 -M work/IM4M
else
"$dir"/img4 -i "$extractedIpsw"/Firmware/"$(binaries/Linux/PlistBuddy work/BuildManifest.plist -c "Print BuildIdentities:0:Manifest:OS:Info:Path" | sed 's/"//g')".trustcache -o work/trustcache.img4 -M work/IM4M
@ -830,13 +830,13 @@ if [ true ]; then
python3 -m pyimg4 img4 create -p work/kcache.im4p -o work/kernelcache.img4 -m work/IM4M
if [[ "$deviceid" == "iPhone8"* ]] || [[ "$deviceid" == "iPad6"* ]] || [[ "$deviceid" == *'iPad5'* ]]; then
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
python3 -m pyimg4 im4p extract -i "$extractedIpsw$(/usr/bin/plutil -extract "BuildIdentities".0."Manifest"."RestoreKernelCache"."Info"."Path" xml1 -o - work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | head -1)" -o work/kcache.dec --extra work/kpp.bin
else
python3 -m pyimg4 im4p extract -i "$extractedIpsw$(binaries/Linux/PlistBuddy work/BuildManifest.plist -c "Print BuildIdentities:0:Manifest:RestoreKernelCache:Info:Path" | sed 's/"//g')" -o work/kcache.dec --extra work/kpp.bin
fi
else
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
python3 -m pyimg4 im4p extract -i "$extractedIpsw$(/usr/bin/plutil -extract "BuildIdentities".0."Manifest"."RestoreKernelCache"."Info"."Path" xml1 -o - work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | head -1)" -o work/kcache.dec
else
python3 -m pyimg4 im4p extract -i "$extractedIpsw$(binaries/Linux/PlistBuddy work/BuildManifest.plist -c "Print BuildIdentities:0:Manifest:RestoreKernelCache:Info:Path" | sed 's/"//g')" -o work/kcache.dec
@ -854,20 +854,20 @@ if [ true ]; then
"$dir"/img4 -i work/"$(awk "/""${model}""/{x=1}x&&/DeviceTree[.]/{print;exit}" work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | sed 's/Firmware[/]all_flash[/]//')" work/devicetree.img4 -M work/IM4M -T rdtr
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
cp "$extractedIpsw$(/usr/bin/plutil -extract "BuildIdentities".0."Manifest"."RestoreRamDisk"."Info"."Path" xml1 -o - work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | head -1)" "work/"
else
cp "$extractedIpsw$(binaries/Linux/PlistBuddy work/BuildManifest.plist -c "Print BuildIdentities:0:Manifest:RestoreRamDisk:Info:Path" | sed 's/"//g')" "work/"
fi
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
"$dir"/img4 -i work/"$(/usr/bin/plutil -extract "BuildIdentities".0."Manifest"."RestoreRamDisk"."Info"."Path" xml1 -o - work/BuildManifest.plist | grep '<string>' |cut -d\> -f2 |cut -d\< -f1 | head -1)" -o work/ramdisk.dmg
else
"$dir"/img4 -i work/"$(binaries/Linux/PlistBuddy work/BuildManifest.plist -c "Print BuildIdentities:0:Manifest:RestoreRamDisk:Info:Path" | sed 's/"//g')" -o work/ramdisk.dmg
fi
"$dir"/gaster reset
if [ "$os" = 'Darwin' ]; then
if [ "$os" = "Darwin" ]; then
hdiutil attach work/ramdisk.dmg -mountpoint /tmp/SSHRD
mounted="/tmp/SSHRD"
@ -925,13 +925,17 @@ if [ true ]; then
sleep 1
"$dir"/irecovery -f "blobs/"$deviceid"-"$version".shsh2"
if [ "$os" = "Linux" ]; then
sudo ./linux_fix.sh
read -p "did you unplug and replug your iDevice? so press [ENTER]"
fi
if [ "$dontRestore" = "1" ]; then
echo "finished creating boot files now you can --boot in order to get boot to the system"
echo "[*] Finished creating boot files now you can --boot in order to get boot to the system"
exit;
fi
echo "don't run this as root or putting sudo. if you did, try again witout sudo"
read -p "click enter to continue"
sleep 2
echo "[*] Executing futurerestore ..."
_runFuturerestore
sleep 2
echo -e "\033[1;33mif nothing works just try to run (with sudo or without) this command:\033[0m \033[1m$dir/futurerestore -t blobs/$deviceid-$version.shsh2 --use-pwndfu --skip-blob --rdsk work/rdsk.im4p --rkrn work/krnl.im4p --latest-sep $HasBaseband $ipsw\033[0m"

82
linux_fix.sh Executable file
View file

@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Futurerestore/irecovery linux fix script made by @Cryptiiiic
# Supported Distros: archlinux, ubuntu, debian
set -e
pacman=0
aptget=0
dnf=0
if [ "$EUID" -ne 0 ]
then
echo "-1: Please run as root"
exit -1
fi
if [[ -f "/etc/fedora-release" ]]
then
echo "Fedora detected installing ca-certs..."
echo "Done!"
fi
echo "Attemping linux usb fixes please wait..."
if [[ $(which pacman 2>/dev/null) ]]
then
pacman=1
elif [[ $(which apt-get 2>/dev/null) ]]
then
aptget=1
elif [[ $(which dnf 2>/dev/null) ]]
then
dnf=1
else
echo "-2: Linux Distro not supported!"
exit -2
fi
if [[ "$(expr $pacman)" -gt '0' ]]
then
if [[ -f "/etc/arch-release" ]]
then
echo "Arch Linux Detected!"
sudo pacman -Syy --needed --noconfirm >/dev/null 2>/dev/null
sudo pacman -S --needed --noconfirm udev usbmuxd >/dev/null 2>/dev/null
sudo systemctl enable systemd-udevd usbmuxd --now 2>/dev/null
echo "QUNUSU9OPT0iYWRkIiwgU1VCU1lTVEVNPT0idXNiIiwgQVRUUntpZFZlbmRvcn09PSIwNWFjIiwgQVRUUntpZFByb2R1Y3R9PT0iMTIyWzI3XXwxMjhbMC0zXSIsIE9XTkVSPSJyb290IiwgR1JPVVA9InN0b3JhZ2UiLCBNT0RFPSIwNjYwIgoKQUNUSU9OPT0iYWRkIiwgU1VCU1lTVEVNPT0idXNiIiwgQVRUUntpZFZlbmRvcn09PSIwNWFjIiwgQVRUUntpZFByb2R1Y3R9PT0iMTMzOCIsIE9XTkVSPSJyb290IiwgR1JPVVA9InN0b3JhZ2UiLCBNT0RFPSIwNjYwIgo=" | base64 -d | sudo tee /usr/lib/udev/rules.d/39-libirecovery.rules >/dev/null
else
echo "-3: Linux Distro not supported!"
exit -3
fi
elif [[ "$(expr $aptget)" -gt '0' ]]
then
if [[ -f "/etc/lsb-release" || -f "/etc/debian_version" ]]
then
echo "Ubuntu or Debian Detected!"
sudo apt-get update -qq >/dev/null 2>/dev/null
sudo apt-get install -yqq usbmuxd udev >/dev/null 2>/dev/null
sudo systemctl enable udev >/dev/null 2>/dev/null || true
sudo systemctl enable systemd-udevd >/dev/null 2>/dev/null || true
sudo systemctl enable usbmuxd >/dev/null 2>/dev/null || true
sudo systemctl restart udev >/dev/null 2>/dev/null
sudo systemctl restart systemd-udevd >/dev/null 2>/dev/null
sudo systemctl restart usbmuxd >/dev/null 2>/dev/null
echo "QUNUSU9OPT0iYWRkIiwgU1VCU1lTVEVNPT0idXNiIiwgQVRUUntpZFZlbmRvcn09PSIwNWFjIiwgQVRUUntpZFByb2R1Y3R9PT0iMTIyWzI3XXwxMjhbMC0zXSIsIE9XTkVSPSJ1c2JtdXgiLCBHUk9VUD0icGx1Z2RldiIsIE1PREU9IjA2NjAiCgpBQ1RJT049PSJhZGQiLCBTVUJTWVNURU09PSJ1c2IiLCBBVFRSe2lkVmVuZG9yfT09IjA1YWMiLCBBVFRSe2lkUHJvZHVjdH09PSIxMzM4IiwgT1dORVI9InVzYm11eCIsIEdST1VQPSJwbHVnZGV2IiwgTU9ERT0iMDY2MCIKCg==" | base64 -d | sudo tee /usr/lib/udev/rules.d/39-libirecovery.rules >/dev/null
else
echo "-4: Linux Distro not supported!"
exit -4
fi
else
if [[ -f "/etc/fedora-release" ]]
then
echo "Fedora Detected!"
sudo dnf install -y usbmuxd udev systemd ca-certificates >/dev/null 2>/dev/null
sudo ln -sf /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt >/dev/null 2>/dev/null
sudo systemctl enable --now systemd-udevd usbmuxd >/dev/null 2>/dev/null
echo "QUNUSU9OPT0iYWRkIiwgU1VCU1lTVEVNPT0idXNiIiwgQVRUUntpZFZlbmRvcn09PSIwNWFjIiwgQVRUUntpZFByb2R1Y3R9PT0iMTIyWzI3XXwxMjhbMC0zXSIsIE9XTkVSPSJyb290IiwgR1JPVVA9InVzYm11eGQiLCBNT0RFPSIwNjYwIiwgVEFHKz0idWFjY2VzcyIKCkFDVElPTj09ImFkZCIsIFNVQlNZU1RFTT09InVzYiIsIEFUVFJ7aWRWZW5kb3J9PT0iMDVhYyIsIEFUVFJ7aWRQcm9kdWN0fT09IjEzMzgiLCBPV05FUj0icm9vdCIsIEdST1VQPSJ1c2JtdXhkIiwgTU9ERT0iMDY2MCIsIFRBRys9InVhY2Nlc3MiCgoK" | base64 -d | sudo tee /usr/lib/udev/rules.d/39-libirecovery.rules >/dev/null 2>/dev/null
fi
fi
sudo chown root:root /usr/lib/udev/rules.d/39-libirecovery.rules >/dev/null 2>/dev/null
sudo chmod 0644 /usr/lib/udev/rules.d/39-libirecovery.rules >/dev/null 2>/dev/null
sudo udevadm control --reload-rules >/dev/null 2>/dev/null
echo "Done!"
echo "Please unplug and replug your iDevice!"