Пример #1
0
    def run(self):
        try:
            while True:
                msg_pack = self.consumer.poll(timeout_ms=2000)
                for message in msg_pack.items():
                    for consumer_record in message[1]:
                        data = consumer_record.value
                        self.logger.info('Recieved {}'.format(data.get("target")))

                        elasticData = self.parseToElasticData(data)
                        if len(elasticData) > 0:
                            elasticSendProducer = ElasticSendProducers()
                            elasticSendProducer.sendDataToQueue(elasticData)
                        self.consumer.commit()
        except:
            self.logger.exception("Thread " + __name__ + " terminated")
Пример #2
0
    def run(self):
        try:
            while True:
                msg_pack = self.consumer.poll(timeout_ms=2000)
                for message in msg_pack.items():
                    for consumer_record in message[1]:
                        data = consumer_record.value
                        self.logger.info('Recieved {}_{}'.format(
                            data.get("target"), data.get("hostname")))

                        elasticData = self.parseToElasticData(data)
                        elasticSendProducer = ElasticSendProducers()
                        elasticSendProducer.sendDataToQueue(elasticData)

                        if (data.get('status') == 'hostUp'):
                            cveSearchData = self.parseToCveSearchData(data)
                            cve_SeachScanProducer = CVESeachScanProducers()
                            cve_SeachScanProducer.sendDataToQueue(
                                cveSearchData)

                            nseData = self.parseToNseData(data)
                            nseScanProducer = NseScanProducers()
                            nseScanProducer.sendDataToQueue(nseData)

                            wappalyzerData = self.parseToWappalyzerData(data)
                            wappalyzerScanProducer = WappalyzerScanProducers()
                            wappalyzerScanProducer.sendDataToQueue(
                                wappalyzerData)

                            niktoData = self.parseToNiktoData(data)
                            niktoScanProducer = NiktoScanProducers()
                            niktoScanProducer.sendDataToQueue(niktoData)

                            if data.get('scan_type') == 'full_scan':
                                acunetixData = self.parseToAcunetixData(data)
                                acunetixScanProducers = AcunetixScanProducers()
                                acunetixScanProducers.sendDataToQueue(
                                    acunetixData)

                                nessusData = self.parseToNessusData(data)
                                nessusScanProducers = NessusScanProducers()
                                nessusScanProducers.sendDataToQueue(nessusData)

                        self.consumer.commit()
        except:
            self.logger.exception("Thread " + __name__ + " terminated")