From 521b81b4eb215c8aa894b19b0e1b768c95cc93f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20L=C3=B6w?= Date: Thu, 12 Sep 2024 18:39:50 +0200 Subject: [PATCH 1/4] :art: seperate SLAC and SDP handling into seperate classes Co-authored-by: vvvasu --- EVSE.py | 66 ++++++++++++++++++++------------ PEV.py | 115 +++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 115 insertions(+), 66 deletions(-) diff --git a/EVSE.py b/EVSE.py index b782e24..313a8a7 100644 --- a/EVSE.py +++ b/EVSE.py @@ -59,6 +59,7 @@ def __init__(self, args): self.exi = EXIProcessor(self.protocol) self.slac = _SLACHandler(self) + self.sdp = _SDPHandler(self) self.tcp = _TCPHandler(self) # I2C bus for relays @@ -78,6 +79,7 @@ def start(self): self.toggleProximity() self.doSLAC() + self.doSDP() self.doTCP() # If NMAP is not done, restart connection if not self.tcp.finishedNMAP: @@ -109,6 +111,10 @@ def doTCP(self): self.tcp.start() print("INFO (EVSE): Done TCP") + def doSDP(self): + self.sdp.start() + print("INFO (EVSE): Done SDP") + # Starts SLAC thread that handles layer 2 comms def doSLAC(self): self.slac.start() @@ -155,22 +161,13 @@ def startSniff(self): sniff(iface=self.iface, prn=self.handlePacket, stop_filter=self.stopSniff) def stopSniff(self, pkt): - if pkt.haslayer("SECC_RequestMessage"): - print("INDO (EVSE): Recieved SECC_RequestMessage") - # self.evse.destinationMAC = pkt[Ether].src - # use this to send 3 secc responses incase car doesnt see one - self.destinationIP = pkt[IPv6].src - self.destinationPort = pkt[UDP].sport - Thread(target=self.sendSECCResponse).start() + if pkt.haslayer("CM_SLAC_MATCH_REQ"): + print("INFO (EVSE): Recieved SLAC_MATCH_REQ") + print("INFO (EVSE): Sending SLAC_MATCH_CNF") + sendp(self.buildSlacMatchCnf(), iface=self.iface, verbose=0) self.stop = True return self.stop - def sendSECCResponse(self): - time.sleep(0.2) - for i in range(3): - print("INFO (EVSE): Sending SECC_ResponseMessage") - sendp(self.buildSECCResponse(), iface=self.iface, verbose=0) - def handlePacket(self, pkt): if pkt[Ether].type != 0x88E1 or pkt[Ether].src == self.sourceMAC: return @@ -189,11 +186,6 @@ def handlePacket(self, pkt): print("INFO (EVSE): Sending ATTEN_CHAR_IND") sendp(self.buildAttenCharInd(), iface=self.iface, verbose=0) - if pkt.haslayer("CM_SLAC_MATCH_REQ"): - print("INFO (EVSE): Recieved SLAC_MATCH_REQ") - print("INFO (EVSE): Sending SLAC_MATCH_CNF") - sendp(self.buildSlacMatchCnf(), iface=self.iface, verbose=0) - def buildSlacParmCnf(self): ethLayer = Ether() ethLayer.src = self.sourceMAC @@ -348,13 +340,41 @@ def buildSetKey(self): responsePacket = ethLayer / homePlugAVLayer / homePlugLayer return responsePacket +class _SDPHandler: + def __init__(self, evse: EVSE): + self.evse = evse + + self.destinationIP = None + self.destinationPort = None + + def start(self): + sniff(iface=self.evse.iface, stop_filter=self.stopSniff) + + def stopSniff(self, pkt): + if pkt.haslayer("SECC_RequestMessage"): + print("INDO (EVSE): Recieved SECC_RequestMessage") + # self.evse.destinationMAC = pkt[Ether].src + # use this to send 3 secc responses incase car doesnt see one + self.destinationIP = pkt[IPv6].src + self.destinationPort = pkt[UDP].sport + Thread(target=self.sendSECCResponse).start() + return True + return False + + def sendSECCResponse(self): + time.sleep(0.2) + for i in range(3): + print("INFO (EVSE): Sending SECC_ResponseMessage") + sendp(self.buildSECCResponse(), iface=self.evse.iface, verbose=0) + + def buildSECCResponse(self): e = Ether() - e.src = self.sourceMAC - e.dst = self.destinationMAC + e.src = self.evse.sourceMAC + e.dst = self.evse.destinationMAC ip = IPv6() - ip.src = self.sourceIP + ip.src = self.evse.sourceIP ip.dst = self.destinationIP udp = UDP() @@ -367,8 +387,8 @@ def buildSECCResponse(self): seccRM = SECC_ResponseMessage() seccRM.SecurityProtocol = 16 - seccRM.TargetPort = self.sourcePort - seccRM.TargetAddress = self.sourceIP # eno1 + seccRM.TargetPort = self.evse.sourcePort + seccRM.TargetAddress = self.evse.sourceIP # eno1 responsePacket = e / ip / udp / secc / seccRM return responsePacket diff --git a/PEV.py b/PEV.py index fdde028..58644f6 100644 --- a/PEV.py +++ b/PEV.py @@ -56,6 +56,7 @@ def __init__(self, args): self.exi = EXIProcessor(self.protocol) self.slac = _SLACHandler(self) + self.sdp = _SDPHandler(self) self.tcp = _TCPHandler(self) # I2C bus for relays @@ -75,6 +76,7 @@ def start(self): self.toggleProximity() self.doSLAC() + self.doSDP() self.doTCP() # If NMAP is not done, restart connection if not self.tcp.finishedNMAP: @@ -85,6 +87,12 @@ def doTCP(self): self.tcp.start() print("INFO (PEV) : Done TCP") + def doSDP(self): + print("INFO (PEV) : Starting SDP") + self.sdp.start() + self.sdp.sniffThread.join() + print("INFO (PEV) : Done SDP") + def doSLAC(self): print("INFO (PEV) : Starting SLAC") self.slac.start() @@ -160,11 +168,18 @@ def startSniff(self): # Stop the thread when the slac match is done def stopSniff(self, pkt): - if pkt.haslayer("SECC_ResponseMessage"): - self.pev.destinationIP = pkt[SECC_ResponseMessage].TargetAddress - self.pev.destinationPort = pkt[SECC_ResponseMessage].TargetPort + if pkt.haslayer("CM_SLAC_MATCH_CNF"): + print("INFO (PEV) : Recieved SLAC_MATCH_CNF") + self.NID = pkt[CM_SLAC_MATCH_CNF].VariableField.NetworkID + self.NMK = pkt[CM_SLAC_MATCH_CNF].VariableField.NMK + print("INFO (PEV) : Sending SET_KEY_REQ") + sendp(self.buildSetKeyReq(), iface=self.iface, verbose=0) + time.sleep(3) # give modem some time to reboot + if self.neighborSolicitationThread.running: self.neighborSolicitationThread.stop() + + self.stop = True return True return False @@ -202,21 +217,6 @@ def handlePacket(self, pkt): self.timeSinceLastPkt = time.time() return - if pkt.haslayer("CM_SLAC_MATCH_CNF"): - print("INFO (PEV) : Recieved SLAC_MATCH_CNF") - self.NID = pkt[CM_SLAC_MATCH_CNF].VariableField.NetworkID - self.NMK = pkt[CM_SLAC_MATCH_CNF].VariableField.NMK - print("INFO (PEV) : Sending SET_KEY_REQ") - sendp(self.buildSetKeyReq(), iface=self.iface, verbose=0) - self.stop = True - Thread(target=self.sendSECCRequest).start() - return - - def sendSECCRequest(self): - time.sleep(3) - print("INFO (PEV) : Sending 3 SECC_RequestMessage") - for i in range(1): - sendp(self.buildSECCRequest(), iface=self.iface, verbose=0) def sendSounds(self): self.numRemainingSounds = self.numSounds @@ -344,31 +344,6 @@ def buildSetKeyReq(self): responsePacket = ethLayer / homePlugAVLayer / homePlugLayer return responsePacket - def buildSECCRequest(self): - ethLayer = Ether() - ethLayer.src = self.sourceMAC - ethLayer.dst = "33:33:00:00:00:01" - - ipLayer = IPv6() - ipLayer.src = self.sourceIP - ipLayer.dst = "ff02::1" - ipLayer.hlim = 255 - - udpLayer = UDP() - udpLayer.sport = self.pev.sourcePort - udpLayer.dport = 15118 - - seccLayer = SECC() - seccLayer.SECCType = 0x9000 - seccLayer.PayloadLen = 2 - - seccRequestLayer = SECC_RequestMessage() - seccRequestLayer.SecurityProtocol = 16 - seccRequestLayer.TransportProtocol = 0 - - responsePacket = ethLayer / ipLayer / udpLayer / seccLayer / seccRequestLayer - return responsePacket - def buildNeighborAdvertisement(self): ethLayer = Ether() ethLayer.src = self.sourceMAC @@ -402,6 +377,60 @@ def sendNeighborSoliciation(self, pkt): # print("INFO (EVSE): Sending Neighor Advertisement") sendp(self.buildNeighborAdvertisement(), iface=self.iface, verbose=0) +class _SDPHandler: + def __init__(self, pev: PEV): + self.pev = pev + + # This method starts the slac process and will stop + def start(self): + self.runID = os.urandom(8) + self.stop = False + # Thread for sniffing packets and handling responses + # self.sniffThread = Thread(target=self.startSniff) + # self.sniffThread.start() + + self.sniffThread = AsyncSniffer(iface=self.pev.iface, stop_filter=self.stopSniff) + self.sniffThread.start() + + self.sendSECCRequest() + + # Stop the thread when the slac match is done + def stopSniff(self, pkt): + if pkt.haslayer("SECC_ResponseMessage"): + self.pev.destinationIP = pkt[SECC_ResponseMessage].TargetAddress + self.pev.destinationPort = pkt[SECC_ResponseMessage].TargetPort + return True + return False + + def sendSECCRequest(self): + print("INFO (PEV) : Sending 3 SECC_RequestMessage") + for i in range(1): + sendp(self.buildSECCRequest(), iface=self.pev.iface, verbose=0) + + def buildSECCRequest(self): + ethLayer = Ether() + ethLayer.src = self.pev.sourceMAC + ethLayer.dst = "33:33:00:00:00:01" + + ipLayer = IPv6() + ipLayer.src = self.pev.sourceIP + ipLayer.dst = "ff02::1" + ipLayer.hlim = 255 + + udpLayer = UDP() + udpLayer.sport = self.pev.sourcePort + udpLayer.dport = 15118 + + seccLayer = SECC() + seccLayer.SECCType = 0x9000 + seccLayer.PayloadLen = 2 + + seccRequestLayer = SECC_RequestMessage() + seccRequestLayer.SecurityProtocol = 16 + seccRequestLayer.TransportProtocol = 0 + + responsePacket = ethLayer / ipLayer / udpLayer / seccLayer / seccRequestLayer + return responsePacket class _TCPHandler: def __init__(self, pev: PEV): From e29fe53e0bd0e954154acc4027f75748e18513dc Mon Sep 17 00:00:00 2001 From: vvvasu Date: Thu, 12 Sep 2024 14:50:12 +0200 Subject: [PATCH 2/4] :construction: comment out I2C bus code to make this work fully virtually --- EVSE.py | 10 +++++----- PEV.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/EVSE.py b/EVSE.py index 313a8a7..f876a5c 100644 --- a/EVSE.py +++ b/EVSE.py @@ -63,7 +63,7 @@ def __init__(self, args): self.tcp = _TCPHandler(self) # I2C bus for relays - self.bus = SMBus(1) + # self.bus = SMBus(1) # Constants for i2c controlled relays self.I2C_ADDR = 0x20 @@ -75,7 +75,7 @@ def __init__(self, args): # Start the emulator def start(self): # Initialize the I2C bus for wwrite - self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) + # self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) self.toggleProximity() self.doSLAC() @@ -90,15 +90,15 @@ def start(self): def closeProximity(self): if self.modified_cordset: print("INFO (EVSE): Closing CP/PP relay connections") - self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_PP | self.EVSE_CP) + # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_PP | self.EVSE_CP) else: print("INFO (EVSE): Closing CP relay connection") - self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_CP) + # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_CP) # Close the circuit for the proximity pins def openProximity(self): print("INFO (EVSE): Opening CP/PP relay connections") - self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) + # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) # Opens and closes proximity circuit with a delay def toggleProximity(self, t: int = 5): diff --git a/PEV.py b/PEV.py index 58644f6..3392f57 100644 --- a/PEV.py +++ b/PEV.py @@ -60,7 +60,7 @@ def __init__(self, args): self.tcp = _TCPHandler(self) # I2C bus for relays - self.bus = SMBus(1) + # self.bus = SMBus(1) # Constants for i2c controlled relays self.I2C_ADDR = 0x20 @@ -72,7 +72,7 @@ def __init__(self, args): def start(self): # Initialize the smbus for I2C commands - self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) + # self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) self.toggleProximity() self.doSLAC() @@ -108,13 +108,13 @@ def openProximity(self): def setState(self, state: PEVState): if state == PEVState.A: print("INFO (PEV) : Going to state A") - self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) + # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) elif state == PEVState.B: print("INFO (PEV) : Going to state B") - self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1) + # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1) elif state == PEVState.C: print("INFO (PEV) : Going to state C") - self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1 | self.PEV_CP2) + # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1 | self.PEV_CP2) def toggleProximity(self, t: int = 5): self.openProximity() From cc06c2ef9bd44b5be8f75b6779e07f02952e3c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20L=C3=B6w?= Date: Thu, 12 Sep 2024 18:31:30 +0200 Subject: [PATCH 3/4] :sparkles: add --disable-i2c switch for disabling talking to real hardware (rather than commenting it out) --- EVSE.py | 20 +++++++++++++++----- PEV.py | 18 +++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/EVSE.py b/EVSE.py index f876a5c..c204fc1 100644 --- a/EVSE.py +++ b/EVSE.py @@ -30,6 +30,7 @@ class EVSE: def __init__(self, args): self.mode = RunMode(args.mode[0]) if args.mode else RunMode.FULL + self.disable_i2c = True if args.disable_i2c else False self.iface = args.interface[0] if args.interface else "eth1" self.sourceMAC = args.source_mac[0] if args.source_mac else "00:1e:c0:f2:6c:a0" self.sourceIP = args.source_ip[0] if args.source_ip else "fe80::21e:c0ff:fef2:6ca0" @@ -63,7 +64,8 @@ def __init__(self, args): self.tcp = _TCPHandler(self) # I2C bus for relays - # self.bus = SMBus(1) + if not self.disable_i2c: + self.bus = SMBus(1) # Constants for i2c controlled relays self.I2C_ADDR = 0x20 @@ -75,7 +77,8 @@ def __init__(self, args): # Start the emulator def start(self): # Initialize the I2C bus for wwrite - # self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) + if not self.disable_i2c: + self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) self.toggleProximity() self.doSLAC() @@ -88,17 +91,23 @@ def start(self): # Close the circuit for the proximity pins def closeProximity(self): + if self.disable_i2c: + return + if self.modified_cordset: print("INFO (EVSE): Closing CP/PP relay connections") - # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_PP | self.EVSE_CP) + self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_PP | self.EVSE_CP) else: print("INFO (EVSE): Closing CP relay connection") - # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_CP) + self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.EVSE_CP) # Close the circuit for the proximity pins def openProximity(self): + if self.disable_i2c: + return + print("INFO (EVSE): Opening CP/PP relay connections") - # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) + self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) # Opens and closes proximity circuit with a delay def toggleProximity(self, t: int = 5): @@ -713,6 +722,7 @@ def buildNeighborAdvertisement(self): parser.add_argument("--nmap-mac", nargs=1, help="The MAC address of the target device to NMAP scan (default: EVCC MAC address)") parser.add_argument("--nmap-ip", nargs=1, help="The IP address of the target device to NMAP scan (default: EVCC IP address)") parser.add_argument("--nmap-ports", nargs=1, help="List of ports to scan seperated by commas (ex. 1,2,5-10,19,...) (default: Top 8000 common ports)") + parser.add_argument("--disable-i2c", action="store_true", help="Set this option when not using the original AcCCS hardware, i.e. no I2C bus is present. (default: False)") parser.add_argument("--modified-cordset", action="store_true", help="Set this option when using a modified cordset during testing of a target vehicle. The AcCCS system will provide a 150 ohm ground on the proximity line to reset the connection. (default: False)") args = parser.parse_args() diff --git a/PEV.py b/PEV.py index 3392f57..fc0201a 100644 --- a/PEV.py +++ b/PEV.py @@ -32,6 +32,7 @@ class PEV: def __init__(self, args): self.mode = RunMode(args.mode[0]) if args.mode else RunMode.FULL + self.disable_i2c = True if args.disable_i2c else False self.iface = args.interface[0] if args.interface else "eth1" self.sourceMAC = args.source_mac[0] if args.source_mac else "00:1e:c0:f2:6c:a1" self.sourceIP = args.source_ip[0] if args.source_ip else "fe80::21e:c0ff:fef2:6ca1" @@ -60,7 +61,8 @@ def __init__(self, args): self.tcp = _TCPHandler(self) # I2C bus for relays - # self.bus = SMBus(1) + if not self.disable_i2c: + self.bus = SMBus(1) # Constants for i2c controlled relays self.I2C_ADDR = 0x20 @@ -72,7 +74,8 @@ def __init__(self, args): def start(self): # Initialize the smbus for I2C commands - # self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) + if not self.disable_i2c: + self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) self.toggleProximity() self.doSLAC() @@ -106,15 +109,19 @@ def openProximity(self): self.setState(PEVState.A) def setState(self, state: PEVState): + if self.disable_i2c: + print(f"INFO (PEV) : State transition to {state}") + return + if state == PEVState.A: print("INFO (PEV) : Going to state A") - # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) + self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.ALL_OFF) elif state == PEVState.B: print("INFO (PEV) : Going to state B") - # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1) + self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1) elif state == PEVState.C: print("INFO (PEV) : Going to state C") - # self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1 | self.PEV_CP2) + self.bus.write_byte_data(self.I2C_ADDR, self.CONTROL_REG, self.PEV_PP | self.PEV_CP1 | self.PEV_CP2) def toggleProximity(self, t: int = 5): self.openProximity() @@ -807,6 +814,7 @@ def buildNeighborAdvertisement(self): parser.add_argument("--nmap-mac", nargs=1, help="The MAC address of the target device to NMAP scan (default: SECC MAC address)") parser.add_argument("--nmap-ip", nargs=1, help="The IP address of the target device to NMAP scan (default: SECC IP address)") parser.add_argument("--nmap-ports", nargs=1, help="List of ports to scan seperated by commas (ex. 1,2,5-10,19,...) (default: Top 8000 common ports)") + parser.add_argument("--disable-i2c", action="store_true", help="Set this option when not using the original AcCCS hardware, i.e. no I2C bus is present. (default: False)") args = parser.parse_args() pev = PEV(args) From cefac628a6d2275a0c321bc2467f5f8829e9776c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20L=C3=B6w?= Date: Thu, 12 Sep 2024 18:35:56 +0200 Subject: [PATCH 4/4] :sparkles: add an option for skipping SLAC (making the seperation of SLAC and SDP actually useful) --- EVSE.py | 5 ++++- PEV.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EVSE.py b/EVSE.py index c204fc1..dea12a2 100644 --- a/EVSE.py +++ b/EVSE.py @@ -30,6 +30,7 @@ class EVSE: def __init__(self, args): self.mode = RunMode(args.mode[0]) if args.mode else RunMode.FULL + self.skip_slac = True if args.skip_slac else False self.disable_i2c = True if args.disable_i2c else False self.iface = args.interface[0] if args.interface else "eth1" self.sourceMAC = args.source_mac[0] if args.source_mac else "00:1e:c0:f2:6c:a0" @@ -81,7 +82,8 @@ def start(self): self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) self.toggleProximity() - self.doSLAC() + if not self.skip_slac: + self.doSLAC() self.doSDP() self.doTCP() # If NMAP is not done, restart connection @@ -722,6 +724,7 @@ def buildNeighborAdvertisement(self): parser.add_argument("--nmap-mac", nargs=1, help="The MAC address of the target device to NMAP scan (default: EVCC MAC address)") parser.add_argument("--nmap-ip", nargs=1, help="The IP address of the target device to NMAP scan (default: EVCC IP address)") parser.add_argument("--nmap-ports", nargs=1, help="List of ports to scan seperated by commas (ex. 1,2,5-10,19,...) (default: Top 8000 common ports)") + parser.add_argument("--skip-slac", action="store_true", help="Set this option when not using QCA based powerline chip. You will have to handle slac externally. (default: False)") parser.add_argument("--disable-i2c", action="store_true", help="Set this option when not using the original AcCCS hardware, i.e. no I2C bus is present. (default: False)") parser.add_argument("--modified-cordset", action="store_true", help="Set this option when using a modified cordset during testing of a target vehicle. The AcCCS system will provide a 150 ohm ground on the proximity line to reset the connection. (default: False)") args = parser.parse_args() diff --git a/PEV.py b/PEV.py index fc0201a..40ca909 100644 --- a/PEV.py +++ b/PEV.py @@ -32,6 +32,7 @@ class PEV: def __init__(self, args): self.mode = RunMode(args.mode[0]) if args.mode else RunMode.FULL + self.skip_slac = True if args.skip_slac else False self.disable_i2c = True if args.disable_i2c else False self.iface = args.interface[0] if args.interface else "eth1" self.sourceMAC = args.source_mac[0] if args.source_mac else "00:1e:c0:f2:6c:a1" @@ -78,7 +79,8 @@ def start(self): self.bus.write_byte_data(self.I2C_ADDR, 0x00, 0x00) self.toggleProximity() - self.doSLAC() + if not self.skip_slac: + self.doSLAC() self.doSDP() self.doTCP() # If NMAP is not done, restart connection @@ -814,6 +816,7 @@ def buildNeighborAdvertisement(self): parser.add_argument("--nmap-mac", nargs=1, help="The MAC address of the target device to NMAP scan (default: SECC MAC address)") parser.add_argument("--nmap-ip", nargs=1, help="The IP address of the target device to NMAP scan (default: SECC IP address)") parser.add_argument("--nmap-ports", nargs=1, help="List of ports to scan seperated by commas (ex. 1,2,5-10,19,...) (default: Top 8000 common ports)") + parser.add_argument("--skip-slac", action="store_true", help="Set this option when not using QCA based powerline chip. You will have to handle slac externally. (default: False)") parser.add_argument("--disable-i2c", action="store_true", help="Set this option when not using the original AcCCS hardware, i.e. no I2C bus is present. (default: False)") args = parser.parse_args()