Exemple #1
0
def unzip_sample(request, md5):
    """
    Unzip a sample.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param md5: The MD5 of the sample to use.
    :type md5: str
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST":
        # Intentionally using UnrarSampleForm here. Both unrar and unzip use
        # the same form because it's an identical form.
        form = UnrarSampleForm(request.POST)
        if form.is_valid():
            pwd = form.cleaned_data['password']
            try:
                handle_unzip_file(md5, user=request.user.username, password=pwd)
            except ZipFileError, zfe:
                return render_to_response('error.html',
                                          {'error' : zfe.value},
                                          RequestContext(request))
        return HttpResponseRedirect(reverse('crits.samples.views.detail',
                                            args=[md5]))
Exemple #2
0
def unzip_sample(request, md5):
    """
    Unzip a sample.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param md5: The MD5 of the sample to use.
    :type md5: str
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST":
        # Intentionally using UnrarSampleForm here. Both unrar and unzip use
        # the same form because it's an identical form.
        form = UnrarSampleForm(request.POST)
        if form.is_valid():
            pwd = form.cleaned_data['password']
            try:
                handle_unzip_file(md5,
                                  user=request.user.username,
                                  password=pwd)
            except ZipFileError, zfe:
                return render_to_response('error.html', {'error': zfe.value},
                                          RequestContext(request))
        return HttpResponseRedirect(
            reverse('crits.samples.views.detail', args=[md5]))
Exemple #3
0
def unzip_sample(request, md5):
    """
    Unzip a sample.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param md5: The MD5 of the sample to use.
    :type md5: str
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST":
        form = UnzipSampleForm(request.POST)
        if form.is_valid():
            pwd = form.cleaned_data['password']
            try:
                handle_unzip_file(md5, user=request.user, password=pwd)
            except ZipFileError, zfe:
                return render(request, 'error.html', {'error': zfe.value})
        return HttpResponseRedirect(
            reverse('crits-samples-views-detail', args=[md5]))
Exemple #4
0
def unzip_sample(request, md5):
    """
    Unzip a sample.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param md5: The MD5 of the sample to use.
    :type md5: str
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST":
        form = UnzipSampleForm(request.POST)
        if form.is_valid():
            pwd = form.cleaned_data['password']
            try:
                handle_unzip_file(md5, user=request.user, password=pwd)
            except ZipFileError, zfe:
                return render(request, 'error.html', {'error' : zfe.value})
        return HttpResponseRedirect(reverse('crits-samples-views-detail',
                                            args=[md5]))