Exemplo n.º 1
0
def ssdeep_compare_celery():
    '''
    Run ssdeep.compare for new samples.

    Usage:
    from celery_worker import ssdeep_compare_celery
    ssdeep_compare_celery.delay()
    '''
    ssdeep_analytic = SSDeepAnalytic()
    ssdeep_analytic.ssdeep_compare()
Exemplo n.º 2
0
def run_ssdeep_compare():
    '''
    Runs ssdeep compare analytic and returns success / error message.
    '''
    try:
        if DISTRIBUTED:
            # Publish task to Celery
            ssdeep_compare_celery.delay()
            return make_response(jsonify({ 'Message': 'Success' }))
        else:
            ssdeep_analytic = SSDeepAnalytic()
            ssdeep_analytic.ssdeep_compare()
            return make_response(jsonify({ 'Message': 'Success' }))
    except Exception as e:
        return make_response(
            jsonify({'Message': 'Unable to complete request.'}),
            HTTP_BAD_REQUEST)