mushorg / conpot

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

Remove custom MIB compile logic #495

Closed srenfo closed 4 years ago

srenfo commented 4 years ago

Removes the custom MIB dependency resolution and compiler logic and makes PySNMP do the heavy lifting. PySNMP will compile the MIBs on demand, including dependency resolution.

The previous MIB compilation logic was broken: missing files were correctly compiled, but the compiled files were (by default) put into a directory that wasn't actually searched by PySNMP.

The following lines in CommandResponder are the most relevant change in this PR. They replace the custom logic in build_pysnmp_mib_wrapper.py.

        # Configure SNMP compiler
        mib_builder = self.snmpEngine.getMibBuilder()
        addMibCompiler(mib_builder, destination=compiled_mibs)
        mib_builder.getMibCompiler().addSources(FileReader(raw_mibs))
        mib_builder.getMibCompiler().addSources(HttpReader('mibs.snmplabs.com', 80, '/asn1/@mib@'))

Other minor changes:

Other functional changes:

srenfo commented 4 years ago

FYI this PR has been updated considerably. It now removes ALL the custom MIB logic. I have updated the PR description accordingly.