conpot.protocols.snmp package

Submodules

conpot.protocols.snmp.build_pysnmp_mib_wrapper module

conpot.protocols.snmp.build_pysnmp_mib_wrapper.compile_mib(mib_name, output_dir)

Compiles the given mib_name if it is found in the internal MIB file map. If the MIB depends on other MIBs, these will get compiled automatically. :param mib_name: Name of mib to compile (string). :param output_dir: Output directory (string).

conpot.protocols.snmp.build_pysnmp_mib_wrapper.find_mibs(raw_mibs_dirs, recursive=True)

Scans for MIB files and populates an internal MIB->path mapping. :param raw_mibs_dirs: Directories to search for MIB files (list of strings). :param recursive: If True raw_mibs_dirs will be scanned recursively. :return: A list of found MIB names (list of strings).

conpot.protocols.snmp.build_pysnmp_mib_wrapper.generate_dependencies(data, mib_name)

Parses a MIB for dependencies and populates an internal dependency map. :param data: A string representing an entire MIB file (string). :param mib_name: Name of the MIB (string).

conpot.protocols.snmp.build_pysnmp_mib_wrapper.mib2pysnmp(mib_file, output_dir)

The ‘build-pysnmp-mib’ script we previously used is no longer available Latest pysmi has the ability to generate a .py file from .mib automatically

Parameters:
  • mib_file – path to the .mib file we want to compile
  • output_dir – path to the output directory
Returns:

True if we successfully compile the .mib to a .py

conpot.protocols.snmp.command_responder module

class conpot.protocols.snmp.command_responder.CommandResponder(host, port, mibpaths)

Bases: object

addSocketTransport(snmpEngine, transportDomain, transport)

Add transport object to socket dispatcher of snmpEngine

has_mib(mibname)
register(mibname, symbolname, instance, value, profile_map_name)

Register OID

serve_forever()
stop()
class conpot.protocols.snmp.command_responder.SNMPDispatcher

Bases: gevent.server.DatagramServer

getTimerResolution()
handle(msg, address)
registerRecvCbFun(recvCbFun, recvId=None)
registerTimerCbFun(timerCbFun, tickInterval=None)
registerTransport(tDomain, transport)
sendMessage(outgoingMessage, transportDomain, transportAddress)

conpot.protocols.snmp.conpot_cmdrsp module

class conpot.protocols.snmp.conpot_cmdrsp.c_BulkCommandResponder(snmpEngine, snmpContext, databus_mediator, host, port)

Bases: pysnmp.entity.rfc3413.cmdrsp.BulkCommandResponder, conpot.protocols.snmp.conpot_cmdrsp.conpot_extension

handleMgmtOperation(snmpEngine, stateReference, contextName, PDU, acInfo)
class conpot.protocols.snmp.conpot_cmdrsp.c_GetCommandResponder(snmpEngine, snmpContext, databus_mediator, host, port)

Bases: pysnmp.entity.rfc3413.cmdrsp.GetCommandResponder, conpot.protocols.snmp.conpot_cmdrsp.conpot_extension

handleMgmtOperation(snmpEngine, stateReference, contextName, PDU, acInfo)
class conpot.protocols.snmp.conpot_cmdrsp.c_NextCommandResponder(snmpEngine, snmpContext, databus_mediator, host, port)

Bases: pysnmp.entity.rfc3413.cmdrsp.NextCommandResponder, conpot.protocols.snmp.conpot_cmdrsp.conpot_extension

handleMgmtOperation(snmpEngine, stateReference, contextName, PDU, acInfo)
class conpot.protocols.snmp.conpot_cmdrsp.c_SetCommandResponder(snmpEngine, snmpContext, databus_mediator, host, port)

Bases: pysnmp.entity.rfc3413.cmdrsp.SetCommandResponder, conpot.protocols.snmp.conpot_cmdrsp.conpot_extension

handleMgmtOperation(snmpEngine, stateReference, contextName, PDU, acInfo)
class conpot.protocols.snmp.conpot_cmdrsp.conpot_extension

Bases: object

check_evasive(state, threshold, addr, cmd)
do_tarpit(delay)
log(version, msg_type, addr, req_varBinds, res_varBinds=None, sock=None)

conpot.protocols.snmp.databus_mediator module

class conpot.protocols.snmp.databus_mediator.DatabusMediator(oid_mappings)

Bases: object

get_response(reference_class, OID)
set_value(OID, value)
update_evasion_table(client_ip)

updates dynamic evasion table

conpot.protocols.snmp.snmp_server module

Module contents