# Path: server/Config.py
# class ElasticConfig(object):
#     HOST = "localhost"
#     PORT = "9200"
#     USERNAME = ""
#     PASSWORD = ""
#     INDEX_CONFIG = {"index":"xfconfig", "type":"logs"}
#     INDEX_ASSETS = {"index":"assets",  "type":"logs"}
#     INDEX_VULTASKS = {"index":"vulscan",  "type":"data"}
# 
# Path: celerynode/api.py
# def api_hostVerify(host, port, queue="master"):
#     """
#         host: 192.168.1.1
#         port: 80
#     """
#     hostVerify.apply_async(args=[host, port, queue], queue=queue)
#     return True


import os
import sys
import time
from server.Config import ElasticConfig
from celerynode.api import api_hostVerify

sys.path.append(os.path.split(os.path.realpath(__file__))[0]+"/../../")

def portCheck(es, test):
    while True:
        data = es.getAllData()
        for item in data:
            host = item["_source"]["host"]
            port = item["_source"]["port"]
            queue = item["_source"]["queue"]

# Path: server/Config.py
# class ElasticConfig(object):
#     HOST = "localhost"
#     PORT = "9200"
#     USERNAME = ""
#     PASSWORD = ""
#     INDEX_CONFIG = {"index":"xfconfig", "type":"logs"}
#     INDEX_ASSETS = {"index":"assets",  "type":"logs"}
#     INDEX_VULTASKS = {"index":"vulscan",  "type":"data"}
# 
# Path: celerynode/api.py
# def api_hostVerify(host, port, queue="master"):
#     """
#         host: 192.168.1.1
#         port: 80
#     """
#     hostVerify.apply_async(args=[host, port, queue], queue=queue)
#     return True


# Path: server/monitor/verify.py
import os
import sys
import time
from server.Config import ElasticConfig
from celerynode.api import api_hostVerify


sys.path.append(os.path.split(os.path.realpath(__file__))[0]+"/../../")

def portCheck(es, test):
    while True:
        data = es.getAllData()
        for item in data:
            host = item["_source"]["host"]
            port = item["_source"]["port"]
            queue = item["_source"]["queue"]

            api_hostVerify(host, port, queue)