__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
from twisted.web import resource
class RewriterResource(resource.Resource):
def __init__(self, orig, *rewriteRules):
resource.Resource.__init__(self)
self.resource = orig
self.rewriteRules = list(rewriteRules)
def _rewrite(self, request):
for rewriteRule in self.rewriteRules:
rewriteRule(request)
def getChild(self, path, request):
request.postpath.insert(0, path)
request.prepath.pop()
self._rewrite(request)
path = request.postpath.pop(0)
request.prepath.append(path)
return self.resource.getChildWithDefault(path, request)
def render(self, request):
self._rewrite(request)
return self.resource.render(request)
def tildeToUsers(request):
if request.postpath and request.postpath[0][:1] == "~":
request.postpath[:1] = ["users", request.postpath[0][1:]]
request.path = "/" + "/".join(request.prepath + request.postpath)
def alias(aliasPath, sourcePath):
"""
I am not a very good aliaser. But I'm the best I can be. If I'm
aliasing to a Resource that generates links, and it uses any parts
of request.prepath to do so, the links will not be relative to the
aliased path, but rather to the aliased-to path. That I can't
alias static.File directory listings that nicely. However, I can
still be useful, as many resources will play nice.
"""
sourcePath = sourcePath.split("/")
aliasPath = aliasPath.split("/")
def rewriter(request):
if request.postpath[: len(aliasPath)] == aliasPath:
after = request.postpath[len(aliasPath) :]
request.postpath = sourcePath + after
request.path = "/" + "/".join(request.prepath + request.postpath)
return rewriter
| 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 |
|