mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
address clean up
This commit is contained in:
parent
a56ae94f05
commit
0b8cc4ba81
2 changed files with 16 additions and 11 deletions
|
@ -38,7 +38,7 @@ import pyPlcIpv6
|
||||||
from helpers import * # prettyMac etc
|
from helpers import * # prettyMac etc
|
||||||
|
|
||||||
MAC_BROADCAST = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ]
|
MAC_BROADCAST = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ]
|
||||||
MAC_LAPTOP = [0xdc, 0x0e, 0xa1, 0x11, 0x67, 0x08 ]
|
MAC_LAPTOP = [0xdc, 0x0e, 0xa1, 0x11, 0x67, 0x08 ] # Win10 laptop
|
||||||
MAC_RANDOM = [0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff ]
|
MAC_RANDOM = [0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff ]
|
||||||
MAC_ALPI = [0x0A, 0x19, 0x4A, 0x39, 0xD6, 0x98 ] # alpitronics
|
MAC_ALPI = [0x0A, 0x19, 0x4A, 0x39, 0xD6, 0x98 ] # alpitronics
|
||||||
MAC_TPLINK_E4 = [0x98, 0x48, 0x27, 0x5A, 0x3C, 0xE4 ] # TPlink PLC adaptor
|
MAC_TPLINK_E4 = [0x98, 0x48, 0x27, 0x5A, 0x3C, 0xE4 ] # TPlink PLC adaptor
|
||||||
|
@ -144,7 +144,7 @@ class pyPlcHomeplug():
|
||||||
# Destination MAC
|
# Destination MAC
|
||||||
self.fillDestinationMac(MAC_BROADCAST)
|
self.fillDestinationMac(MAC_BROADCAST)
|
||||||
# Source MAC
|
# Source MAC
|
||||||
self.fillSourceMac(MAC_RANDOM)
|
self.fillSourceMac(self.myMAC)
|
||||||
# Protocol
|
# Protocol
|
||||||
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
||||||
self.mytransmitbuffer[13]=0xE1
|
self.mytransmitbuffer[13]=0xE1
|
||||||
|
@ -167,7 +167,7 @@ class pyPlcHomeplug():
|
||||||
self.fillDestinationMac(MAC_BROADCAST)
|
self.fillDestinationMac(MAC_BROADCAST)
|
||||||
# Source MAC
|
# Source MAC
|
||||||
#self.fillSourceMac(MAC_LAPTOP)
|
#self.fillSourceMac(MAC_LAPTOP)
|
||||||
self.fillSourceMac(MAC_RANDOM)
|
self.fillSourceMac(self.myMAC)
|
||||||
# Protocol
|
# Protocol
|
||||||
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
||||||
self.mytransmitbuffer[13]=0xE1
|
self.mytransmitbuffer[13]=0xE1
|
||||||
|
@ -216,7 +216,7 @@ class pyPlcHomeplug():
|
||||||
self.fillDestinationMac(MAC_BROADCAST)
|
self.fillDestinationMac(MAC_BROADCAST)
|
||||||
# Source MAC
|
# Source MAC
|
||||||
#self.fillSourceMac(MAC_LAPTOP)
|
#self.fillSourceMac(MAC_LAPTOP)
|
||||||
self.fillSourceMac(MAC_RANDOM)
|
self.fillSourceMac(self.myMAC)
|
||||||
# Protocol
|
# Protocol
|
||||||
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
||||||
self.mytransmitbuffer[13]=0xE1
|
self.mytransmitbuffer[13]=0xE1
|
||||||
|
@ -274,7 +274,7 @@ class pyPlcHomeplug():
|
||||||
# Destination MAC
|
# Destination MAC
|
||||||
self.fillDestinationMac(self.pevMac)
|
self.fillDestinationMac(self.pevMac)
|
||||||
# Source MAC
|
# Source MAC
|
||||||
self.fillSourceMac(MAC_RANDOM)
|
self.fillSourceMac(self.myMAC)
|
||||||
# Protocol
|
# Protocol
|
||||||
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
||||||
self.mytransmitbuffer[13]=0xE1
|
self.mytransmitbuffer[13]=0xE1
|
||||||
|
@ -306,7 +306,7 @@ class pyPlcHomeplug():
|
||||||
# Destination MAC
|
# Destination MAC
|
||||||
self.fillDestinationMac(self.pevMac)
|
self.fillDestinationMac(self.pevMac)
|
||||||
# Source MAC
|
# Source MAC
|
||||||
self.fillSourceMac(MAC_RANDOM)
|
self.fillSourceMac(self.myMAC)
|
||||||
# Protocol
|
# Protocol
|
||||||
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
||||||
self.mytransmitbuffer[13]=0xE1
|
self.mytransmitbuffer[13]=0xE1
|
||||||
|
@ -339,7 +339,7 @@ class pyPlcHomeplug():
|
||||||
# Destination MAC
|
# Destination MAC
|
||||||
self.fillDestinationMac(self.pevMac)
|
self.fillDestinationMac(self.pevMac)
|
||||||
# Source MAC
|
# Source MAC
|
||||||
self.fillSourceMac(MAC_RANDOM)
|
self.fillSourceMac(self.myMAC)
|
||||||
# Protocol
|
# Protocol
|
||||||
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
self.mytransmitbuffer[12]=0x88 # Protocol HomeplugAV
|
||||||
self.mytransmitbuffer[13]=0xE1
|
self.mytransmitbuffer[13]=0xE1
|
||||||
|
@ -355,7 +355,7 @@ class pyPlcHomeplug():
|
||||||
# 23 - 39: pev_id 17 bytes. All zero in alpi/Ioniq trace.
|
# 23 - 39: pev_id 17 bytes. All zero in alpi/Ioniq trace.
|
||||||
self.fillDestinationMac(self.pevMac, 40) # 40 - 45 pev_mac
|
self.fillDestinationMac(self.pevMac, 40) # 40 - 45 pev_mac
|
||||||
# 46 - 62: evse_id 17 bytes. All zero in alpi/Ioniq trace.
|
# 46 - 62: evse_id 17 bytes. All zero in alpi/Ioniq trace.
|
||||||
self.fillSourceMac(MAC_RANDOM, 63) # 63 - 68 evse_mac
|
self.fillSourceMac(self.myMAC, 63) # 63 - 68 evse_mac
|
||||||
self.fillDestinationMac(self.pevMac, 69) # 69-76 run_id. Is the ioniq mac plus 00 00.
|
self.fillDestinationMac(self.pevMac, 69) # 69-76 run_id. Is the ioniq mac plus 00 00.
|
||||||
# 77 to 84 reserved 0
|
# 77 to 84 reserved 0
|
||||||
self.setNidAt(85) # 85-91 NID. We can nearly freely choose this, but the upper two bits need to be zero
|
self.setNidAt(85) # 85-91 NID. We can nearly freely choose this, but the upper two bits need to be zero
|
||||||
|
@ -581,9 +581,10 @@ class pyPlcHomeplug():
|
||||||
self.NMK = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ] # a default network key
|
self.NMK = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ] # a default network key
|
||||||
self.NID = [ 1, 2, 3, 4, 5, 6, 7 ] # a default network ID
|
self.NID = [ 1, 2, 3, 4, 5, 6, 7 ] # a default network ID
|
||||||
self.pevMac = [0x55, 0x56, 0x57, 0x58, 0x59, 0x5A ] # a default pev MAC
|
self.pevMac = [0x55, 0x56, 0x57, 0x58, 0x59, 0x5A ] # a default pev MAC
|
||||||
|
self.myMAC = MAC_LAPTOP # todo: find this dynamically
|
||||||
self.runningCounter=0
|
self.runningCounter=0
|
||||||
self.ipv6 = pyPlcIpv6.ipv6handler(self.transmit)
|
self.ipv6 = pyPlcIpv6.ipv6handler(self.transmit)
|
||||||
self.ipv6.ownMac = MAC_RANDOM
|
self.ipv6.ownMac = self.myMAC
|
||||||
self.enterEvseMode()
|
self.enterEvseMode()
|
||||||
self.showStatus(prettyMac(self.pevMac), "pevmac")
|
self.showStatus(prettyMac(self.pevMac), "pevmac")
|
||||||
print("sniffer created at " + self.strInterfaceName)
|
print("sniffer created at " + self.strInterfaceName)
|
||||||
|
|
|
@ -188,7 +188,11 @@ class ipv6handler():
|
||||||
def __init__(self, transmitCallback):
|
def __init__(self, transmitCallback):
|
||||||
self.enterEvseMode()
|
self.enterEvseMode()
|
||||||
self.transmit = transmitCallback
|
self.transmit = transmitCallback
|
||||||
self.SeccIp = [ 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0x06, 0xaa, 0xaa, 0xff, 0xfe, 0, 0xaa, 0xaa ] # 16 bytes, a default IPv6 address for the charging station
|
# 16 bytes, a default IPv6 address for the charging station
|
||||||
self.EvccIp = [ 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0x06, 0x65, 0x65, 0xff, 0xfe, 0, 0x64, 0xC3 ] # 16 bytes, a default IPv6 address for the vehicle
|
# self.SeccIp = [ 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0x06, 0xaa, 0xaa, 0xff, 0xfe, 0, 0xaa, 0xaa ]
|
||||||
|
# fe80::e0ad:99ac:52eb:85d3 is the Win10 laptop
|
||||||
|
self.SeccIp = [ 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0xe0, 0xad, 0x99, 0xac, 0x52, 0xeb, 0x85, 0xd3 ]
|
||||||
|
# 16 bytes, a default IPv6 address for the vehicle
|
||||||
|
self.EvccIp = [ 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0x06, 0x65, 0x65, 0xff, 0xfe, 0, 0x64, 0xC3 ]
|
||||||
self.ownMac = [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 ] # 6 bytes own MAC default. Should be overwritten before use.
|
self.ownMac = [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 ] # 6 bytes own MAC default. Should be overwritten before use.
|
||||||
|
|
Loading…
Reference in a new issue