# Path: moth/views/base/html_template_view.py
# class HTMLTemplateView(VulnerableTemplateView):
#     '''
#     All vulnerabilities inherit from this template, which will render the data
#     returned by the subclasses, disable anti-CSRF, etc.
#     '''
#     # If the subclass just wants to return static HTML, we give him a shortcut
#     # where he doesn't define the get method, just sets HTML and we'll do the
#     # rest
#     HTML = None
# 
#     def get(self, request, *args, **kwds):
#         if self.HTML is None:
#             raise RuntimeError('HTML needs to be set.')
#         
#         context = self.get_context_data()
#         context['html'] = self.HTML
# 
#         response = render(request, self.template_name, context)
# 
#         for key, value in self.extra_headers.iteritems():
#             response[key] = value
# 
#         return response


import base64
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.shortcuts import render
from moth.views.base.html_template_view import HTMLTemplateView
    @logged_in_or_basicauth
    def your_view:
        ...

    You can provide the name of the realm to ask for authentication within.
    """
    def view_decorator(func):
        def wrapper(request, *args, **kwargs):
            return view_or_basicauth(func, request,
                                     users, realm, *args, **kwargs)
        return wrapper
    return view_decorator


class BasicHttpAuthenticatedView(HTMLTemplateView):
    title = 'Basic HTTP authentication'
    tags = ['guessable', 'trivial', 'admin']
    description = 'Access with HTTP basic authentication with weak credentials'
    url_path = 'weak/'
    users = (('admin', 'admin'),)
    
    HTML = '''Authentication success!'''
    
    @method_decorator(logged_in_or_basicauth(users=users, realm='Trivial'))
    def get(self, request, *args, **kwds):
        context = self.get_context_data()
        context['html'] = self.HTML
        return render(request, self.template_name, context)



# Path: moth/views/base/html_template_view.py
# class HTMLTemplateView(VulnerableTemplateView):
#     '''
#     All vulnerabilities inherit from this template, which will render the data
#     returned by the subclasses, disable anti-CSRF, etc.
#     '''
#     # If the subclass just wants to return static HTML, we give him a shortcut
#     # where he doesn't define the get method, just sets HTML and we'll do the
#     # rest
#     HTML = None
# 
#     def get(self, request, *args, **kwds):
#         if self.HTML is None:
#             raise RuntimeError('HTML needs to be set.')
#         
#         context = self.get_context_data()
#         context['html'] = self.HTML
# 
#         response = render(request, self.template_name, context)
# 
#         for key, value in self.extra_headers.iteritems():
#             response[key] = value
# 
#         return response


# Path: moth/views/vulnerabilities/auth/basic.py
import base64
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.shortcuts import render
from moth.views.base.html_template_view import HTMLTemplateView

    @logged_in_or_basicauth
    def your_view:
        ...

    You can provide the name of the realm to ask for authentication within.
    """
    def view_decorator(func):
        def wrapper(request, *args, **kwargs):
            return view_or_basicauth(func, request,
                                     users, realm, *args, **kwargs)
        return wrapper
    return view_decorator


class BasicHttpAuthenticatedView(HTMLTemplateView):
    title = 'Basic HTTP authentication'
    tags = ['guessable', 'trivial', 'admin']
    description = 'Access with HTTP basic authentication with weak credentials'
    url_path = 'weak/'
    users = (('admin', 'admin'),)
    
    HTML = '''Authentication success!'''
    
    @method_decorator(logged_in_or_basicauth(users=users, realm='Trivial'))
    def get(self, request, *args, **kwds):
        context = self.get_context_data()
        context['html'] = self.HTML
        return render(request, self.template_name, context)



class BasicHttpImpossibleAuthenticatedView(HTMLTemplateView):