summaryrefslogtreecommitdiff
path: root/login.py
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-11-14 01:28:23 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2009-11-14 01:28:23 +0100
commitdcebcafcc52ae847077890b551b8319d80d36d91 (patch)
tree1496e0436e56a8076891ed6be551004c59d32c13 /login.py
A much needed inital import.
Diffstat (limited to 'login.py')
-rw-r--r--login.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/login.py b/login.py
new file mode 100644
index 0000000..869f678
--- /dev/null
+++ b/login.py
@@ -0,0 +1,20 @@
+from twisted.cred import portal, checkers
+from twisted.conch import manhole, manhole_ssh
+
+def getManholeFactory(namespace, **passwords):
+ def getManhole(_):
+ return manhole.Manhole(namespace)
+
+ realm = manhole_ssh.TerminalRealm()
+ realm.chainedProtocolFactory.protocolFactory = getManhole
+
+ p = portal.Portal(realm)
+ p.registerChecker(checkers.InMemoryUsernamePasswordDatabaseDontUse(**passwords))
+
+ return manhole_ssh.ConchFactory(p)
+
+if __name__ == '__main__':
+ from twisted.internet import reactor
+ factory = getManholeFactory({'x': 'foo'}, user = 'pass')
+ reactor.listenTCP(5022, factory)
+ reactor.run()