diff --git a/twisted/__init__.py b/twisted/__init__.py
new file mode 100644
index 0000000..d20a73e
--- /dev/null
+++ b/twisted/__init__.py
@@ -0,0 +1,47 @@
+"""
+$Id$
+"""
+
+from twisted.internet import reactor, protocol
+from twisted.protocols import basic
+from twisted.cred import portal, checkers
+from twisted.conch import manhole, manhole_ssh
+try:
+ from zope.app.publication.zopepublication import ZopePublication
+ from zope.app.component.hooks import setSite
+ hasZope = True
+except:
+ hasZope = False
+import time
+import sys
+from cStringIO import StringIO
+
+def getManholeFactory(namespace, **passwords):
+ realm = manhole_ssh.TerminalRealm()
+ def getManhole(_):
+ return manhole.Manhole(namespace)
+ realm.chainedProtocolFactory.protocolFactory = getManhole
+ p = portal.Portal(realm)
+ p.registerChecker(
+ checkers.InMemoryUsernamePasswordDatabaseDontUse(**passwords))
+ return manhole_ssh.ConchFactory(p)
+
+def printTime():
+ print 'twisted.manhole running:', time.strftime('%H:%M:%S')
+ reactor.callLater(60, printTime)
+
+#reactor.callLater(10, stopReactor)
+#reactor.listenTCP(5222, EchoServerFactory())
+
+def startup(event=None):
+ printTime()
+ d = globals()
+ #d['event'] = event
+ if hasZope and event is not None:
+ conn =event.database.open()
+ root = conn.root()[ZopePublication.root_name]
+ d.update(locals())
+ reactor.listenTCP(5001, getManholeFactory(d, admin='aaa'))
+
+if __name__ == '__main__':
+ startup()
\ No newline at end of file
diff --git a/twisted/configure.zcml b/twisted/configure.zcml
new file mode 100644
index 0000000..a4f3b8a
--- /dev/null
+++ b/twisted/configure.zcml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/twisted/cybertools.twisted-configure.zcml b/twisted/cybertools.twisted-configure.zcml
new file mode 100644
index 0000000..83e774b
--- /dev/null
+++ b/twisted/cybertools.twisted-configure.zcml
@@ -0,0 +1 @@
+
diff --git a/twisted/manhole.py b/twisted/manhole.py
new file mode 100644
index 0000000..3f14fb4
--- /dev/null
+++ b/twisted/manhole.py
@@ -0,0 +1,76 @@
+"""
+$Id$
+"""
+
+from twisted.internet import reactor, protocol
+from twisted.protocols import basic
+from twisted.cred import portal, checkers
+from twisted.conch import manhole, manhole_ssh
+try:
+ from zope.app.publication.zopepublication import ZopePublication
+ from zope.app.component.hooks import setSite
+ from zope.app import zapi
+ hasZope = True
+except:
+ hasZope = False
+import time
+import sys
+from cStringIO import StringIO
+
+def getManholeFactory(namespace, **passwords):
+ realm = manhole_ssh.TerminalRealm()
+ def getManhole(_):
+ return manhole.Manhole(namespace)
+ realm.chainedProtocolFactory.protocolFactory = getManhole
+ p = portal.Portal(realm)
+ p.registerChecker(
+ checkers.InMemoryUsernamePasswordDatabaseDontUse(**passwords))
+ return manhole_ssh.ConchFactory(p)
+
+def printTime():
+ print 'twisted.manhole running:', time.strftime('%H:%M:%S')
+ reactor.callLater(60, printTime)
+
+#reactor.callLater(10, stopReactor)
+#reactor.listenTCP(5222, EchoServerFactory())
+
+def help():
+ info = """
+ Use dir() to see what variables and functions are available."""
+ zopeInfo = """
+ In order to get access to local utilities and adapters you should
+ issue a setSite(root). Don't forget to call setSite() before
+ finishing your session.
+ You may use x = zapi.traverse(root, 'path/to/object') to get an
+ object in your folder hierarchy. Then you may call any method or
+ access any attribute of this object."""
+ print info
+ if hasZope:
+ print zopeInfo
+ print
+
+def startup(event=None, port=5001):
+ global hasZope
+ printTime()
+ d = globals()
+ if hasZope and event is not None:
+ conn =event.database.open()
+ root = conn.root()[ZopePublication.root_name]
+ else:
+ hasZope = False
+ d.update(locals())
+ namespace = {}
+ for key in ('__builtins__', 'event', 'setSite', 'hasZope', 'zapi', 'root',
+ '__doc__', 'help'):
+ if key in d:
+ namespace[key] = d[key]
+ reactor.listenTCP(port, getManholeFactory(namespace, admin='aaa'))
+
+if __name__ == '__main__':
+ port = 5001
+ if len(sys.argv) > 1:
+ port = int(sys.argv[-1])
+ startup(port=port)
+ reactor.run()
+
+
\ No newline at end of file