# Standard library imports
import json

# Third party imports


# Local application imports
from Module.AgentCaller import nmapCaller
from Module.kafkaConsumer import nmapScanConsumer
from Module.kafkaConsumer import nmapOutputConsumer
from Module.kafkaConsumer import elasticSendConsumer
from Module.kafkaConsumer import cveSearchScanConsumer
from Module.kafkaConsumer import cveSearchOutputConsumer
from Module.kafkaConsumer import nseScanConsumer
from Module.kafkaConsumer import nseOutputConsumer
from Module.kafkaConsumer import wappalyzerScanConsumer
from Module.kafkaConsumer import wappalyzerOutputConsumer
from Module.kafkaConsumer import acunetixScanConsumer
from Module.kafkaConsumer import acunetixOutputConsumer
from Module.kafkaConsumer import niktoScanConsumer
from Module.kafkaConsumer import niktoOutputConsumer
from Module.kafkaConsumer import nessusScanConsumer
from Module.kafkaConsumer import nessusOutputConsumer
from Module.scanManagement import scanManagement

import Config.loggingConfig


def main():
    Config.loggingConfig.setupLogging()

    consumers = []
    consumers.append(nmapScanConsumer.NmapScanConsumers())
    consumers.append(nmapOutputConsumer.NmapOutputConsumers())
    consumers.append(cveSearchScanConsumer.CVESearchScanConsumers())
    consumers.append(cveSearchOutputConsumer.CVESearchOutputConsumers())
    consumers.append(nseScanConsumer.NseScanConsumers())
    consumers.append(nseOutputConsumer.NSEOutputConsumers())
    consumers.append(elasticSendConsumer.ElasticSendConsumers())
    consumers.append(wappalyzerScanConsumer.WappalyzerScanConsumers())
    consumers.append(wappalyzerOutputConsumer.WappalyzerOutputConsumers())
    consumers.append(acunetixScanConsumer.AcunetixScanConsumers())
    consumers.append(acunetixOutputConsumer.AcunetixOutputConsumers())
    consumers.append(niktoScanConsumer.NiktoScanConsumers())
    consumers.append(niktoOutputConsumer.NiktoOutputConsumers())
    consumers.append(nessusScanConsumer.NessusScanConsumers())
    consumers.append(nessusOutputConsumer.NessusOutputConsumers())

    scan_management = scanManagement.ScanManagements()
    scan_management.start()

    for consumer in consumers:
        consumer.start()

    for consumer in consumers:
        consumer.join()

    scan_management.join()

if __name__ == "__main__":
    main()