예제 #1
0
 def handle(self, data, address):
     session = conpot_core.get_session(
         "bacnet",
         address[0],
         address[1],
         get_interface_ip(address[0]),
         self.server.server_port,
     )
     logger.info("New Bacnet connection from %s:%d. (%s)", address[0],
                 address[1], session.id)
     session.add_event({"type": "NEW_CONNECTION"})
     # I'm not sure if gevent DatagramServer handles issues where the
     # received data is over the MTU -> fragmentation
     if data:
         pdu = PDU()
         pdu.pduData = bytearray(data)
         apdu = APDU()
         try:
             apdu.decode(pdu)
         except DecodingError:
             logger.warning("DecodingError - PDU: {}".format(pdu))
             return
         self.bacnet_app.indication(apdu, address, self.thisDevice)
         # send an appropriate response from BACnet app to the attacker
         self.bacnet_app.response(self.bacnet_app._response, address)
     logger.info("Bacnet client disconnected %s:%d. (%s)", address[0],
                 address[1], session.id)
    def handle(self, data, address):
        session = conpot_core.get_session('bacnet', address[0], address[1])
        logger.info('New Bacnet connection from %s:%d. (%s)', address[0],
                    address[1], session.id)
        session.add_event({'type': 'NEW_CONNECTION'})
        # I'm not sure if gevent DatagramServer handles issues where the
        # received data is over the MTU -> fragmentation
        if data:
            pdu = PDU()
            pdu.pduData = data
            apdu = APDU()
            npdu = NPDU()
            bvlpdu = BVLPDU()
            try:
                bvlpdu.decode(pdu)
                npdu.decode(bvlpdu)
                apdu.decode(npdu)

            except DecodingError as e:
                logger.error("DecodingError: %s", e)
                logger.error("PDU: " + format(pdu))
                return
            self.bacnet_app.indication(apdu, address, self.thisDevice)
            self.bacnet_app.response(self.bacnet_app._response, npdu, bvlpdu,
                                     address)
        logger.info('Bacnet client disconnected %s:%d. (%s)', address[0],
                    address[1], session.id)
예제 #3
0
 def handle(self, data, address):
     session = conpot_core.get_session('bacnet', address[0], address[1], get_interface_ip(address[0]), self.server.server_port)
     logger.info('New Bacnet connection from %s:%d. (%s)', address[0], address[1], session.id)
     session.add_event({'type': 'NEW_CONNECTION'})
     # I'm not sure if gevent DatagramServer handles issues where the
     # received data is over the MTU -> fragmentation
     if data:
         pdu = PDU()
         pdu.pduData = bytearray(data)
         apdu = APDU()
         try:
             apdu.decode(pdu)
         except DecodingError:
             logger.warning("DecodingError - PDU: {}".format(pdu))
             return
         self.bacnet_app.indication(apdu, address, self.thisDevice)
         # send an appropriate response from BACnet app to the attacker
         self.bacnet_app.response(self.bacnet_app._response, address)
     logger.info('Bacnet client disconnected %s:%d. (%s)', address[0], address[1], session.id)
예제 #4
0
 def handle(self, data, address):
     session = conpot_core.get_session('bacnet', address[0], address[1])
     logger.info('New Bacnet connection from %s:%d. (%s)', address[0], address[1], session.id)
     session.add_event({'type': 'NEW_CONNECTION'})
     # I'm not sure if gevent DatagramServer handles issues where the
     # received data is over the MTU -> fragmentation
     if data:
         pdu = PDU()
         pdu.pduData = data
         apdu = APDU()
         try:
             apdu.decode(pdu)
         except DecodingError as e:
             logger.error("DecodingError: %s", e)
             logger.error("PDU: " + format(pdu))
             return
         self.bacnet_app.indication(apdu, address, self.thisDevice)
         self.bacnet_app.response(self.bacnet_app._response, address)
     logger.info('Bacnet client disconnected %s:%d. (%s)', address[0], address[1], session.id)