Fixed imports and some minor lint issues

This commit is contained in:
Daniel Kutik 2021-02-09 23:20:01 +08:00
parent 4bbb612b91
commit f89eb79081
10 changed files with 15 additions and 14 deletions

View file

@ -3,6 +3,7 @@ import platform
import time
import json
from struct import unpack
from binascii import hexlify
from Library.utils import *
from Library.gpt import gpt
from Library.sparse import QCSparse

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python3
import binascii
from binascii import hexlify
from Library.utils import *
@ -179,7 +179,7 @@ class gpt(metaclass=LogBase):
guid2 = struct.unpack("<H", partentry["unique"][0x4:0x6])[0]
guid3 = struct.unpack("<H", partentry["unique"][0x6:0x8])[0]
guid4 = struct.unpack("<H", partentry["unique"][0x8:0xA])[0]
guid5 = binascii.hexlify(partentry["unique"][0xA:0x10]).decode('utf-8')
guid5 = hexlify(partentry["unique"][0xA:0x10]).decode('utf-8')
pa.unique = "{:08x}-{:04x}-{:04x}-{:04x}-{}".format(guid1, guid2, guid3, guid4, guid5)
pa.sector = partentry["first_lba"]
pa.sectors = partentry["last_lba"] - partentry["first_lba"] + 1

View file

@ -120,7 +120,7 @@ class hdlc:
def receive_reply(self,timeout=None):
replybuf = bytearray()
if timeout==None:
if timeout is None:
timeout=self.timeout
tmp = self.cdc.read(MAX_PACKET_LEN, timeout)
if tmp == bytearray():
@ -155,7 +155,7 @@ class hdlc:
def receive_reply_nocrc(self,timeout=None):
replybuf = bytearray()
if timeout==None:
if timeout is None:
timeout=self.timeout
tmp = self.cdc.read(MAX_PACKET_LEN, timeout)
if tmp == bytearray():

View file

@ -6,6 +6,7 @@ import usb.util
import time
import inspect
from Library.utils import *
from binascii import hexlify
USB_DIR_OUT = 0 # to device
USB_DIR_IN = 0x80 # to host

View file

@ -8,7 +8,6 @@ import shutil
import stat
import colorama
import copy
from binascii import hexlify
try:
from capstone import *

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# Beagle to EDL Loader (c) B.Kerler 2021
import os,sys
import sys
from struct import unpack
def main():

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python3
import os
import sys
from os import walk
import hashlib
from struct import unpack, pack
from struct import unpack
from shutil import copyfile
try:
from Library.utils import elf

2
edl.py
View file

@ -254,7 +254,7 @@ class main(metaclass=LogBase):
self.exit()
# print((mode, resp))
if mode == "sahara":
if resp==None:
if resp is None:
if mode=="sahara":
print("Sahara in error state, resetting ...")
self.sahara.cmd_reset()

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
'''
"""
Licensed under MIT License, (c) B. Kerler 2018-2019
'''
"""
default_vid_pid = [
[0x2c7c, 0x0125, -1], # Quectel EC25
[0x1199, 0x9071, -1], # Sierra Wireless
@ -17,8 +17,6 @@ default_vid_pid = [
]
import sys
import os
import argparse
import json
import logging
@ -649,7 +647,7 @@ class qcdiag(metaclass=LogBase):
if len(res) > 0:
if res[0] == 0x27:
res, nvitem = self.read_nvitem(item)
if res == False:
if not res:
print(f"Error while writing nvitem {hex(item)} data, %s" % data)
else:
if nvitem.data != data:

View file

@ -6,4 +6,7 @@ pylzma>=0.5.0
pycryptodome
lxml>=4.6.1
colorama
usb
capstone
keystone-engine