__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
# -*- test-case-name: twisted.web.test.test_script -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
I contain PythonScript, which is a very simple python script resource.
"""


import os
import traceback
from io import StringIO

from twisted import copyright
from twisted.python.compat import execfile, networkString
from twisted.python.filepath import _coerceToFilesystemEncoding
from twisted.web import http, resource, server, static, util

rpyNoResource = """<p>You forgot to assign to the variable "resource" in your script. For example:</p>
<pre>
# MyCoolWebApp.rpy

import mygreatresource

resource = mygreatresource.MyGreatResource()
</pre>
"""


class AlreadyCached(Exception):
    """
    This exception is raised when a path has already been cached.
    """


class CacheScanner:
    def __init__(self, path, registry):
        self.path = path
        self.registry = registry
        self.doCache = 0

    def cache(self):
        c = self.registry.getCachedPath(self.path)
        if c is not None:
            raise AlreadyCached(c)
        self.recache()

    def recache(self):
        self.doCache = 1


noRsrc = resource._UnsafeErrorPage(500, "Whoops! Internal Error", rpyNoResource)


def ResourceScript(path, registry):
    """
    I am a normal py file which must define a 'resource' global, which should
    be an instance of (a subclass of) web.resource.Resource; it will be
    renderred.
    """
    cs = CacheScanner(path, registry)
    glob = {
        "__file__": _coerceToFilesystemEncoding("", path),
        "resource": noRsrc,
        "registry": registry,
        "cache": cs.cache,
        "recache": cs.recache,
    }
    try:
        execfile(path, glob, glob)
    except AlreadyCached as ac:
        return ac.args[0]
    rsrc = glob["resource"]
    if cs.doCache and rsrc is not noRsrc:
        registry.cachePath(path, rsrc)
    return rsrc


def ResourceTemplate(path, registry):
    from quixote import ptl_compile

    glob = {
        "__file__": _coerceToFilesystemEncoding("", path),
        "resource": resource._UnsafeErrorPage(
            500, "Whoops! Internal Error", rpyNoResource
        ),
        "registry": registry,
    }

    with open(path) as f:  # Not closed by quixote as of 2.9.1
        e = ptl_compile.compile_template(f, path)
    code = compile(e, "<source>", "exec")
    eval(code, glob, glob)
    return glob["resource"]


class ResourceScriptWrapper(resource.Resource):
    def __init__(self, path, registry=None):
        resource.Resource.__init__(self)
        self.path = path
        self.registry = registry or static.Registry()

    def render(self, request):
        res = ResourceScript(self.path, self.registry)
        return res.render(request)

    def getChildWithDefault(self, path, request):
        res = ResourceScript(self.path, self.registry)
        return res.getChildWithDefault(path, request)


class ResourceScriptDirectory(resource.Resource):
    """
    L{ResourceScriptDirectory} is a resource which serves scripts from a
    filesystem directory.  File children of a L{ResourceScriptDirectory} will
    be served using L{ResourceScript}.  Directory children will be served using
    another L{ResourceScriptDirectory}.

    @ivar path: A C{str} giving the filesystem path in which children will be
        looked up.

    @ivar registry: A L{static.Registry} instance which will be used to decide
        how to interpret scripts found as children of this resource.
    """

    def __init__(self, pathname, registry=None):
        resource.Resource.__init__(self)
        self.path = pathname
        self.registry = registry or static.Registry()

    def getChild(self, path, request):
        fn = os.path.join(self.path, path)

        if os.path.isdir(fn):
            return ResourceScriptDirectory(fn, self.registry)
        if os.path.exists(fn):
            return ResourceScript(fn, self.registry)
        return resource._UnsafeNoResource()

    def render(self, request):
        return resource._UnsafeNoResource().render(request)


class PythonScript(resource.Resource):
    """
    I am an extremely simple dynamic resource; an embedded python script.

    This will execute a file (usually of the extension '.epy') as Python code,
    internal to the webserver.
    """

    isLeaf = True

    def __init__(self, filename, registry):
        """
        Initialize me with a script name.
        """
        self.filename = filename
        self.registry = registry

    def render(self, request):
        """
        Render me to a web client.

        Load my file, execute it in a special namespace (with 'request' and
        '__file__' global vars) and finish the request.  Output to the web-page
        will NOT be handled with print - standard output goes to the log - but
        with request.write.
        """
        request.setHeader(
            b"x-powered-by", networkString("Twisted/%s" % copyright.version)
        )
        namespace = {
            "request": request,
            "__file__": _coerceToFilesystemEncoding("", self.filename),
            "registry": self.registry,
        }
        try:
            execfile(self.filename, namespace, namespace)
        except OSError as e:
            if e.errno == 2:  # file not found
                request.setResponseCode(http.NOT_FOUND)
                request.write(
                    resource._UnsafeNoResource("File not found.").render(request)
                )
        except BaseException:
            io = StringIO()
            traceback.print_exc(file=io)
            output = util._PRE(io.getvalue())
            output = output.encode("utf8")
            request.write(output)
        request.finish()
        return server.NOT_DONE_YET

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
_auth Folder 0755
newsfragments Folder 0755
test Folder 0755
__init__.py File 384 B 0644
_element.py File 5.89 KB 0644
_flatten.py File 17.72 KB 0644
_http2.py File 47.48 KB 0644
_newclient.py File 62.33 KB 0644
_responses.py File 2.93 KB 0644
_stan.py File 10.69 KB 0644
_template_util.py File 30.77 KB 0644
client.py File 57.52 KB 0644
demo.py File 516 B 0644
distrib.py File 11.8 KB 0644
domhelpers.py File 8.88 KB 0644
error.py File 13.33 KB 0644
guard.py File 587 B 0644
html.py File 1.51 KB 0644
http.py File 110.22 KB 0644
http_headers.py File 8.86 KB 0644
iweb.py File 27.07 KB 0644
microdom.py File 36.41 KB 0644
pages.py File 3.94 KB 0644
proxy.py File 9.64 KB 0644
resource.py File 15.04 KB 0644
rewrite.py File 1.82 KB 0644
script.py File 5.64 KB 0644
server.py File 28.97 KB 0644
soap.py File 5.08 KB 0644
static.py File 36.61 KB 0644
sux.py File 20.39 KB 0644
tap.py File 10.02 KB 0644
template.py File 1.27 KB 0644
twcgi.py File 11.71 KB 0644
util.py File 749 B 0644
vhost.py File 4.32 KB 0644
wsgi.py File 21.45 KB 0644
xmlrpc.py File 20.65 KB 0644
Filemanager