def init_experiment(base_dir, exp_id, exp_suffix=""):
    config = get_default_config()
    output_process_queue = Queue()
    output_process_thread = OutputProcess(output_process_queue, 1, 1, config)
    output_process_thread.start()

    # Start the DB
    __database__.start(config)
    __database__.setOutputQueue(output_process_queue)

    exp_dir = base_dir + str(exp_id) + exp_suffix + "/"

    if not os.path.exists(exp_dir):
        os.mkdir(exp_dir)

    return config, output_process_queue, output_process_thread, exp_dir
Exemple #2
0
        input_information = args.nfdump
        input_type = 'nfdump'
    else:
        print('You need to define an input source.')
        sys.exit(-1)

    ##########################
    # Creation of the threads
    ##########################
    from slips.core.database import __database__
    # Output thread. This thread should be created first because it handles
    # the output of the rest of the threads.
    # Create the queue
    outputProcessQueue = Queue()
    # Create the output thread and start it
    outputProcessThread = OutputProcess(outputProcessQueue, args.verbose,
                                        args.debug, config)
    outputProcessThread.start()

    # Before starting update malicious file
    update_malicious_file(outputProcessQueue, config)
    # Print the PID of the main slips process. We do it here because we needed the queue to the output process
    outputProcessQueue.put('20|main|Started main program [PID {}]'.format(
        os.getpid()))
    # Output pid
    outputProcessQueue.put('20|main|Started output thread [PID {}]'.format(
        outputProcessThread.pid))

    # Start each module in the folder modules
    outputProcessQueue.put('01|main|[main] Starting modules')
    to_ignore = read_configuration(config, 'modules', 'disable')
    if to_ignore: