using decompyle3 version of BLFlashCommand (note)
Note that the port = sorted command on line 227 is different in all three decompilers, and could be material. Running through the debugger, I believe this is the correct command, though it only applies on Windows
This commit is contained in:
parent
dbd616234d
commit
42ee296a37
|
@ -1,13 +1,9 @@
|
||||||
# uncompyle6 version 3.9.0
|
# decompyle3 version 3.9.0
|
||||||
# Python bytecode version base 3.7.0 (3394)
|
# Python bytecode version base 3.7.0 (3394)
|
||||||
# Decompiled from: Python 3.7.16 (default, Mar 30 2023, 01:25:49)
|
# Decompiled from: Python 3.7.16 (default, Mar 30 2023, 01:25:49)
|
||||||
# [GCC 12.2.1 20220924]
|
# [GCC 12.2.1 20220924]
|
||||||
# Embedded file name: BLFlashCommand.py
|
# Embedded file name: BLFlashCommand.py
|
||||||
"""
|
__doc__ = '\nCreated on 20221216\n\n@author: Dillon\n'
|
||||||
Created on 20221216
|
|
||||||
|
|
||||||
@author: Dillon
|
|
||||||
"""
|
|
||||||
import os, re, sys, argparse, binascii, threading, configparser
|
import os, re, sys, argparse, binascii, threading, configparser
|
||||||
from libs import bflb_utils
|
from libs import bflb_utils
|
||||||
from libs.bflb_utils import get_serial_ports
|
from libs.bflb_utils import get_serial_ports
|
||||||
|
@ -51,7 +47,7 @@ class MainClass:
|
||||||
|
|
||||||
def get_addr_from_partition_by_name(self, name, parition_file, index):
|
def get_addr_from_partition_by_name(self, name, parition_file, index):
|
||||||
try:
|
try:
|
||||||
with open(parition_file, 'rb') as (fp):
|
with open(parition_file, 'rb') as fp:
|
||||||
data = bytearray(fp.read())
|
data = bytearray(fp.read())
|
||||||
fp.close()
|
fp.close()
|
||||||
start = data.find(name.encode('utf-8'))
|
start = data.find(name.encode('utf-8'))
|
||||||
|
@ -59,7 +55,8 @@ class MainClass:
|
||||||
addr = data[start + 9 + index * 4:start + 9 + 4 + index * 4]
|
addr = data[start + 9 + index * 4:start + 9 + 4 + index * 4]
|
||||||
addr.reverse()
|
addr.reverse()
|
||||||
addr = hex(int(binascii.hexlify(addr), 16))
|
addr = hex(int(binascii.hexlify(addr), 16))
|
||||||
return (True, addr)
|
return (
|
||||||
|
True, addr)
|
||||||
print(data)
|
print(data)
|
||||||
print(name.encode('utf-8'))
|
print(name.encode('utf-8'))
|
||||||
return (False, '0')
|
return (False, '0')
|
||||||
|
@ -117,6 +114,11 @@ class MainClass:
|
||||||
self.erase = config.get('cfg', 'erase', fallback=1)
|
self.erase = config.get('cfg', 'erase', fallback=1)
|
||||||
self.skip_mode = config.get('cfg', 'skip_mode', fallback='0x0, 0x0')
|
self.skip_mode = config.get('cfg', 'skip_mode', fallback='0x0, 0x0')
|
||||||
self.boot2_isp_mode = config.get('cfg', 'boot2_isp_mode', fallback=0)
|
self.boot2_isp_mode = config.get('cfg', 'boot2_isp_mode', fallback=0)
|
||||||
|
else:
|
||||||
|
filedir = config.get(item, 'filedir')
|
||||||
|
address = config.get(item, 'address')
|
||||||
|
if not self.get_value_file(item, filedir, address, args.cpu_id):
|
||||||
|
return False
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
try:
|
try:
|
||||||
|
@ -217,7 +219,8 @@ class MainClass:
|
||||||
|
|
||||||
if ports:
|
if ports:
|
||||||
try:
|
try:
|
||||||
port = sorted(ports, key=(lambda x: int(re.match('COM(\\d+)', x).group(1))))[0]
|
port = sorted(ports, key=(lambda x: int(re.match('COM(\\d+)', x).group(1))
|
||||||
|
))[0]
|
||||||
except Exception:
|
except Exception:
|
||||||
port = sorted(ports)[0]
|
port = sorted(ports)[0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user