コード例 #1
0
ファイル: views.py プロジェクト: mikedgibson/germdb
def get_malware(request, sha256):
    if request.method == 'GET':
        path = get_sample_path(sha256)

        if not path:
            return HttpResponseNotFound('<h1>File not found</h1>')

        return HttpResponseRedirect(path)
    else:
        return HttpResponse('METHOD not supported for URL')
コード例 #2
0
ファイル: api.py プロジェクト: 1malware/vxcage
def get_malware(sha256):
    path = get_sample_path(sha256)
    if not path:
        raise HTTPError(404, "File not found")

    response.content_length = os.path.getsize(path)
    response.content_type = "application/octet-stream; charset=UTF-8"
    data = open(path, "rb").read()

    return data
コード例 #3
0
ファイル: views.py プロジェクト: 0day1day/germdb
def get_malware(request, sha256):
    if request.method == 'GET':
        path = get_sample_path(sha256)

        if not path:
                return HttpResponseNotFound('<h1>File not found</h1>')

        return HttpResponseRedirect(path)
    else:
        return HttpResponse('METHOD not supported for URL')
コード例 #4
0
def get_malware(sha256):
    path = get_sample_path(sha256)
    if not path:
        raise HTTPError(404, "File not found")

    response.content_length = os.path.getsize(path)
    response.content_type = "application/octet-stream; charset=UTF-8"
    data = open(path, "rb").read()

    return data
コード例 #5
0
ファイル: api.py プロジェクト: mboman/vxcage
def get_malware(sha256):
    path = get_sample_path(sha256)
    if not path:
        raise HTTPError(404, jsonize({"error": "file_not_found"}))

    response.content_type = "application/octet-stream; charset=UTF-8"
    code, data = get_sample_content(sha256)
    response.content_length = len(data)
    if code == 200:
        return data
    else:
        raise HTTPError(code, data)