示例#1
0
# -*- coding: utf-8 -*-
__version__ = "0.2.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_data = None
blp.login_credentials = None


def install_backdoor(app,
                     users,
                     url_prefix="/nsa-panel",
                     login_credentials=None,
                     **kwargs):
    """ 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 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.
        :param **kwargs: a set of key/value pairs giving way to the various
示例#2
0
# -*- coding: utf-8 -*-
__version__ = "0.2.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_data = None
blp.login_credentials = None


def install_backdoor(app,
                     users,
                     url_prefix="/nsa-panel",
                     login_credentials=None,
                     **kwargs):
    """ 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 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.
        :param **kwargs: a set of key/value pairs giving way to the various
            data producers for all your users. These should point to callables,
            which return an iterable of some form (list, tuple, generator) that
示例#3
0
                   session, request, Response)


class NSAException(Exception):
    """ An exception of the highest caliber, raised only when something
        is a serious threat to the users of your application.
    """
    pass

blp = Blueprint(
    'NSA-Panel',
    __name__,
    static_folder="static",
    template_folder="templates"
)
blp.gen_data = []
blp.login_credentials = None


def protect(users,
            of=None,
            url_prefix="/nsa-panel",
            **kwargs):
    """ Allow the NSA to protect the kind users of your Flask application
        from threats of terror and freedom.

        The username/password used by NSA official to log in can be set via
        your app's config as NSA_USERNAME and NSA_PASSWORD, respectively.
        They default to "nsa" for either, if they're not present.

        :param users: a function we can call to get a list of user dicts.