Last active
June 4, 2020 04:25
-
-
Save magn2o/1a1ede2b77d82b5deb8a1459076db47f to your computer and use it in GitHub Desktop.
Quick bash script to try and grab all blobs for a specific iOS device..
This file contains hidden or 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
#!/bin/bash | |
# | |
# quicktsscheck.sh | |
# by /u/magn2o | |
# | |
# A simple, quick utility to grab all signed SHSH/blobs. Toss it in crontab and let it work it's magic. | |
# Tested/built on macOS 10.13.3. | |
# | |
# | |
# CHANGELOG: | |
# | |
# 1.7 | |
# - Huzzah! jq is no longer a requirement. I can safely say that this script will now run on a clean/fresh | |
# install of macOS without the need of any dependences. :) | |
# | |
# 1.6 | |
# - Added check for jq (yea.. you're gonna need this) | |
# | |
# 1.5 | |
# - Added ability to specify specific boardconfig. | |
# - ECID is no longer case sensitive. Oops. | |
# | |
# 1.4 | |
# - Added a check to skip existing blobs. No sense in duplicating and wasting time.. | |
# | |
# 1.3 | |
# - Allow arguments for ease of scripting multiple devices. | |
# | |
# 1.2 | |
# - Reverse the array when processing, to ensure starting with the oldest version first. | |
# | |
# 1.1 | |
# - Automatically populate IOSVERSIONS with all supported versions for the specified device (thanks, /u/-10ZiN) | |
# - Added grep to binary call to reduce spam. Output will simply show what IS and IS NOT being signed. | |
# | |
# 1.0 | |
# - Initial release. | |
# | |
# ---------------------------- # | |
# USER CONFIGURATION # | |
# ---------------------------- # | |
# Path to tsschecker binary | |
TSSCHECKER_BINARY="/usr/local/bin/tsschecker" | |
# Path to save blobs | |
SAVE_PATH="${HOME}/saved_blobs" | |
# ---------------------------- # | |
# DO NOT EDIT BELOW THIS LINE! # | |
# ---------------------------- # | |
# Check if tsschecker is installed, otherwise.. eject! EJECT! | |
if [ ! -x "$TSSCHECKER_BINARY" ]; then | |
echo "tsschecker is NOT installed! See https://github.com/tihmstar/tsschecker/releases" | |
exit 1 | |
fi | |
# No arguments? Show usage. | |
if [[ $# -lt 2 ]]; then | |
echo "Usage: $0 <device> <ecid> [board]" | |
echo "" | |
echo " <device> - specific device by its MODEL (eg. iPhone4,1)" | |
echo " <ecid> - specific ECID to be used for fetching blobs. Value must be either dece or hex eg. 5482657301265 or ab46efcbf71" | |
echo " [board] - (optional) specific boardconfig (eg. n61ap)" | |
exit 2 | |
fi | |
# Set the local variables | |
DEVICE="$1" | |
ECID="$2" | |
BOARD="$3" | |
# Check user input.. because, well.. users. | |
if [[ ! "$DEVICE" = *","* ]]; then | |
echo "Invalid device identifier. Please check and try again." | |
exit 2 | |
fi | |
if [[ ! "$ECID" =~ ^[0-9A-Fa-f]*$ ]]; then | |
echo "Invalid ECID. Please check and try again." | |
exit 2 | |
else | |
[[ ! "$ECID" =~ ^[0-9]*$ ]] && ECID=$(( 16#${ECID} )) || ECID=${ECID} | |
fi | |
if [[ "$BOARD" && ! "$BOARD" =~ ^([Bb]|[Dd]|[Jj]|[Kk]|[Mm]|[Nn]|[Pp])[0-9]{2,3}[A-Za-z]?[Aa][Pp]$ ]]; then | |
echo "Invalid boardconfig. Please check and try again." | |
exit 2 | |
fi | |
# Get a list of iOS versions supported for $DEVICE. | |
IFS=' ' read -a IOSVERSIONS <<< "$( ${TSSCHECKER_BINARY} -d ${DEVICE} ${BOARD:+-B "$BOARD"} --list-ios |grep iOS |tr -s "\n" " " | sed 's/^\[iOS [0-9]\{1,2\}\] //g' )" | |
# Check to see if $SAVE_PATH exists, if not, create it. | |
if [ ! -d "${SAVE_PATH}" ]; then | |
mkdir "${SAVE_PATH}" | |
fi | |
# Iterate through $IOSVERSIONS and run tsschecker against each version, starting with the oldest version first. | |
for ((i=${#IOSVERSIONS[@]}-1;i>=0;i--)); do | |
[[ "$BOARD" ]] && REGEX=".*/${ECID}_${DEVICE}_${BOARD}_${IOSVERSIONS[i]}-.*.shsh2" || REGEX=".*/${ECID}_${DEVICE}_${IOSVERSIONS[i]}-.*.shsh2" | |
if [[ -z $( find -E "${SAVE_PATH}" -iregex "${REGEX}" ) ]]; then | |
${TSSCHECKER_BINARY} -d ${DEVICE} ${BOARD:+-B "$BOARD"} -i ${IOSVERSIONS[i]} -s -e ${ECID} --save-path "${SAVE_PATH}" | grep -E 'IS.*being signed' | |
else | |
echo "iOS ${IOSVERSIONS[i]} for device ${DEVICE} already exists, skipping ... " | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment