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"])
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 db = db_.DB(config) config['db'] = 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'] logger = log_.setup_logging(config) config['logger'] = logger db = db_.DB(config) config['db'] = 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'])