mushorg / conpot

ICS/SCADA honeypot
GNU General Public License v2.0
1.22k stars 413 forks source link

S7comm port error while nmap scanning #445

Closed Hadi-94 closed 5 years ago

Hadi-94 commented 5 years ago

Hey .. I'm scanning s7comm port with this nmap scan

nmap --script s7-info.nse -p 102 host.ip

and I'm getting this error on conpot:

Traceback (most recent call last): File "src/gevent/greenlet.py", line 766, in gevent._greenlet.Greenlet.run File "/home/ubuntu/conpot/lib/python3.6/site-packages/gevent/baseserver.py", line 26, in _handle_and_close_when_done return handle(args_tuple) File "/home/ubuntu/conpot/lib/python3.6/site-packages/conpot/protocols/s7comm/s7_server.py", line 68, in handle session = conpot_core.get_session('s7comm', address[0], address[1], sock.getsockname()[0], sock.getsockname()[1]) File "/home/ubuntu/conpot/lib/python3.6/site-packages/conpot/core/init.py", line 39, in get_session return sessionManager.get_session(args, **kwargs) TypeError: get_session() takes 4 positional arguments but 6 were given 2019-03-28T09:32:26Z <Greenlet at 0x7f262d02ba48: _handle_and_close_when_done(<bound method S7Server.handle of <conpot.protocols, <bound method StreamServer.do_close of <StreamServ, (<gevent._socket3.socket [closed] object, fd=-1, )> failed with TypeError

This error has appeared recently as it was working fine before, I'm not sure why and I need an urgent help ..

Thanks in advance

Hadi-94 commented 5 years ago

In line 68, when there is a new session , the line of code should be:

session = conpot_core.get_session('s7comm', address[0], address[1])

Adding sock.getsockname()[0], sock.getsockname()[1] will make an issue while creating a session, and will cause this error.