mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
feature: pcapConverter also decodes appHandshake
This commit is contained in:
parent
9e3dc7ca04
commit
fc5e2834f1
1 changed files with 11 additions and 0 deletions
|
@ -87,6 +87,7 @@ def convertPcapToTxt(inputFileName):
|
||||||
t2PreChargeBegin = 0
|
t2PreChargeBegin = 0
|
||||||
t3CurrentDemandBegin = 0
|
t3CurrentDemandBegin = 0
|
||||||
numberOfPackets=0
|
numberOfPackets=0
|
||||||
|
decodeAlsoAsApplHandshake=0
|
||||||
for packet in cap:
|
for packet in cap:
|
||||||
numberOfPackets+=1
|
numberOfPackets+=1
|
||||||
#print(packet)
|
#print(packet)
|
||||||
|
@ -105,6 +106,16 @@ def convertPcapToTxt(inputFileName):
|
||||||
#print(decoded)
|
#print(decoded)
|
||||||
print(sHeader, file=fileOut)
|
print(sHeader, file=fileOut)
|
||||||
print(decoded, file=fileOut)
|
print(decoded, file=fileOut)
|
||||||
|
if (decodeAlsoAsApplHandshake>0): # if it may be applHandShake, caused by the previous message, we decode also this.
|
||||||
|
print("Alternative decoding as applHandshake", file=fileOut)
|
||||||
|
decodeAlsoAsApplHandshake-=1
|
||||||
|
decoded=exiConnector.exiDecode(strExi, "DH")
|
||||||
|
print(decoded, file=fileOut)
|
||||||
|
if (decoded.find("error-")>0): # a decoding error usually points to wrong protocol, so most likely it is appHandShake.
|
||||||
|
print("maybe this is no DIN. Trying to decode as applHandshake", file=fileOut)
|
||||||
|
decodeAlsoAsApplHandshake=1
|
||||||
|
decoded=exiConnector.exiDecode(strExi, "DH")
|
||||||
|
print(decoded, file=fileOut)
|
||||||
if (decoded.find("SessionSetupReq")>0):
|
if (decoded.find("SessionSetupReq")>0):
|
||||||
if ((t1CableCheckBegin>0) and (t2PreChargeBegin>t1CableCheckBegin) and (t3CurrentDemandBegin>t2PreChargeBegin)):
|
if ((t1CableCheckBegin>0) and (t2PreChargeBegin>t1CableCheckBegin) and (t3CurrentDemandBegin>t2PreChargeBegin)):
|
||||||
print("charger MAC " + chargerMAC + " " + getManufacturerFromMAC(chargerMAC))
|
print("charger MAC " + chargerMAC + " " + getManufacturerFromMAC(chargerMAC))
|
||||||
|
|
Loading…
Reference in a new issue