From 09cbc5c367125580f11ef4a2a4c860b5599a6ee0 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 19 Sep 2011 14:58:20 -0500 Subject: [PATCH] sshit => sshout --- setup.py | 9 +++++---- {sshit => sshout}/__init__.py | 0 {sshit => sshout}/cli.py | 0 {sshit => sshout}/core.py | 0 sshit_r => sshout/sshit_r | 0 {sshit => sshout}/sshserver.py | 0 {sshit => sshout}/sshsimpleserver.py | 18 +++++++++++------- sshout/tmpsshd.py | 0 8 files changed, 16 insertions(+), 11 deletions(-) rename {sshit => sshout}/__init__.py (100%) rename {sshit => sshout}/cli.py (100%) rename {sshit => sshout}/core.py (100%) rename sshit_r => sshout/sshit_r (100%) rename {sshit => sshout}/sshserver.py (100%) rename {sshit => sshout}/sshsimpleserver.py (90%) create mode 100644 sshout/tmpsshd.py diff --git a/setup.py b/setup.py index c7aed63..c1eac4a 100644 --- a/setup.py +++ b/setup.py @@ -26,14 +26,14 @@ if sys.version_info[0:2] < (2, 6): required.append('simplejson') setup( - name='sshit', + name='sshout', version='0.0.0', description='SSH it up.', long_description=open('README.rst').read(), author='Kenneth Reitz', author_email='me@kennethreitz.com', - url='https://github.com/kennethreitz/sshit', - packages= ['sshit'], + url='https://github.com/kennethreitz/sshout', + packages= ['sshout'], install_requires=required, license='ISC', classifiers=( @@ -50,7 +50,8 @@ setup( ), entry_points = { 'console_scripts': [ - 'sshit = sshit.cli:main' + 'sshout = sshout.cli:main', + 'tmpsshd = sshout.tmpsshd:main', ] } ) diff --git a/sshit/__init__.py b/sshout/__init__.py similarity index 100% rename from sshit/__init__.py rename to sshout/__init__.py diff --git a/sshit/cli.py b/sshout/cli.py similarity index 100% rename from sshit/cli.py rename to sshout/cli.py diff --git a/sshit/core.py b/sshout/core.py similarity index 100% rename from sshit/core.py rename to sshout/core.py diff --git a/sshit_r b/sshout/sshit_r similarity index 100% rename from sshit_r rename to sshout/sshit_r diff --git a/sshit/sshserver.py b/sshout/sshserver.py similarity index 100% rename from sshit/sshserver.py rename to sshout/sshserver.py diff --git a/sshit/sshsimpleserver.py b/sshout/sshsimpleserver.py similarity index 90% rename from sshit/sshsimpleserver.py rename to sshout/sshsimpleserver.py index c8ed4df..89be625 100644 --- a/sshit/sshsimpleserver.py +++ b/sshout/sshsimpleserver.py @@ -10,6 +10,7 @@ from twisted.conch.ssh import factory, userauth, connection, keys, session from twisted.internet import reactor, protocol, defer from twisted.python import log from zope.interface import implements +from twisted.conch.unix import UnixSSHRealm import sys log.startLogging(sys.stderr) @@ -106,14 +107,17 @@ class ExampleFactory(factory.SSHFactory): # portal = portal.Portal(ExampleRealm()) -from twisted.conch.unix import UnixSSHRealm -portal = portal.Portal(UnixSSHRealm()) -passwdDB = checkers.InMemoryUsernamePasswordDatabaseDontUse() -passwdDB.addUser('kreitz', 'password') -portal.registerChecker(passwdDB) -portal.registerChecker(InMemoryPublicKeyChecker()) -ExampleFactory.portal = portal +def bootstrap(username): + from twisted.cred import portal + + portal = portal.Portal(UnixSSHRealm()) + passwdDB = checkers.InMemoryUsernamePasswordDatabaseDontUse() + passwdDB.addUser(username, 'password') + portal.registerChecker(passwdDB) + portal.registerChecker(InMemoryPublicKeyChecker()) + ExampleFactory.portal = portal if __name__ == '__main__': + bootstrap('kreitz') reactor.listenTCP(5022, ExampleFactory()) reactor.run() diff --git a/sshout/tmpsshd.py b/sshout/tmpsshd.py new file mode 100644 index 0000000..e69de29