-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtssUtils.py
79 lines (71 loc) · 3.05 KB
/
tssUtils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import requests, subprocess, os, csv, utils
def signedVersionChecker(model, isBeta, dlType):
URL = None
ipsw = []
if dlType:
dlType = "ota"
else:
dlType = "ipsw"
if isBeta:
URL = "https://api.m1sta.xyz/betas/" + model
print("\n[TSS BETA] Using:", URL)
if not isBeta:
URL = "https://api.ipsw.me/v4/device/" + model + "?type=%s"%dlType
print("\n[TSS] Using:", URL)
req = requests.get(URL)
print("-- Checking Currently Signed iOS Versions --")
print("[API] Response Code: [" + str(req.status_code) + "]")
if req.status_code == 200:
req = req.json()
print("-- Server Response --")
if isBeta:
for i in range(len(req)):
if req[i]['signed'] == True:
print("[TSS BETA Signed] iOS:", req[i]['version'], "build:", req[i]['buildid'], "is currently being Signed for the", model)
ipsw.append(req[i]['buildid'])
else:
break
else:
for i in range(len(req["firmwares"])):
if req["firmwares"][i]["signed"] == True:
print("[TSS Signed] iOS:", req["firmwares"][i]["version"], "build:", req["firmwares"][i]['buildid'], "is currently being Signed for the", model)
ipsw.append(req["firmwares"][i]["buildid"])
else:
break
return ipsw
def ipswGrabber(model, version, isBeta, dlType):
URL = None
ipsw = []
if dlType:
dlType = "ota"
else:
dlType = "ipsw"
if isBeta:
URL = "https://api.m1sta.xyz/betas/" + model
print("\n[TSS BETA] Using:", URL)
else:
URL = "https://api.ipsw.me/v4/device/" + model + "?type=%s"%dlType
print("\n[TSS] Using:", URL)
req = requests.get(URL)
print("-- Fetching IPSW --")
print("[API IPSW] Response Code: [" + str(req.status_code) + "]")
if req.status_code == 200:
req = req.json()
print("-- Server Response --")
if isBeta:
try:
for i in range(len(req)):
if req[i]['buildid'] == version:
ipsw.append({ "version": version, "buildid": req[i]['buildid'], "url": req[i]['url']})
print("[TSS BETA Download] %s iOS:" %model, req[i]['version'], "buildid:", req[i]['buildid'], "URL:", req[i]['url'])
except:
return("No IPSW found for: %s" %model + " on: %s" %version)
if not isBeta:
try:
for i in range(len(req["firmwares"])):
if req["firmwares"][i]["buildid"] == version:
ipsw.append({ "version": version, "buildid": req["firmwares"][i]['buildid'], "url": req['firmwares'][i]['url']})
print("[TSS Download] %s iOS:" %model, req["firmwares"][i]["version"], "buildid:", req["firmwares"][i]['buildid'], "URL:", req['firmwares'][i]['url'])
except:
return("No IPSW found for: %s" %model + " on: %s" %version)
return ipsw