forked from mineek/sunst0rm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.py
34 lines (32 loc) · 1.19 KB
/
api.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
import requests
from remotezip import RemoteZip
def get_keys(identifier, board, buildid):
try:
f = requests.get(f"https://api.m1sta.xyz/wikiproxy/{identifier}/{board}/{buildid}").json()
except Exception:
if input(f"[?] Keys not found for this IPSW ({buildid}) for the board {board}. Do you want to enter keys manually? (y/n) ") == "y":
iBSS_iv = input(" - Enter the iBSS IV: ")
iBSS_key = input(" - Enter the iBSS Key: ")
iBEC_iv = input(" - Enter the iBEC IV: ")
iBEC_key = input(" - Enter the iBEC Key: ")
return iBSS_iv, iBSS_key, iBEC_iv, iBEC_key
else:
exit()
print("Requesting keys...")
for dev in f['keys']:
if dev['image'] == "iBSS":
iBSS_iv = dev['iv']
iBSS_key = dev['key']
if dev['image'] == "iBEC":
iBEC_iv = dev['iv']
iBEC_key = dev['key']
try:
return iBSS_iv, iBSS_key, iBEC_iv, iBEC_key
except UnboundLocalError:
print("[WARNING] Unable to get firmware keys, either the bootchain is not encrypted or the wikiproxy does not have it.")
input("Continue or not? (Press ENTER to continue, Ctrl-C to quit)")
def partialzip_download(url, file, dest):
with RemoteZip(url) as zip:
data = zip.read(file)
with open(dest, 'wb') as f:
f.write(data)