예제 #1
0
def process_callback(callback):
    # Parse the process list
    parsed_process_list = parse_process_list(callback)

    # Extract features
    collected_features = gather_features(parsed_process_list)

    # Make a prediction
    decision_tree_prediction, neural_network_prediction = make_prediction(
        collected_features)

    # Make the drop decision
    if decision_tree_prediction < 1 or neural_network_prediction < 0.50:
        logging.success(
            f'Dropping payload.\nDecision Tree: {decision_tree_prediction}\n Neural Network: {neural_network_prediction}\n'
        )

        return 'Payload'

    else:
        logging.warn(
            f'Not dropping payload.\nDecision Tree: {decision_tree_prediction}\n Neural Network: {neural_network_prediction}\n'
        )

        return 'Safety first'
예제 #2
0
def process_callback(callback):
    # Parse the process list
    parsed_process_list = parse_process_list(callback)

    # Extract features
    collected_features = gather_features(parsed_process_list)

    # Make a prediction
    decision_tree_prediction, neural_network_prediction = make_prediction(
        collected_features)

    # Make the drop decision set neural_network_prediction  confidence based on risk tolerance
    if decision_tree_prediction < 1 or neural_network_prediction < 0.60:
        logging.success(
            f'Dropping payload.\n [-] Decision Tree:{decision_tree_prediction}\n [-] Neural Network:{neural_network_prediction}'
        )

        keycode = str(uuid.uuid4())
        keycodes['keycode'].append(keycode)

        url = f'http://{config.domain}/deliver/{keycode}'

        return url

    else:
        logging.warn(
            f'Not dropping payload.\n [-]Decision Tree:{decision_tree_prediction}\n [-] Neural Network:{neural_network_prediction}'
        )

        return 'Safety first'
예제 #3
0
def load_models():
    global decision_tree

    global neural_network

    decision_tree = DecisionTree(model_file=config.trained_models['decisiontree'], data_file=config.data_files['decisiontree'])

    decision_tree.load()

    logging.success('DecisionTree loaded')

    neural_network = NeuralNetwork(model_file=config.trained_models['neuralnetwork'], data_file=config.data_files['neuralnetwork'])

    neural_network.load()

    logging.success('Neural Network loaded')
예제 #4
0
 ____              ____              
|    \ ___ ___ ___|    \ ___ ___ ___ 
|  |  | -_| -_| . |  |  |  _| . | . |
|____/|___|___|  _|____/|_| |___|  _|
              |_|               |_|  
    ''')

    app = Flask(__name__,
                template_folder="core/templates",
                static_folder="core/static")

    try:
        ddmodels.load_models()

        routing.setup_routes(app)

        logging.success('Routes loaded')

        payloads.patch_payloads(config.payload_files, config.domain)

        logging.success(f'Payloads patched. Callback info {config.domain}')

    except Exception as e:
        logging.error(str(e))

    logging.success("Starting HTTP Server")

    app.run(
        '0.0.0.0', 80, threaded=False, use_reloader=False
    )  # No threading because https://github.com/keras-team/keras/issues/2397