Beispiel #1
0
def main():
    args = docopt(__doc__, version=__version__)
    config = util.parse_config(args['--config'])
    config['config_file'] = args['--config']
    logger = log.setup_logging(config)
    config['logger'] = logger
    if args['--list-targets']:
        for i in config['crits']['sites']:
            print("{crits:<7} {target:<15} {address:<10}".format(
                crits='[crits]',
                target=i,
                address='(' + config['crits']['sites'][i]['host'] + ')'))
        for i in config['edge']['sites']:
            print("{edge:<7} {target:<15} {address:<10}".format(
                edge='[edge]',
                target=i,
                address='(' + config['edge']['sites'][i]['host'] + ')'))
    elif args['--list-types']:
        for i in datagen_targets:
            print(i)
    elif args['--list-datatypes']:
        for i in datatypes:
            print(i)
    elif args['--inject']:
        if not args['--datatype']:
            args['--datatype'] = 'mixed'
        if args['--type'] in datagen_targets:
            if args['--type'] == 'crits' and \
               args['--target'] in config['crits']['sites'].keys():
                # override indicator_count from config file if it's
                # passed via cli
                if args['--count']:
                    config['crits']['datagen']['indicator_count'] = \
                        int(args['--count'])
                # read in icann tlds list for datagen use
                config['datagen']['tlds'] = datagen.load_tlds(config)
                # read in email header samples for datagen use
                config['datagen']['email_headers'] = \
                    datagen.load_mail_header_bits(config)
                inject_crits_sample_data(config,
                                         target=args['--target'],
                                         datatype=args['--datatype'])
            elif args['--type'] == 'edge' and \
               args['--target'] in config['edge']['sites'].keys():
                # override indicator_count from config file if it's
                # passed via cli
                if args['--count']:
                    config['edge']['datagen']['indicator_count'] = \
                        int(args['--count'])
                # read  in icann tlds list for datagen use
                config['datagen']['tlds'] = datagen.load_tlds(config)
                # read in email header samples for datagen use
                config['datagen']['email_headers'] = \
                    datagen.load_mail_header_bits(config)
                inject_edge_sample_data(config,
                                        target=args['--target'],
                                        datatype=args['--datatype'])
Beispiel #2
0
def main():
    args = docopt(__doc__, version=__version__)
    config = util.parse_config(args['--config'])
    config['config_file'] = args['--config']
    logger = log.setup_logging(config)
    config['logger'] = logger
    if args['--list-targets']:
        for i in config['crits']['sites']:
            print("{crits:<7} {target:<15} {address:<10}".format(
                crits='[crits]', target=i,
                address='(' + config['crits']['sites'][i]['host'] + ')'))
        for i in config['edge']['sites']:
            print("{edge:<7} {target:<15} {address:<10}".format(
                edge='[edge]', target=i,
                address='(' + config['edge']['sites'][i]['host'] + ')'))
    elif args['--list-types']:
        for i in datagen_targets:
            print(i)
    elif args['--list-datatypes']:
        for i in datatypes:
            print(i)
    elif args['--inject']:
        if not args['--datatype']:
            args['--datatype'] = 'mixed'
        if args['--type'] in datagen_targets:
            if args['--type'] == 'crits' and \
               args['--target'] in config['crits']['sites'].keys():
                # override indicator_count from config file if it's
                # passed via cli
                if args['--count']:
                    config['crits']['datagen']['indicator_count'] = \
                        int(args['--count'])
                # read in icann tlds list for datagen use
                config['datagen']['tlds'] = datagen.load_tlds(config)
                # read in email header samples for datagen use
                config['datagen']['email_headers'] = \
                    datagen.load_mail_header_bits(config)
                inject_crits_sample_data(config, target=args['--target'],
                                         datatype=args['--datatype'])
            elif args['--type'] == 'edge' and \
               args['--target'] in config['edge']['sites'].keys():
                # override indicator_count from config file if it's
                # passed via cli
                if args['--count']:
                    config['edge']['datagen']['indicator_count'] = \
                        int(args['--count'])
                # read  in icann tlds list for datagen use
                config['datagen']['tlds'] = datagen.load_tlds(config)
                # read in email header samples for datagen use
                config['datagen']['email_headers'] = \
                    datagen.load_mail_header_bits(config)
                inject_edge_sample_data(config, target=args['--target'],
                                        datatype=args['--datatype'])
Beispiel #3
0
def main():
    args = docopt(__doc__, version=__version__)
    config = util.parse_config(args['--config'])
    config['config_file'] = args['--config']
    config['daemon']['app_path'] = app_path
    logger = log.setup_logging(config)
    config['logger'] = logger
    my_db = db.DB(config)
    config['db'] = my_db
    daemon = util.Daemon(config)
    if args['start']:
        logger.info('edgy_critsd starting...')
        signal.signal(signal.SIGTERM, util.signal_handler)
        daemon.start()
    elif args['stop']:
        logger.info('edgy_critsd stopping...')
        daemon.stop()
    elif args['restart']:
        logger.info('edgy_critsd restarting...')
        daemon.restart()
def main():
    args = docopt(__doc__, version=__version__)
    config = util.parse_config(args['--config'])
    config['config_file'] = args['--config']
    config['daemon']['app_path'] = app_path
    logger = log.setup_logging(config)
    config['logger'] = logger
    my_db = db.DB(config)
    config['db'] = my_db
    daemon = util.Daemon(config)
    if args['start']:
        logger.info('edgy_critsd starting...')
        signal.signal(signal.SIGTERM, util.signal_handler)
        daemon.start()
    elif args['stop']:
        logger.info('edgy_critsd stopping...')
        daemon.stop()
    elif args['restart']:
        logger.info('edgy_critsd restarting...')
        daemon.restart()
Beispiel #5
0
def main():
    args = docopt(__doc__, version=__version__)
    config = util.parse_config(args['--config'])
    config['config_file'] = args['--config']
    logger = log.setup_logging(config)
    config['logger'] = logger
    my_db = db.DB(config)
    config['db'] = my_db
    config['daemon']['app_path'] = app_path
    if args['--c2e']:
        if args['--src'] in config['crits']['sites'].keys() \
           and args['--dest'] in config['edge']['sites'].keys():
            logger.info('initiating crits=>edge sync between %s and %s' %
                        (args['--src'], args['--dest']))
            crits2edge(config, args['--src'], args['--dest'])
    elif args['--e2c']:
        if args['--src'] in config['edge']['sites'].keys() and \
           args['--dest'] in config['crits']['sites'].keys():
            logger.info('initiating edge=>crits sync between %s and %s' %
                        (args['--src'], args['--dest']))
            edge2crits(config, args['--src'], args['--dest'])
Beispiel #6
0
def main():
    args = docopt(__doc__, version=__version__)
    config = util.parse_config(args['--config'])
    config['config_file'] = args['--config']
    logger = log.setup_logging(config)
    config['logger'] = logger
    my_db = db.DB(config)
    config['db'] = my_db
    config['daemon']['app_path'] = app_path
    if args['--c2e']:
        if args['--src'] in config['crits']['sites'].keys() \
           and args['--dest'] in config['edge']['sites'].keys():
            logger.info('initiating crits=>edge sync between %s and %s'
                        % (args['--src'], args['--dest']))
            crits2edge(config, args['--src'], args['--dest'])
    elif args['--e2c']:
        if args['--src'] in config['edge']['sites'].keys() and \
           args['--dest'] in config['crits']['sites'].keys():
            logger.info('initiating edge=>crits sync between %s and %s'
                        % (args['--src'], args['--dest']))
            edge2crits(config, args['--src'], args['--dest'])