因為我裝置很多,所以每次出新版 iOS 抓 SHSH2 都要抓半天,就算用 1conan 也要複製貼上 ECID 很久,乾脆自己寫一個 script 自動化。
使用之前,請先開一個資料夾,我們就取名叫 SHSH2
好了,然後去 1conan 先去取得你的 SHSH2 檔案,並解壓縮資料夾,放到 SHSH2
底下。之後下載修改版的 TSSChecker(這個版本才支援 A11),一樣放到 SHSH2
底下。
接著到我的 gist 下載很醜的 python script,存檔在 SHSH2
底下,再執行就可以了。
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
#!/usr/local/bin/python3 | |
import os | |
import subprocess | |
import sys | |
apnonces = ['0dc448240696866b0cc1b2ac3eca4ce22af11cb3',\ | |
'352dfad1713834f4f94c5ff3c3e5e99477347b95',\ | |
'42c88f5a7b75bc944c288a7215391dc9c73b6e9f',\ | |
'603be133ff0bdfa0f83f21e74191cf6770ea43bb',\ | |
'9804d99e85bbafd4bb1135a1044773b4df9f1ba3',\ | |
'15400076bc4c35a7c8caefdcae5bda69c140a11bce870548f0862aac28c194cc',\ | |
'833e50b9c6a4fbfbdc51144a60b4cf25be3a0a4742ca2b7bd6f5ec06905443ac',\ | |
'd8f682df87d812c372491b613d59795a80383f439587c0bb511ccf6865eb87cc'] | |
def get_devices(): | |
device_dict = {} | |
folder_dict = {} | |
for path in os.listdir('.'): | |
if path != 'backup' and os.path.isdir(path): | |
board = '' | |
device_type = '' | |
found = False | |
version_paths = os.listdir(path) | |
version_paths.sort(reverse=True) | |
for version_path in version_paths: | |
if os.path.isdir(path + '/' + version_path): | |
for nonce_path in os.listdir(path + '/' + version_path): | |
if nonce_path == 'noapnonce': | |
for shsh_path in os.listdir(path + '/' + version_path + '/' + nonce_path): | |
if shsh_path.endswith('.shsh2'): | |
if shsh_path.split('_')[2].endswith('ap') or shsh_path.split('_')[2].endswith('AP'): | |
ecid = shsh_path.split('_')[0] | |
device_type = shsh_path.split('_')[1] | |
board = shsh_path.split('_')[2] | |
folder_dict[ecid] = path | |
found = True | |
break; | |
if found == True: | |
break | |
if found == True: | |
break | |
device_type += '_' + board | |
device_dict[ecid] = device_type | |
return (device_dict, folder_dict) | |
def main(): | |
(devices, folders) = get_devices() | |
for ecid in devices: | |
model = devices[ecid].split('_')[0] | |
if model.split(',')[0] == 'iPhone5': | |
continue | |
board = devices[ecid].split('_')[1] | |
version = sys.argv[1] | |
if len(sys.argv) == 3: | |
version += '-' + sys.argv[2] | |
for nonce in apnonces: | |
if model.startswith("iPhone9") or model.startswith("iPhone10") or model.startswith("iPad7") or model.startswith("AppleTV6"): | |
if len(nonce) != 64: | |
continue | |
else: | |
if len(nonce) == 64: | |
continue | |
save_path = './' + folders[ecid] + '/' + version + '/apnonce-' + nonce | |
if not os.path.exists(save_path): | |
os.makedirs(save_path) | |
if len(os.listdir(save_path)) > 0: | |
continue | |
cmd = './tsschecker_v268' + ' -d ' + model + ' -e ' + ecid + ' -s ' + ' --save-path ' + save_path + ' --boardconfig ' + board + ' -i ' + sys.argv[1] + ' --apnonce ' + nonce | |
if len(sys.argv) == 3: | |
cmd += ' --buildid ' + sys.argv[2] | |
print(cmd) | |
subprocess.call(cmd, shell=True) | |
if __name__ == '__main__': | |
main() |
執行方式:
./run.py 版本號 build號(若有需要)
例如./run.py 11.4
或 ./run.py 11.4 15F79
原理:
因為 1conan 抓下來的資料夾裡面有包含裝置主機板、型號、ECID 等資訊,所以這個 script 就是掃一掃這些資訊然後重新湊出下載 SHSH2 的指令。
注意:
- 依照個人需求可能需要修改 tsschecker 執行檔名稱
- 依照個人需求記得擋掉不存 SHSH 的裝置(例如我擋掉了 iPhone 5,因為不支援 iOS 11 以上)
- 我 code 很醜不要笑我。
發佈留言