# Path: web/modules.py
# def load_extensions():


import re
import sys
import json
import multiprocessing
import tempfile
    import yara
import vol_interface
from datetime import datetime
from web.common import *
from common import parse_config, checksum_md5
from web.modules import __extensions__
from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse, HttpResponseServerError, StreamingHttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from vol_interface import RunVol
    from web.database import Database

    for upload in request.FILES.getlist('files[]'):
        logger.debug('Storing File: {0}'.format(upload.name))
        file_data = upload.read()
        sha256 = hashlib.sha256(file_data).hexdigest()

        # Store file in GridFS
        db.create_file(file_data, session_id, sha256, upload.name, pid=None, file_meta='ExtraFile')

    # Return the new list
    extra_search = db.search_files({'file_meta': 'ExtraFile', 'sess_id': session_id})
    extra_files = []
    for upload in extra_search:
        extra_files.append({'filename': upload.filename, 'file_id': upload._id})

    return render(request, 'file_upload_table.html', {'extra_files': extra_files})


@csrf_exempt
def ajax_handler(request, command):
    """
    return data requested by the ajax handler in volutility.js
    :param request:
    :param command:
    :return:
    """
    if 'auth' in config:
        if config['auth']['enable'].lower() == 'true' and not request.user.is_authenticated:
            return HttpResponse('Auth Required.')


# Path: web/modules.py
# def load_extensions():


# Path: web/views.py
import re
import sys
import json
import multiprocessing
import tempfile
    import yara
import vol_interface
from datetime import datetime
from web.common import *
from common import parse_config, checksum_md5
from web.modules import __extensions__
from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse, HttpResponseServerError, StreamingHttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from vol_interface import RunVol
    from web.database import Database


    for upload in request.FILES.getlist('files[]'):
        logger.debug('Storing File: {0}'.format(upload.name))
        file_data = upload.read()
        sha256 = hashlib.sha256(file_data).hexdigest()

        # Store file in GridFS
        db.create_file(file_data, session_id, sha256, upload.name, pid=None, file_meta='ExtraFile')

    # Return the new list
    extra_search = db.search_files({'file_meta': 'ExtraFile', 'sess_id': session_id})
    extra_files = []
    for upload in extra_search:
        extra_files.append({'filename': upload.filename, 'file_id': upload._id})

    return render(request, 'file_upload_table.html', {'extra_files': extra_files})


@csrf_exempt
def ajax_handler(request, command):
    """
    return data requested by the ajax handler in volutility.js
    :param request:
    :param command:
    :return:
    """
    if 'auth' in config:
        if config['auth']['enable'].lower() == 'true' and not request.user.is_authenticated:
            return HttpResponse('Auth Required.')


    if command in __extensions__: