Remove Some useless Codes

This commit is contained in:
ColdWindScholar 2024-06-10 01:25:50 +08:00
parent 7f14a79019
commit 7157514853
7 changed files with 22 additions and 16 deletions

View file

@ -8,11 +8,13 @@
import inspect
import traceback
from binascii import hexlify
try:
from edlclient.Library.utils import *
except:
from Library.utils import *
class DeviceClass(metaclass=LogBase):
def __init__(self, loglevel=logging.INFO, portconfig=None, devclass=-1):
@ -117,7 +119,7 @@ class DeviceClass(metaclass=LogBase):
stack_trace = traceback.format_stack(frame)
td = []
for trace in stack_trace:
if not "verify_data" in trace and not "Port" in trace:
if "verify_data" not in trace and "Port" not in trace:
td.append(trace)
self.debug(td[:-1])

View file

@ -17,7 +17,7 @@ class nothing(metaclass=LogBase):
loglevel=logging.INFO):
self.fh = fh
self.projid = projid
#self.projid == "22111":
# self.projid == "22111":
self.hashverify = "16386b4035411a770b12507b2e30297c0c5471230b213e6a1e1e701c6a425150"
self.serial = serial
self.supported_functions = supported_functions

View file

@ -469,18 +469,12 @@ class cryptutils:
if salt is not None:
inBlock = b"\x00" * 8 + msghash + salt
mhash = self.hash(inBlock)
if mhash == mhash:
return True
else:
return False
return mhash == mhash
else:
salt = TS[-self.digestLen:]
inBlock = b"\x00" * 8 + msghash + salt
mhash = self.hash(inBlock)
if mhash == mhash:
return True
else:
return False
return mhash == mhash
class hash:
def __init__(self, hashtype="SHA256"):

View file

@ -30,11 +30,13 @@ try:
except ImportError:
print("Keystone library is missing (optional).")
def is_windows():
if sys.platform == 'win32' or sys.platform == 'win64' or sys.platform == 'winnt':
return True
return False
class structhelper_io:
pos = 0
@ -84,6 +86,7 @@ class structhelper_io:
def seek(self, pos):
self.data.seek(pos)
def find_binary(data, strf, pos=0):
t = strf.split(b".")
pre = 0
@ -114,6 +117,7 @@ def find_binary(data, strf, pos=0):
pre += 1
return None
class progress:
def __init__(self, pagesize):
self.progtime = 0
@ -152,7 +156,7 @@ class progress:
total // self.pagesize,
0), bar_length=10)
if prog > self.prog or prog==100.0:
if prog > self.prog or prog == 100.0:
if display:
t0 = time.time()
tdiff = t0 - self.progtime
@ -189,6 +193,7 @@ class progress:
self.progpos = pos
self.progtime = t0
class structhelper:
pos = 0
@ -249,6 +254,7 @@ class structhelper:
def seek(self, pos):
self.pos = pos
def do_tcp_server(client, arguments, handler):
def tcpprint(arg):
if isinstance(arg, bytes) or isinstance(arg, bytearray):

View file

@ -284,6 +284,9 @@ def main():
help='use logfile for debug log',
default="")
args = parser.parse_args()
if not args.port:
parser.print_help()
return
dw = dwnloadtools()
dw.run(args)

View file

@ -5,13 +5,14 @@
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import argparse
import hashlib
import time
from Exscript.protocols.telnetlib import Telnet
import requests
import serial
import serial.tools.list_ports
import argparse
import requests
import hashlib
from Exscript.protocols.telnetlib import Telnet
try:
from edlclient.Tools.qc_diag import qcdiag

View file

@ -7,7 +7,7 @@
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
# TXT to EDL Loader (c) B.Kerler 2023
import os, sys
import sys
from struct import unpack