Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
Apache/2.4.52 (Ubuntu)
Server IP : 192.168.1.1 & Your IP : 3.149.249.113
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
python3 /
dist-packages /
twisted /
web /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2024-11-28 06:59
_auth
[ DIR ]
drwxr-xr-x
2024-11-28 06:59
test
[ DIR ]
drwxr-xr-x
2024-11-28 06:59
__init__.py
384
B
-rw-r--r--
2022-02-07 13:12
_element.py
5.8
KB
-rw-r--r--
2022-02-07 13:12
_flatten.py
16.2
KB
-rw-r--r--
2022-02-07 13:12
_http2.py
47.62
KB
-rw-r--r--
2022-02-07 13:12
_newclient.py
62.33
KB
-rw-r--r--
2022-02-07 13:12
_responses.py
2.93
KB
-rw-r--r--
2022-02-07 13:12
_stan.py
10.71
KB
-rw-r--r--
2022-02-07 13:12
_template_util.py
30.76
KB
-rw-r--r--
2024-11-22 17:49
client.py
56.61
KB
-rw-r--r--
2022-02-07 13:12
demo.py
516
B
-rw-r--r--
2022-02-07 13:12
distrib.py
11.58
KB
-rw-r--r--
2022-02-07 13:12
domhelpers.py
8.6
KB
-rw-r--r--
2022-02-07 13:12
error.py
12.72
KB
-rw-r--r--
2022-02-07 13:12
guard.py
587
B
-rw-r--r--
2022-02-07 13:12
html.py
1.51
KB
-rw-r--r--
2022-02-07 13:12
http.py
109.73
KB
-rw-r--r--
2024-11-22 17:49
http_headers.py
8.47
KB
-rw-r--r--
2022-02-07 13:12
iweb.py
27.07
KB
-rw-r--r--
2022-02-07 13:12
microdom.py
36.09
KB
-rw-r--r--
2022-02-07 13:12
proxy.py
9.64
KB
-rw-r--r--
2022-02-07 13:12
resource.py
13.25
KB
-rw-r--r--
2022-02-07 13:12
rewrite.py
1.82
KB
-rw-r--r--
2022-02-07 13:12
script.py
5.57
KB
-rw-r--r--
2022-02-07 13:12
server.py
28.82
KB
-rw-r--r--
2022-02-07 13:12
soap.py
5.11
KB
-rw-r--r--
2022-02-07 13:12
static.py
36.41
KB
-rw-r--r--
2022-02-07 13:12
sux.py
20.39
KB
-rw-r--r--
2022-02-07 13:12
tap.py
10.02
KB
-rw-r--r--
2022-02-07 13:12
template.py
1.27
KB
-rw-r--r--
2022-02-07 13:12
twcgi.py
11.68
KB
-rw-r--r--
2022-02-07 13:12
util.py
749
B
-rw-r--r--
2022-02-07 13:12
vhost.py
4.4
KB
-rw-r--r--
2024-11-22 17:49
wsgi.py
21.45
KB
-rw-r--r--
2022-02-07 13:12
xmlrpc.py
20.65
KB
-rw-r--r--
2022-02-07 13:12
Save
Rename
# -*- 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.ErrorPage(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 # type: ignore[import] glob = { "__file__": _coerceToFilesystemEncoding("", path), "resource": resource.ErrorPage(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.NoResource() def render(self, request): return resource.NoResource().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.NoResource("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