<s> """<STR_LIT>""" <EOL> from twisted . manhole import service <EOL> from twisted . spread import pb <EOL> from twisted . python import usage , util <EOL> from twisted . cred import portal , checkers <EOL> from twisted . application import strports <EOL> class Options ( usage . Options ) : <EOL> synopsis = "<STR_LIT>" <EOL> optParameters = [ <EOL> [ "<STR_LIT:user>" , "<STR_LIT:u>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> [ "<STR_LIT:port>" , "<STR_LIT:p>" , str ( pb . portno ) , "<STR_LIT>" ] , <EOL> ] <EOL> optFlags = [ <EOL> [ "<STR_LIT>" , "<STR_LIT:T>" , "<STR_LIT>" ] , <EOL> ] <EOL> compData = usage . Completions ( <EOL> optActions = { "<STR_LIT:user>" : usage . CompleteUsernames ( ) } <EOL> ) <EOL> def opt_password ( self , password ) : <EOL> """<STR_LIT>""" <EOL> if password in ( '<STR_LIT>' , '<STR_LIT:->' ) : <EOL> self [ '<STR_LIT:password>' ] = util . getPassword ( confirm = <NUM_LIT:1> ) <EOL> else : <EOL> self [ '<STR_LIT:password>' ] = password <EOL> opt_w = opt_password <EOL> def postOptions ( self ) : <EOL> if not self . has_key ( '<STR_LIT:password>' ) : <EOL> self . opt_password ( '<STR_LIT:->' ) <EOL> def makeService ( config ) : <EOL> port , user , password = config [ '<STR_LIT:port>' ] , config [ '<STR_LIT:user>' ] , config [ '<STR_LIT:password>' ] <EOL> p = portal . Portal ( <EOL> service . Realm ( service . Service ( config [ "<STR_LIT>" ] , config . get ( '<STR_LIT>' ) ) ) , <EOL> [ checkers . InMemoryUsernamePasswordDatabaseDontUse ( ** { user : password } ) ] <EOL> ) <EOL> return strports . service ( port , pb . PBServerFactory ( p , config [ "<STR_LIT>" ] ) ) </s>
