示例#1
0
文件: server.py 项目: mushorg/snare
 def __init__(self, meta, run_args, snare_uuid, debug=False, keep_alive=75, **kwargs):
     self.run_args = run_args
     self.dir = run_args.full_page_path
     self.meta = meta
     self.snare_uuid = snare_uuid
     self.logger = logging.getLogger(__name__)
     self.sroute = StaticRoute(name=None, prefix="/", directory=self.dir)
     self.tanner_handler = TannerHandler(run_args, meta, snare_uuid)
示例#2
0
 def __init__(self, run_args, debug=False, keep_alive=75, **kwargs):
     self.dorks = []
     self.run_args = run_args
     self.sroute = StaticRoute(
         name=None, prefix='/',
         directory='/opt/snare/pages/{}'.format(run_args.page_dir)
     )
     super().__init__(debug=debug, keep_alive=keep_alive, access_log=None, **kwargs)
示例#3
0
    def __init__(self,
                 meta,
                 run_args,
                 snare_uuid,
                 debug=False,
                 keep_alive=75,
                 **kwargs):
        self.run_args = run_args
        self.dir = '/opt/snare/pages/{}'.format(run_args.page_dir)
        self.meta = meta
        self.snare_uuid = snare_uuid
        self.logger = logging.getLogger(__name__)
        self.sroute = StaticRoute(name=None, prefix='/', directory=self.dir)
        self.tanner_handler = TannerHandler(run_args, meta, snare_uuid)

        if run_args.server_header:
            self.server_header = run_args.server_header
        else:
            self.server_header = meta['cloned_metadata']['Server'] if meta[
                'cloned_metadata']['Server'] else 'nginx/1.3.8'
示例#4
0
文件: webapp.py 项目: djudman/myfeed
import settings
from web.util.urls import get_project_urls
from web.util.templates import TemplateLoader
from web.util.filters import tsformat, platform_group_link


app = Application(
    middlewares=[
        session_middleware(EncryptedCookieStorage(
            settings.CONFIG.secret_key.encode()))
    ]
)

static_dir = settings.STATIC_DIR
app.router.add_static('/static/', static_dir, name='static')
route = StaticRoute(None, '/static/', static_dir)
route._method = 'HEAD'
app.router.register_route(route)

template_dirs = [
    os.path.realpath(os.path.join(settings.APPS_DIR, app_dir, 'templates'))
    for app_dir in os.listdir(settings.APPS_DIR)
]
template_dirs.append(os.path.join(settings.WEB_DIR, 'templates'))

aiohttp_jinja2.setup(
    app,
    context_processors=[
        aiohttp_jinja2.request_processor,
    ],
    loader=TemplateLoader(template_dirs)