Пример #1
0
 def run(self):
     while True:
         for task in self.tasklist:
             if task["status"] == 0:
                 task["status"] = 1
                 cfg = task.get("cfg")
                 if 'passive' in cfg.get("task_type"):
                     pa = asset.PassiveAsset(task)
                     pa.run()
                 elif 'suricata' in cfg.get("task_type"):
                     su = instrusion.IdsInstrusion(task)
                     su.run()
                 flow_log.info('task running ' + str(task))
         time.sleep(6)
Пример #2
0
def init_scheduler():
    flow_log.info("init_scheduler  start ...")
    scheduler.start()
    flow_log.info(id(scheduler))
    print id(scheduler)
Пример #3
0
def get_scheduler():
    flow_log.info(id(scheduler))
    return scheduler
Пример #4
0
 def createtask(self, cfg):
     taskid = str(uuid.uuid4())
     task = {"taskid": taskid, "cfg": cfg, "status": 0}
     self.tasklist.append(task)
     flow_log.info('createtask running ' + str(task))
     return taskid
Пример #5
0
            for task in self.tasklist:
                if task["status"] == 0:
                    task["status"] = 1
                    cfg = task.get("cfg")
                    if 'passive' in cfg.get("task_type"):
                        pa = asset.PassiveAsset(task)
                        pa.run()
                    elif 'suricata' in cfg.get("task_type"):
                        su = instrusion.IdsInstrusion(task)
                        su.run()
                    flow_log.info('task running ' + str(task))
            time.sleep(6)


scheduler = Scheduler()
flow_log.info(id(scheduler))


# print scheduler

def get_scheduler():
    flow_log.info(id(scheduler))
    return scheduler


def init_scheduler():
    flow_log.info("init_scheduler  start ...")
    scheduler.start()
    flow_log.info(id(scheduler))
    print id(scheduler)