mirror of
https://github.com/naruxde/revpipyload.git
synced 2025-11-08 15:13:52 +01:00
Hashwerte als Bytes übertragen
16 mal \x00 senden, wenn replace_ios nicht existiert
This commit is contained in:
@@ -387,11 +387,11 @@ class RevPiSlaveDev(Thread):
|
|||||||
self._devcon.send(b'\x04')
|
self._devcon.send(b'\x04')
|
||||||
|
|
||||||
elif cmd == b'PH':
|
elif cmd == b'PH':
|
||||||
# piCtory md5 Hashwert senden (32 Byte)
|
# piCtory md5 Hashwert senden (16 Byte)
|
||||||
try:
|
try:
|
||||||
with open(proginit.pargs.configrsc, "rb") as fh_pic:
|
with open(proginit.pargs.configrsc, "rb") as fh_pic:
|
||||||
# Hashwert erzeugen und senden
|
# Hashwert erzeugen und senden
|
||||||
file_hash = md5(fh_pic.read())
|
file_hash = md5(fh_pic.read()).digest()
|
||||||
proginit.logger.debug(
|
proginit.logger.debug(
|
||||||
"send pictory hashvalue: {0}"
|
"send pictory hashvalue: {0}"
|
||||||
"".format(file_hash)
|
"".format(file_hash)
|
||||||
@@ -429,17 +429,20 @@ class RevPiSlaveDev(Thread):
|
|||||||
self._devcon.send(b'\x04')
|
self._devcon.send(b'\x04')
|
||||||
|
|
||||||
elif cmd == b'RH':
|
elif cmd == b'RH':
|
||||||
# Replace_IOs md5 Hashwert senden (32 Byte)
|
# Replace_IOs md5 Hashwert senden (16 Byte)
|
||||||
replace_ios = proginit.conf["DEFAULT"].get("replace_ios", None)
|
replace_ios = proginit.conf["DEFAULT"].get("replace_ios", "")
|
||||||
try:
|
try:
|
||||||
with open(replace_ios, "rb") as fh:
|
if replace_ios:
|
||||||
# Hashwert erzeugen und senden
|
with open(replace_ios, "rb") as fh:
|
||||||
file_hash = md5(fh.read())
|
# Hashwert erzeugen und senden
|
||||||
proginit.logger.debug(
|
file_hash = md5(fh.read()).digest()
|
||||||
"send replace_ios hashvalue: {0}"
|
else:
|
||||||
"".format(file_hash)
|
file_hash = b'\x00' * 16
|
||||||
)
|
proginit.logger.debug(
|
||||||
self._devcon.sendall(file_hash)
|
"send replace_ios hashvalue: {0}"
|
||||||
|
"".format(file_hash)
|
||||||
|
)
|
||||||
|
self._devcon.sendall(file_hash)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
proginit.logger.error(
|
proginit.logger.error(
|
||||||
"error on replace_ios hash value transfair: {0}"
|
"error on replace_ios hash value transfair: {0}"
|
||||||
|
|||||||
Reference in New Issue
Block a user