]>
git.cameronkatri.com Git - tsssave.git/blob - tsssave
4 # output: /var/www/html/tss/
13 # deviceid: iPhone12,1
20 if ! command -v yq
>/dev
/null
; then
21 printf "Please install yq\nhttps://github.com/mikefarah/yq\n"
25 if ! command -v jq
>/dev
/null
; then
26 printf "Please install jq\nhttps://github.com/stedolan/jq\n"
30 if ! command -v tsschecker
>/dev
/null
; then
31 printf "Please install tsschecker\nhttps://github.com/1Conan/tsschecker\n"
35 if ! command -v pzb
>/dev
/null
; then
36 printf "Please install pzb\nhttps://github.com/tihmstar/partialZipBrowser\n"
40 [ ! -z "${missingdep}" ] && exit 1
42 if [ -z "${1}" ]; then
43 printf "Usage: tsssave configfile\n"
47 config
="$(realpath "${1}")"
49 output
="$(yq e ".output" ${config})"
52 cd "$(yq e '.temppath // "/tmp"' ${config})"
54 for device
in $(yq e '.devices | keys | .[]' ${config}); do
55 deviceid
="$(yq e ".devices.${device}.deviceid" ${config})"
56 board
="$(yq e ".devices.${device}.board" ${config})"
57 ecid
="$(yq e ".devices.${device}.ecid" ${config})"
58 generator
="$(yq e ".devices.${device}.generator" ${config})"
59 apnonce
="$(yq e ".devices.${device}.apnonce" ${config})"
63 for signed
in $(curl -s https://api.ipsw.me/v4/device/${deviceid} | jq -re '.firmwares[] | select(.signed == true) | .buildid
'); do
64 version="$(curl -s https://api.ipsw.me/v4/device/${deviceid} | jq -re ".firmwares[] | select(.buildid == \"${signed}\") | .version")"
65 if [ -e ${output}/${device}/${version}/$(printf "%d\n" ${ecid})_${deviceid}_$(printf "${board}\n" | tr '[A-Z]' '[a-z]')_*-${signed}_*.shsh2 ]; then
66 printf "Skipping %s...\n" ${signed}
68 printf "Saving %s...\n" ${signed}
69 pzb "$(curl -s https://api.ipsw.me/v4/ipsw/${deviceid}/${signed} | jq -re '.url')" -g BuildManifest.plist -o BuildManifest-${board}-${signed}.plist
70 mkdir -p ${output}/${device}/${version}/
71 tsschecker -d "${deviceid}" -B "${board}" -m /tmp/BuildManifest-${board}-${signed}.plist -s -e "${ecid}" --generator "${generator}" \
72 --apnonce "${apnonce}" --save-path ${output}/${device}/${version}/
78 for signed in $(curl -sL https://api.m1sta.xyz/betas/${deviceid} | jq -re '.[] | select(.signed == true) | .buildid'); do
79 version
="$(curl -s https://api.m1sta.xyz/betas/${deviceid} | jq -re ".[] | select(.buildid == \"${signed}\") | .version" | sed 's/ /-/g')"
80 if [ -e ${output}/${device}/${version}/$(printf "%d\n" ${ecid})_${deviceid}_$(printf "${board}\n" | tr '[A-Z]' '[a-z]')_*-${signed}_*.shsh2 ]; then
81 printf "Skipping
%s...
\n" ${signed}
83 printf "Saving
%s...
\n" ${signed}
84 pzb "$(curl -sL https://api.m1sta.xyz/betas/${deviceid} | jq -re ".[] | select(.buildid == \"${signed}\") | .url
")" -g BuildManifest.plist
-o BuildManifest
-${board}-${signed}.plist
85 mkdir -p ${output}/${device}/${version}/
86 tsschecker
-d "${deviceid}" -B "${board}" -m /tmp
/BuildManifest
-${board}-${signed}.plist
-s -e "${ecid}" --generator "${generator}" \
87 --apnonce "${apnonce}" --save-path ${output}/${device}/${version}/