def __init__(self, spec): debug = spec.get("debug", False) debugCodePaths = spec.get("debugCodePaths", False) if spec.get("enable-ssl", False): from twisted.internet import ssl self.contextFactory = ssl.ClientContextFactory() else: self.contextFactory = None WebSocketClientFactory.__init__(self, debug=debug, debugCodePaths=debugCodePaths) FuzzingFactory.__init__(self, debug=debug, outdir=spec.get("outdir", "./reports/servers/")) self.spec = spec self.specCases = parseSpecCases(self.spec) self.specExcludeAgentCases = parseExcludeAgentCases(self.spec) print "Autobahn WebSockets %s Fuzzing Client" % autobahn.version print "Ok, will run %d test cases against %d servers" % (len(self.specCases), len(spec["servers"])) print "Cases = %s" % str(self.specCases) print "Servers = %s" % str([x["url"] + "@" + x["agent"] for x in spec["servers"]]) self.currServer = -1 if self.nextServer(): if self.nextCase(): connectWS(self, contextFactory=self.contextFactory)
def __init__(self, spec): debug = spec.get("debug", False) debugCodePaths = spec.get("debugCodePaths", False) if spec.get("enable-ssl", False): from twisted.internet import ssl self.contextFactory = ssl.ClientContextFactory() else: self.contextFactory = None WebSocketClientFactory.__init__(self, debug=debug, debugCodePaths=debugCodePaths) FuzzingFactory.__init__(self, debug=debug, outdir=spec.get("outdir", "./reports/servers/")) self.spec = spec self.specCases = parseSpecCases(self.spec) self.specExcludeAgentCases = parseExcludeAgentCases(self.spec) print "Autobahn WebSockets %s Fuzzing Client" % autobahn.version print "Ok, will run %d test cases against %d servers" % (len( self.specCases), len(spec["servers"])) print "Cases = %s" % str(self.specCases) print "Servers = %s" % str( [x["url"] + "@" + x["agent"] for x in spec["servers"]]) self.currServer = -1 if self.nextServer(): if self.nextCase(): connectWS(self, contextFactory=self.contextFactory)
def clientConnectionFailed(self, connector, reason): print "Connection to %s failed (%s)" % (self.spec["servers"][self.currServer]["url"], reason.getErrorMessage()) if self.nextServer(): if self.nextCase(): connectWS(self) else: self.createReports() reactor.stop()
def clientConnectionFailed(self, connector, reason): print "Connection to %s failed (%s)" % (self.spec["servers"][ self.currServer]["url"], reason.getErrorMessage()) if self.nextServer(): if self.nextCase(): connectWS(self) else: self.createReports() reactor.stop()
def clientConnectionLost(self, connector, reason): if self.nextCase(): connector.connect() else: if self.nextServer(): if self.nextCase(): connectWS(self, contextFactory=self.contextFactory) else: self.createReports() reactor.stop()