def __init__(self, air, listenPort=8080): SystemInformation.__init__(self) self.listenPort = listenPort self.air = simbase.air # self.taskMgr = Task.TaskManager() if __debug__: print "Listen port set to: %d" % self.listenPort # Start dispatcher self.web = WebRequest.WebRequestDispatcher() self.web.listenOnPort(self.listenPort) self.localHostName = gethostname() self.web.registerGETHandler('inspect', self.inspect) self.web.registerGETHandler('systemInfo', self.systemInfo) self.web.registerGETHandler('oMenu', self.oMenu) self.web.registerGETHandler('oType', self.oType) self.web.registerGETHandler('oInst', self.oInst) self.web.registerGETHandler('blank', self.blank) self.web.registerGETHandler('magicWord', self.magicWord) self.startCheckingIncomingHTTP() self.air.setConnectionURL( "http://%s:%s/" % (socket.gethostbyname(socket.gethostname()), self.HTTPListenPort))
def __init__(self, portNumber=8888, username=None, password=None): self.portNumber = portNumber self.username = username self.password = password self.passwordProtect = False self.pageToHit = 'debug' self.authTokens = [] self.web = WebRequest.WebRequestDispatcher() self.web.listenOnPort(int(self.portNumber)) # 'debug' will be the name of the page we have to hit # If both a username and password should be specified, then # we will need to present a username and password prompt to the user if self.username and self.password: # set self.passwordProtect to True self.passwordProtect = True # Register 'debug' with the password prompt self.web.registerGETHandler('debug', self.passwordPrompt) self.web.registerGETHandler('authDebug', self.authDebug) self.pageToHit = 'authDebug' else: self.web.registerGETHandler('debug', self.debug) self.startCheckingIncomingHTTP()