__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# -*- test-case-name: twisted.conch.test.test_tap -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Support module for making SSH servers with twistd.
"""
from twisted.application import strports
from twisted.conch import checkers as conch_checkers, unix
from twisted.conch.openssh_compat import factory
from twisted.cred import portal, strcred
from twisted.python import usage
class Options(usage.Options, strcred.AuthOptionMixin):
synopsis = "[-i <interface>] [-p <port>] [-d <dir>] "
longdesc = (
"Makes a Conch SSH server. If no authentication methods are "
"specified, the default authentication methods are UNIX passwords "
"and SSH public keys. If --auth options are "
"passed, only the measures specified will be used."
)
optParameters = [
["interface", "i", "", "local interface to which we listen"],
["port", "p", "tcp:22", "Port on which to listen"],
["data", "d", "/etc", "directory to look for host keys in"],
[
"moduli",
"",
None,
"directory to look for moduli in " "(if different from --data)",
],
]
compData = usage.Completions(
optActions={
"data": usage.CompleteDirs(descr="data directory"),
"moduli": usage.CompleteDirs(descr="moduli directory"),
"interface": usage.CompleteNetInterfaces(),
}
)
def __init__(self, *a, **kw):
usage.Options.__init__(self, *a, **kw)
# Call the default addCheckers (for backwards compatibility) that will
# be used if no --auth option is provided - note that conch's
# UNIXPasswordDatabase is used, instead of twisted.plugins.cred_unix's
# checker
super().addChecker(conch_checkers.UNIXPasswordDatabase())
super().addChecker(
conch_checkers.SSHPublicKeyChecker(conch_checkers.UNIXAuthorizedKeysFiles())
)
self._usingDefaultAuth = True
def addChecker(self, checker):
"""
Add the checker specified. If any checkers are added, the default
checkers are automatically cleared and the only checkers will be the
specified one(s).
"""
if self._usingDefaultAuth:
self["credCheckers"] = []
self["credInterfaces"] = {}
self._usingDefaultAuth = False
super().addChecker(checker)
def makeService(config):
"""
Construct a service for operating a SSH server.
@param config: An L{Options} instance specifying server options, including
where server keys are stored and what authentication methods to use.
@return: A L{twisted.application.service.IService} provider which contains
the requested SSH server.
"""
t = factory.OpenSSHFactory()
r = unix.UnixSSHRealm()
t.portal = portal.Portal(r, config.get("credCheckers", []))
t.dataRoot = config["data"]
t.moduliRoot = config["moduli"] or config["data"]
port = config["port"]
if config["interface"]:
# Add warning here
port += ":interface=" + config["interface"]
return strports.service(port, t)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| client | Folder | 0755 |
|
|
| insults | Folder | 0755 |
|
|
| newsfragments | Folder | 0755 |
|
|
| openssh_compat | Folder | 0755 |
|
|
| scripts | Folder | 0755 |
|
|
| ssh | Folder | 0755 |
|
|
| test | Folder | 0755 |
|
|
| ui | Folder | 0755 |
|
|
| __init__.py | File | 198 B | 0644 |
|
| avatar.py | File | 1.6 KB | 0644 |
|
| checkers.py | File | 21.41 KB | 0644 |
|
| endpoints.py | File | 29.26 KB | 0644 |
|
| error.py | File | 2.6 KB | 0644 |
|
| interfaces.py | File | 14.57 KB | 0644 |
|
| ls.py | File | 2.63 KB | 0644 |
|
| manhole.py | File | 12.08 KB | 0644 |
|
| manhole_ssh.py | File | 4.32 KB | 0644 |
|
| manhole_tap.py | File | 5.36 KB | 0644 |
|
| mixin.py | File | 1.34 KB | 0644 |
|
| recvline.py | File | 18.71 KB | 0644 |
|
| stdio.py | File | 2.71 KB | 0644 |
|
| tap.py | File | 3.12 KB | 0644 |
|
| telnet.py | File | 37.16 KB | 0644 |
|
| ttymodes.py | File | 2.14 KB | 0644 |
|
| unix.py | File | 16.67 KB | 0644 |
|