mushorg / conpot

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

Adds random generated functions for value functions. #410

Closed fergyfresh closed 5 years ago

fergyfresh commented 5 years ago

In the default/templates section there are many uses of an auto-incrementing epoch like timer used for SysUptime. We ended up wanting to simulate some things randomly changing over time and figured we could contribute this code back in the hopes that it would be useful.

In any of your template.xml files you use value type="function" and point to my new functions in this PR to use my new function instead of the random static value that is generated on initial load:

            <key name="memoryModbusSlave1BlockB">
                <value type="function">conpot.emulators.misc.random.Random8BitRegisters</value>
            </key>
            <key name="memoryModbusSlave2BlockC">
                <value type="function">conpot.emulators.misc.random.Random16BitRegister</value>
            </key>
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 1099


Changes Missing Coverage Covered Lines Changed/Added Lines %
conpot/emulators/misc/random.py 0 12 0.0%
<!-- Total: 0 12 0.0% -->
Files with Coverage Reduction New Missed Lines %
conpot/protocols/tftp/tftp_handler.py 1 75.78%
conpot/protocols/http/web_server.py 3 85.71%
conpot/protocols/ftp/ftp_handler.py 10 82.4%
conpot/protocols/ftp/ftp_base_handler.py 16 80.75%
conpot/protocols/http/command_responder.py 48 59.05%
<!-- Total: 78 -->
Totals Coverage Status
Change from base Build 1094: -0.6%
Covered Lines: 5402
Relevant Lines: 7561

💛 - Coveralls
creolis commented 5 years ago

Fun fact: we had all of this before - e.g. in #59 I added a couple of dynamic response handlers for SNMP - but all of them vanished when we changed to Databus.

Thanks for reminding me that there's something that fell under the table, we have to reimplement all of these features for the sake of sanity.

fergyfresh commented 5 years ago

Can i selfishly get this in master soon? Then we can revisit your sanity!

glaslos commented 5 years ago

LGTM

fergyfresh commented 5 years ago

If there is anything we need on my end let me know. I'll be more than happy to jump back in.

glaslos commented 5 years ago

It's just @creolis being slow ;)

fergyfresh commented 5 years ago

You said it, not me. ;)

creolis commented 5 years ago

image

creolis commented 5 years ago

Sorry :) I guess when I started to go through the code dated years back I lost track - here's your merge <3.