mushorg / conpot

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

Can't seem to use function instead of value in template.xml with Modbus. #409

Closed fergyfresh closed 5 years ago

fergyfresh commented 6 years ago

Alright so in a template.xml I'm working on I have the following scenario:

.... standard stuff at the top
     <key name='My_First_Key'>
            <value type="value">[random.randint(0,1) for b in range(0,1)]</value>
    </key>
     <key name='My_Second_Key'>
            <value type="function">conpot.emulators.misc.uptime.Uptime</value>
    </key>

The first example I can read/write from it. In the second example I cannot read or write from it. There is nowhere in the documentation that specifically states you can't use function value types with HOLDING_REGISTERS, but I was wondering if that was the case or not.

Is the function value type only to be used with SNMP, because I have a use-case where I would like to use it with Modbus and I was wondering what block types are limited to the function value type.

fergyfresh commented 6 years ago

Solved this. The return type of the Uptime class wasn't sufficient for my data type.

Fix provided here, https://github.com/mushorg/conpot/pull/410. I will close when PR is merged.

creolis commented 5 years ago

-> taken care of by you in #410 :)