Пример #1
0
def misp_import(request):
    if request.method != 'POST':
        return HttpResponseNotAllowed(['POST'])
    try:
        package_id = request.POST['package_id']
        control = MispUploadAdapterControl()
        control.upload_misp(package_id)
        resp = {'status': 'OK', 'message': 'Success'}
    except Exception as e:
        resp = {'status': 'NG', 'message': str(e)}
    return JsonResponse(resp)
Пример #2
0
def share_misp(request):
    try:
        if request.method != 'GET':
            return HttpResponseNotAllowed(['GET'])

        package_id = get_package_id_from_get_argument(request)
        mc = MispUploadAdapterControl()
        j = mc.upload_misp(package_id)
        event_id = j['Event']['id']
        misp_conf = MispAdapter.get()
        tmp_url = misp_conf.url
        if tmp_url[-1] != '/':
            tmp_url += '/'
        url = '%sevents/view/%s' % (tmp_url, event_id)
        r = {}
        r['url'] = url
        return JsonResponse(r, safe=False)
    except Exception as e:
        import traceback
        traceback.print_exc()
        return error(e)