# Path: afl_utils/AflPrettyPrint.py
# class clr:
#     # taken from AFL's debug.h
#     BLK = "\x1b[0;30m"
#     RED = "\x1b[0;31m"
#     GRN = "\x1b[0;32m"
#     BRN = "\x1b[0;33m"
#     BLU = "\x1b[0;34m"
#     MGN = "\x1b[0;35m"
#     CYA = "\x1b[0;36m"
#     NOR = "\x1b[0;37m"
#     GRA = "\x1b[1;30m"
#     LRD = "\x1b[1;31m"
#     LGN = "\x1b[1;32m"
#     YEL = "\x1b[1;33m"
#     LBL = "\x1b[1;34m"
#     PIN = "\x1b[1;35m"
#     LCY = "\x1b[1;36m"
#     BRI = "\x1b[1;37m"
#     RST = "\x1b[0m"
# 
# def print_ok(msg_str):
#     print("{0}[*] {1}{2}".format(clr.LGN, clr.RST, msg_str))
# 
# def print_warn(msg_str):
#     print("{0}[!] {1}{2}".format(clr.YEL, clr.RST, msg_str))
# 
# def print_err(msg_str):
#     print("{0}[!] {1}{2}".format(clr.LRD, clr.RST, msg_str))


import argparse
import datetime
    import simplejson as json
    import json
import sys
import time
import afl_utils
from afl_utils.AflPrettyPrint import clr, print_ok, print_warn, print_err
class AflCronDaemon(object):
    def __init__(self, config_file, quiet=False):
        self.config = self.load_config(config_file)
        self.quiet = quiet

    def load_config(self, config_file):
        with open(config_file, 'r') as raw_config:
            config = json.load(raw_config)
        return config

    def get_module(self, module_path):
        module_name = module_path.rsplit('.', 1)[1]
        try:
            module = __import__(module_path, fromlist=[module_name])
        except ImportError:
            raise ValueError('Module \'{}\' could not be imported' .format(module_path,))
        return module

    def get_member(self, module, member_name):
        try:
            cls = getattr(module, member_name)
        except AttributeError:
            raise ValueError('Module \'{}\' has no member \'{}\''.format(module, member_name, ))
        return cls

    def run_job(self, job):
        job_module = self.get_module(job['module'])
        job_func = self.get_member(job_module, job['function'])
        job_args = [job['module'].rsplit('.', 1)[1]] + job['params'].split()
        if not self.quiet:

# Path: afl_utils/AflPrettyPrint.py
# class clr:
#     # taken from AFL's debug.h
#     BLK = "\x1b[0;30m"
#     RED = "\x1b[0;31m"
#     GRN = "\x1b[0;32m"
#     BRN = "\x1b[0;33m"
#     BLU = "\x1b[0;34m"
#     MGN = "\x1b[0;35m"
#     CYA = "\x1b[0;36m"
#     NOR = "\x1b[0;37m"
#     GRA = "\x1b[1;30m"
#     LRD = "\x1b[1;31m"
#     LGN = "\x1b[1;32m"
#     YEL = "\x1b[1;33m"
#     LBL = "\x1b[1;34m"
#     PIN = "\x1b[1;35m"
#     LCY = "\x1b[1;36m"
#     BRI = "\x1b[1;37m"
#     RST = "\x1b[0m"
# 
# def print_ok(msg_str):
#     print("{0}[*] {1}{2}".format(clr.LGN, clr.RST, msg_str))
# 
# def print_warn(msg_str):
#     print("{0}[!] {1}{2}".format(clr.YEL, clr.RST, msg_str))
# 
# def print_err(msg_str):
#     print("{0}[!] {1}{2}".format(clr.LRD, clr.RST, msg_str))


# Path: afl_utils/afl_cron.py
import argparse
import datetime
    import simplejson as json
    import json
import sys
import time
import afl_utils
from afl_utils.AflPrettyPrint import clr, print_ok, print_warn, print_err

class AflCronDaemon(object):
    def __init__(self, config_file, quiet=False):
        self.config = self.load_config(config_file)
        self.quiet = quiet

    def load_config(self, config_file):
        with open(config_file, 'r') as raw_config:
            config = json.load(raw_config)
        return config

    def get_module(self, module_path):
        module_name = module_path.rsplit('.', 1)[1]
        try:
            module = __import__(module_path, fromlist=[module_name])
        except ImportError:
            raise ValueError('Module \'{}\' could not be imported' .format(module_path,))
        return module

    def get_member(self, module, member_name):
        try:
            cls = getattr(module, member_name)
        except AttributeError:
            raise ValueError('Module \'{}\' has no member \'{}\''.format(module, member_name, ))
        return cls

    def run_job(self, job):
        job_module = self.get_module(job['module'])
        job_func = self.get_member(job_module, job['function'])
        job_args = [job['module'].rsplit('.', 1)[1]] + job['params'].split()
        if not self.quiet:

            print_ok('Executing \'{}\' ({}.{})'.format(job['name'], job['module'], job['function']))