mushorg / conpot

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

DNP3 support #11

Open glaslos opened 11 years ago

glaslos commented 11 years ago

Skills required: Python, basic C++, dissecting network traffic. * Time estimation:* We assume this to be a three months project. Short Description: Improve Conpot’s current very minimal support for the DNP3 protocol. Goal is to provide a server capable of basic DNP3 communication.

Description: Conpot provides a variety of common protocols: Modbus, S7Comm, SNMP, HTTP and Kamstrup. We are always working on getting additional protocols supported. This is a rather complicated task as many protocols don't have an open source implementation, documentation is rather complex or simply not available. One of the protocols we are interested in is DNP3 (Distributed Network Protocol) which is similar to IEC 60870-5 and often used for communication between control centers, RTUs (Remote Terminal Units) and IEDs (Intelligent Electronic Devices). Conpot has a feature which we call the Proxy Module. This allows us to proxy incoming requests through Conpot to a service and back to the client. When we implement a new protocol in Conpot, we set up an instance with this proxy module and tunnel all requests from the client to e.g. a real device or a service with that protocol running on another host. Then, piece by piece, we are decoding the message in Conpot while it passes through so we get insight into the intention of the request. Right now we have a very basic decoder for the DNP3 protocol which we would like to extend.

More information:

glaslos commented 10 years ago

I made some successful tests with the proxy module: https://github.com/glastopf/conpot/tree/dnp3_proxy

adepasquale commented 9 years ago

How can I help here? Is this doc up to date? https://github.com/glastopf/conpot/blob/dnp3_proxy/docs/source/components/protocols/dnp3.rst

glaslos commented 9 years ago

The documentation should be up to date. Have a look at the decoder and how to extend it.

glaslos commented 9 years ago

Let me know if you run into any problems or need some help.

adepasquale commented 9 years ago

I've just built and installed cverges' DNP3 fork successfully.

Is this right or do I need to install automatak's one?

Now I'll read something about DNP3 and then I'll have a look at the decoder in the dnp3_proxy branch.

glaslos commented 9 years ago

I went straight to the automatak code and installed the samples, some instructions can be found here: https://github.com/mushorg/conpot/blob/dnp3_proxy/docs/source/components/protocols/dnp3.rst

adepasquale commented 9 years ago

Ok thanks I'll do.

adepasquale commented 9 years ago

Done, outstationdemo and masterdemo samples are running fine.

glaslos commented 9 years ago

I have changed the outstations listening port to +=1 so conpot can listen on the default port and I didn't had to change the client. Let me know if you run into trouble merging master into the branch. And feel free to continue using that branch.

adepasquale commented 9 years ago

Just as a reminder to myself, I patched the source file /cpp/examples/outstation/DemoMain.cpp and changed 20000 to 20001.

glaslos commented 9 years ago

This is helpful during development: http://www.automatak.com/opendnp3/decoder/

glaslos commented 9 years ago

@adepasquale have you looked more into this?

adepasquale commented 9 years ago

Even if this might overlap with the DNP3 proxy branch, I'd like to code wireshark dissectors first. Then implement DNP3 only after I have better understood the protocol.

glaslos commented 9 years ago

Sounds good to me. I might have a student interested in working on this after all. I still think writing a proper wrapper around automataks opendnp3 library would be pretty awesome...

xandfury commented 5 years ago

Although my experience with swig is limited, I think auto generated python API is a little hackish - and may lead to unexpected behavior. I would instead suggest using Boost.python to write the wrapper for the handler. This way the python API would be seamless to work with, since we know what we are getting into :wink: We can use automak's lib for writing the handler.

xandfury commented 5 years ago

There has been promising updates on this :slightly_smiling_face: pydnp3

prashantvidja commented 5 years ago

Any progress? I am also planning to add dnp3 support in conpot.

MortalAndTry commented 4 years ago

Six years on, we're still in demand for DNP3, and the old branch is no longer usable.

glaslos commented 4 years ago

Six years on, we're still in demand for DNP3, and the old branch is no longer usable.

You think you can help in any way?