summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/application.py16
-rw-r--r--service/pixelated/config/arguments.py1
2 files changed, 17 insertions, 0 deletions
diff --git a/service/pixelated/application.py b/service/pixelated/application.py
index 178726ef..7e97ee74 100644
--- a/service/pixelated/application.py
+++ b/service/pixelated/application.py
@@ -191,6 +191,22 @@ def _start_in_single_user_mode(args, resource, services_factory):
def start_site(config, resource):
log.info('Starting the API on port %s' % config.port)
+ if config.manhole:
+ MANHOLE_PORT = 8008
+ log.info('Starting the manhole on port %s' % MANHOLE_PORT)
+ from twisted.conch import manhole, manhole_tap, telnet
+ from twisted.conch.insults import insults
+ from twisted.cred import portal, checkers
+ from twisted.internet.protocol import ServerFactory
+ passwdFile, namespace = 'passwd', globals()
+ telnetRealm = manhole_tap._StupidRealm(telnet.TelnetBootstrapProtocol,
+ insults.ServerProtocol,
+ manhole.ColoredManhole,
+ namespace)
+ telnetPortal = portal.Portal(telnetRealm, [checkers.FilePasswordDB(passwdFile)])
+ telnetFactory = ServerFactory()
+ telnetFactory.protocol = manhole_tap.makeTelnetProtocol(telnetPortal)
+ reactor.listenTCP(MANHOLE_PORT, telnetFactory)
if config.sslkey and config.sslcert:
reactor.listenSSL(config.port, PixelatedSite(resource), _ssl_options(config.sslkey, config.sslcert),
interface=config.host)
diff --git a/service/pixelated/config/arguments.py b/service/pixelated/config/arguments.py
index b6b3ce43..b5f2101a 100644
--- a/service/pixelated/config/arguments.py
+++ b/service/pixelated/config/arguments.py
@@ -30,6 +30,7 @@ def parse_user_agent_args():
parser.add_argument('--multi-user', help='Run user agent in multi user mode', action='store_false', default=True, dest='single_user')
parser.add_argument('-p', '--provider', help='specify a provider for mutli-user mode', metavar='<provider host>', default=None, dest='provider')
parser.add_argument('--banner', help='banner file to show on login screen')
+ parser.add_argument('--manhole', help='Run an interactive Python shell on port 8008', action='store_true', default=False, dest='manhole')
args = parser.parse_args()