Closed glaslos closed 4 years ago
____________________ TestENIPServer.test_list_services_udp _____________________
self = <conpot.tests.test_enip_server.TestENIPServer testMethod=test_list_services_udp>
def test_list_services_udp(self):
with client.connector(
host=self.enip_server_udp.addr,
port=self.enip_server_udp.port,
timeout=4.0,
udp=True,
broadcast=True,
) as connection:
connection.list_services()
> response = self.await_cpf_response(connection, "list_services")
conpot/tests/test_enip_server.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
connection = <cpppo.server.enip.client.connector object at 0x7fd10d891b70>
command = 'list_services'
@staticmethod
def await_cpf_response(connection, command):
response, _ = client.await_response(connection, timeout=4.0)
> return response["enip"]["CIP"][command]["CPF"]
E TypeError: 'NoneType' object is not subscriptable
conpot/tests/test_enip_server.py:85: TypeError
----------------------------- Captured stderr call -----------------------------
WARNING:network:handle server failure: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/home/travis/build/mushorg/conpot/.tox/py37/lib/python3.7/site-packages/cpppo/server/network.py", line 153, in run
super( server_thread, self ).run()
File "/opt/python/3.7.1/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/travis/build/mushorg/conpot/conpot/protocols/enip/enip_server.py", line 134, in handle
"enip", address[0], address[1], conn.getsockname()[0], conn.getsockname()[1]
TypeError: 'NoneType' object is not subscriptable
@xandfury I probably should have marked this as draft :grimacing: Not sure if it's only with Python3.8 but I have seen some issues and travis also failed.
Yeah. It's complaining about types in some cases:
File "/home/travis/build/mushorg/conpot/.tox/py37/lib/python3.7/site-packages/bacpypes/pdu.py", line 311, in decode_address
raise TypeError("integer, string or tuple required")
TypeError: integer, string or tuple required
So can be fixed. I'll try to have a look this weekend :slightly_smiling_face:
Restoring branch. So we can continue from here.
I am getting that bacpypes exception even if i try to run an older conpot commit, so i don't think that one is black's fault. I've tried a few commits going back to December and it's still there. And tried with an older bacpypes and newest bacpypes, so it's not that either.
UPDATE: I am a massive idiot. The build was picking up an old checkout. Can confirm it works if i roll back to 7a77329cd99cee9c37ee20e2f05a48952d8eece9.
Fixing all sorts of issues using the
black
formatting tool. See issue #494 and the black test in #499