mirror of
https://github.com/bkerler/edl.git
synced 2024-11-24 08:27:58 -05:00
Normative code
This commit is contained in:
parent
1a1bec8671
commit
3b9a6927fb
10 changed files with 27 additions and 30 deletions
|
@ -172,7 +172,7 @@ class serial_class(DeviceClass):
|
|||
bytestoread = resplen - len(info)
|
||||
extend(info)
|
||||
if b"<?xml " in info:
|
||||
while not b"response " in res or res[-7:] != b"</data>":
|
||||
while b"response " not in res or res[-7:] != b"</data>":
|
||||
extend(epr(1))
|
||||
return res
|
||||
bytestoread = resplen
|
||||
|
|
|
@ -575,11 +575,11 @@ def main():
|
|||
op2 = oneplus(None, projid="20889", serial=serial, ATOBuild=0, Flash_Mode=0, cf=0)
|
||||
op2.ops.device_timestamp = int(device_timestamp)
|
||||
# 20889 OP N10 5G Europe
|
||||
print(f"./edl.py rawxml \"<?xml version=\\\"1.0\\\" ?><data><setprocstart /></data>\"")
|
||||
print('./edl.py rawxml "<?xml version=\\"1.0\\" ?><data><setprocstart /></data>"')
|
||||
# Response should be : <?xml version="1.0" ?><data><response value=1 device_timestamp="%llu" /></data>
|
||||
pk, token = op2.generatetoken(False)
|
||||
print(
|
||||
f"./edl.py rawxml \"<?xml version=\\\"1.0\\\" ?><data><setswprojmodel " +
|
||||
'./edl.py rawxml "<?xml version=\\"1.0\\" ?><data><setswprojmodel ' +
|
||||
f"token=\\\"{token}\\\" pk=\\\"{pk}\\\" /></data>\" --debugmode")
|
||||
elif args["setprojmodel_verify"]:
|
||||
projid = args["--projid"][0]
|
||||
|
@ -618,8 +618,7 @@ def main():
|
|||
|
||||
|
||||
def test_setswprojmodel_verify():
|
||||
deviceresp = b"RX:<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\nRX:<data>\nRX:<response value=\"ACK\" " + \
|
||||
b"device_timestamp=\"2507003650\" /></data>\n<?xmlversion=\"1.0\" ? ><data><setprocstart /></data>"
|
||||
deviceresp = b'RX:<?xml version="1.0" encoding="UTF-8" ?>\nRX:<data>\nRX:<response value="ACK" device_timestamp="2507003650" /></data>\n<?xmlversion="1.0" ? ><data><setprocstart /></data>'
|
||||
projid = "20889"
|
||||
op = oneplus(None, projid=projid, serial=123456)
|
||||
data = deviceresp.decode('utf-8')
|
||||
|
|
|
@ -328,7 +328,7 @@ class firehose(metaclass=LogBase):
|
|||
def cmd_reset(self, mode="reset"):
|
||||
if mode is None:
|
||||
mode = "reset"
|
||||
data = "<?xml version=\"1.0\" ?><data><power value=\"" + mode + "\"/></data>"
|
||||
data = f'<?xml version="1.0" ?><data><power value="{mode}"/></data>'
|
||||
val = self.xmlsend(data)
|
||||
try:
|
||||
v = None
|
||||
|
@ -361,7 +361,7 @@ class firehose(metaclass=LogBase):
|
|||
return val.error
|
||||
|
||||
def cmd_nop(self):
|
||||
data = "<?xml version=\"1.0\" ?><data><nop /></data>"
|
||||
data = '<?xml version="1.0" ?><data><nop /></data>'
|
||||
resp = self.xmlsend(data, True)
|
||||
self.debug(resp.data.hex())
|
||||
info = b""
|
||||
|
@ -1241,7 +1241,7 @@ class firehose(metaclass=LogBase):
|
|||
if len(imei) != 16:
|
||||
self.info("IMEI must be 16 digits")
|
||||
return False
|
||||
data = "<?xml version=\"1.0\" ?><data><writeIMEI len=\"16\"/></data>"
|
||||
data = '<?xml version="1.0" ?><data><writeIMEI len="16"/></data>'
|
||||
val = self.xmlsend(data)
|
||||
if val.resp:
|
||||
self.info("writeIMEI succeeded.")
|
||||
|
@ -1251,7 +1251,7 @@ class firehose(metaclass=LogBase):
|
|||
return False
|
||||
|
||||
def cmd_getstorageinfo(self):
|
||||
data = "<?xml version=\"1.0\" ?><data><getstorageinfo physical_partition_number=\"0\"/></data>"
|
||||
data = '<?xml version="1.0" ?><data><getstorageinfo physical_partition_number="0"/></data>'
|
||||
val = self.xmlsend(data)
|
||||
if val.data == '' and val.log == '' and val.resp:
|
||||
return None
|
||||
|
@ -1266,7 +1266,7 @@ class firehose(metaclass=LogBase):
|
|||
if len(v) > 1:
|
||||
res[v[0]] = v[1]
|
||||
else:
|
||||
if "\"storage_info\"" in value:
|
||||
if '"storage_info"' in value:
|
||||
try:
|
||||
info = value.replace("INFO:", "")
|
||||
si = json.loads(info)["storage_info"]
|
||||
|
@ -1524,7 +1524,7 @@ class firehose(metaclass=LogBase):
|
|||
def cmd_test(self, cmd):
|
||||
token = "1234"
|
||||
pk = "1234"
|
||||
data = "<?xml version=\"1.0\" ?>\n<data>\n<" + cmd + " token=\"" + token + "\" pk=\"" + pk + "\" />\n</data>"
|
||||
data = f'<?xml version="1.0" ?>\n<data>\n<{cmd} token="{token}" pk="{pk}" />\n</data>'
|
||||
val = self.xmlsend(data)
|
||||
if val.resp:
|
||||
if b"raw hex token" in val[2]:
|
||||
|
@ -1534,7 +1534,7 @@ class firehose(metaclass=LogBase):
|
|||
return False
|
||||
|
||||
def cmd_getstorageinfo_string(self):
|
||||
data = "<?xml version=\"1.0\" ?><data><getstorageinfo /></data>"
|
||||
data = '<?xml version="1.0" ?><data><getstorageinfo /></data>'
|
||||
val = self.xmlsend(data)
|
||||
if val.resp:
|
||||
self.info(f"GetStorageInfo:\n--------------------\n")
|
||||
|
|
|
@ -194,7 +194,6 @@ AB_SLOT_INACTIVE_VAL = 0x0
|
|||
AB_SLOT_ACTIVE = 1
|
||||
AB_SLOT_INACTIVE = 0
|
||||
|
||||
|
||||
PART_ATT_PRIORITY_BIT = 48
|
||||
PART_ATT_ACTIVE_BIT = 50
|
||||
PART_ATT_MAX_RETRY_CNT_BIT = 51
|
||||
|
@ -350,7 +349,6 @@ class gpt(metaclass=LogBase):
|
|||
def parseheader(self, gptdata, sectorsize=512):
|
||||
return self.gpt_header(gptdata[sectorsize:sectorsize + 0x5C])
|
||||
|
||||
|
||||
def parse(self, gptdata, sectorsize=512):
|
||||
self.header = self.gpt_header(gptdata[sectorsize:sectorsize + 0x5C])
|
||||
self.sectorsize = sectorsize
|
||||
|
@ -415,7 +413,8 @@ class gpt(metaclass=LogBase):
|
|||
mstr = "\nGPT Table:\n-------------\n"
|
||||
for partitionname in self.partentries:
|
||||
partition = self.partentries[partitionname]
|
||||
active = ((partition.flags >> (AB_FLAG_OFFSET*8))&0xFF) & AB_PARTITION_ATTR_SLOT_ACTIVE == AB_PARTITION_ATTR_SLOT_ACTIVE
|
||||
active = ((partition.flags >> (
|
||||
AB_FLAG_OFFSET * 8)) & 0xFF) & AB_PARTITION_ATTR_SLOT_ACTIVE == AB_PARTITION_ATTR_SLOT_ACTIVE
|
||||
mstr += ("{:20} Offset 0x{:016x}, Length 0x{:016x}, Flags 0x{:016x}, UUID {}, Type {}, Active {}\n".format(
|
||||
partition.name + ":", partition.sector * self.sectorsize, partition.sectors * self.sectorsize,
|
||||
partition.flags, partition.unique, partition.type, active))
|
||||
|
|
|
@ -50,7 +50,7 @@ def pt32_walk(data, ttbr, skip):
|
|||
i += 1
|
||||
if i <= skip:
|
||||
continue
|
||||
if type(fl) == pt.pt_desc:
|
||||
if isinstance(fl, pt.pt_desc):
|
||||
print("")
|
||||
print("Second level (va = %08x)" % va)
|
||||
print("---------------------------------------------")
|
||||
|
|
|
@ -17,7 +17,6 @@ parent_dir = os.path.dirname(current_dir)
|
|||
sys.path.insert(0, parent_dir)
|
||||
from edlclient.Library.utils import LogBase, print_progress
|
||||
|
||||
|
||||
MAX_STORE_SIZE = 1024 * 1024 * 1024 * 2 # 2 GBs
|
||||
|
||||
|
||||
|
|
|
@ -508,7 +508,7 @@ class SierraKeygen(metaclass=LogBase):
|
|||
devicegeneration = "MDM9x30_V1"
|
||||
else:
|
||||
devicegeneration = "MDM9x30"
|
||||
elif "9X40" in revision and not "9X40C" in revision:
|
||||
elif "9X40" in revision and "9X40C" not in revision:
|
||||
devicegeneration = "MDM9x40"
|
||||
elif "9X50" in revision:
|
||||
if "NTG9X50" in revision:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Challenge/Response Generator for Sierra Wireless Cards V1.2
|
||||
(c) B. Kerler 2019-2023
|
||||
(c) B. Kerler 2019-2024
|
||||
GPLv3 License
|
||||
|
||||
## Why
|
||||
|
|
Loading…
Reference in a new issue