Skip to content

Instantly share code, notes, and snippets.

@hirakujira
Last active July 19, 2018 06:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirakujira/0b2769c611a55f80b1dc29dfe040931d to your computer and use it in GitHub Desktop.
Save hirakujira/0b2769c611a55f80b1dc29dfe040931d to your computer and use it in GitHub Desktop.
grab SHSH2 automatically
#!/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()
@hirakujira
Copy link
Author

You should have folders with blobs that downloaded from 1conan first!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment