示例#1
0
    def __init__(self, port=None):
        self.verbose = console.Option(False)
        self.strict = console.Option(False)
        self.autoTrace = console.Option(False)
        self.stretch = console.Option(100)

        self.console = console.Command()
        self.console.finishFunction = self.finish
        if port is None:
            self.nextPort = randomPort()
        else:
            self.nextPort = port
        self.eventManager = events.EventManager()
        self.fileManager = files.FileManager(printer=self.console)
        self.fileManager.purgeResponseFiles()
        self.requestManager = agents.RequestGenerator(self.eventManager,
                                                      self.fileManager,
                                                      self.console,
                                                      strict=self.strict,
                                                      verbose=self.verbose)
        self.servers = {}
        self.proxyProcess = None

        self.console.addOption(
            "strict", self.strict,
            "Apply strict testing of HTTP requests and responses")
        self.console.addOption("verbose", self.verbose, "Show details")
        self.console.addOption(
            "stretch", self.stretch,
            "Multiply all delays by factor = stretch / 100")
        self.console.addOption("autotrace", self.autoTrace,
                               "Trace every request for which check fails")
        self.console.addCommand("serve", self.doServe, "SID+",
                                "Set up servers")
        self.console.addCommand(
            "request", self.doRequest, "ID FILE SID",
            "Initiate request named ID for FILE from server SID")
        self.console.addCommand(
            "fetch", self.doFetch, "ID FILE SID",
            "Fetch FILE from server SID using request named ID")
        self.console.addCommand(
            "respond", self.doRespond, "ID+",
            "Allow servers to return reponses to requests")
        self.console.addCommand("delay", self.doDelay, "MS",
                                "Delay for MS milliseconds")
        self.console.addCommand(
            "check", self.doCheck, "ID [CODE]",
            "Make sure request ID handled properly and generated expected CODE"
        )
        self.console.addCommand(
            "generate", self.doGenerate, "FILE BYTES",
            "Generate file (extension '.txt' or '.bin') with specified number of bytes"
        )
        self.console.addCommand("delete", self.doDelete, "FILE+",
                                "Delete specified files")
        self.console.addCommand(
            "proxy", self.doProxy, "[PATH] ARG*",
            "(Re)start proxy server (pass arguments to proxy)")
        self.console.addCommand("trace", self.doTrace, "ID+",
                                "Trace histories of requests")
示例#2
0
    def __init__(self):
        self.verbose = console.Option(False)
        self.strict = console.Option(0)
        self.autoTrace = console.Option(False)
        self.stretch = console.Option(100)
        self.timeout = console.Option(5000)
        self.checkTiming = console.Option(False)
        self.checkUnsafe = console.Option(False)
        self.checkLocking = console.Option(False)
        self.checkSemaphore = console.Option(False)
        self.linefeedPercent = console.Option(5)

        self.console = console.Command()
        self.console.finishFunction = self.finish
        self.host = socket.gethostname()
        self.eventManager = events.EventManager()
        self.fileManager = files.FileManager(printer = self.console, fileGenerator = findFileGenerator())
        self.fileManager.purgeResponseFiles()
        self.requestManager = agents.RequestGenerator(self.eventManager, self.fileManager, self.console, strict = self.strict, verbose = self.verbose)
        self.portManager = agents.PortFinder(self.console)
        self.servers = {}
        self.monitors = []
        self.haveProxy = False
        self.proxyProcess = None
        self.activeEvents = {}
        self.getId = 0

        self.console.addOption("strict", self.strict, "Set level of strictness on HTTP message formatting (0-4)")
        self.console.addOption("timing", self.checkTiming, "Insert random delays into synchronization operations")
        self.console.addOption("unsafe", self.checkLocking, "Check for thread-unsafe functions")
        self.console.addOption("locking", self.checkLocking, "Check proper use of locks")
        self.console.addOption("semaphore", self.checkSemaphore, "Disallow use of semaphores")
        self.console.addOption("verbose", self.verbose, "Show details")
        self.console.addOption("stretch", self.stretch, "Multiply all delays by factor = stretch / 100")
        self.console.addOption("timeout", self.timeout, "Set default timeout for wait (in milliseconds)")
        self.console.addOption("autotrace", self.autoTrace, "Trace every request for which check fails")
        self.console.addOption("linefeed", self.linefeedPercent, "Frequency of line feeds in binary files (percent)")
        self.console.addCommand("serve", self.doServe,         "SID+",   "Set up servers.  (Server with SID starting with '-' is disabled.)")
        self.console.addCommand("request", self.doRequest,     "ID FILE SID",    "Initiate request named ID for FILE from server SID")
        self.console.addCommand("post-request", self.doPostRequest,     "ID FILE SID",    "Initiate request named ID for FILE from server SID")
        self.console.addCommand("fetch", self.doFetch,     "ID FILE SID",    "Fetch FILE from server SID using request named ID")
        self.console.addCommand("respond", self.doRespond,     "ID+",   "Allow servers to return reponses to requests")
        self.console.addCommand("get", self.doGet,            "URL", "Retrieve web object with and without proxy and compare the two")
        self.console.addCommand("delay", self.doDelay,         "MS",              "Delay for MS milliseconds")
        self.console.addCommand("check", self.doCheck,         "ID [CODE]",     "Make sure request ID handled properly and generated expected CODE")
        self.console.addCommand("generate", self.doGenerate,   "FILE BYTES",      "Generate file (extension '.txt' or '.bin') with specified number of bytes")
        self.console.addCommand("delete", self.doDelete,       "FILE+",  "Delete specified files")
        self.console.addCommand("proxy", self.doProxy,         "[PATH] ARG*", "(Re)start proxy server (pass arguments to proxy)")
        self.console.addCommand("external", self.doExternalProxy,    "HOST:PORT", "Use external proxy")
        self.console.addCommand("trace", self.doTrace,         "ID+",   "Trace histories of requests")
        self.console.addCommand("signal", self.doSignal,       "[SIGNO]", "Send signal number SIGNO to process.  Default = 13 (SIGPIPE)")
        self.console.addCommand("disrupt", self.doDisrupt,     "(request|response) [SID]", "Schedule disruption of request or response by client [or server SID]")
        self.console.addCommand("wait", self.doWait,          "* | ID+", "Wait until all or listed pending requests, fetches, and responses have completed")
示例#3
0
    def __init__(self, port=None):
        self.verbose = console.Option(False)
        self.strict = console.Option(0)
        self.autoTrace = console.Option(False)
        self.stretch = console.Option(100)
        self.timeout = console.Option(3000)

        self.console = console.Command()
        self.console.finishFunction = self.finish
        if port is None:
            self.nextPort = randomPort()
        else:
            self.nextPort = port
        self.host = socket.gethostname()
        self.eventManager = events.EventManager()
        self.fileManager = files.FileManager(printer=self.console)
        self.fileManager.purgeResponseFiles()
        self.requestManager = agents.RequestGenerator(self.eventManager,
                                                      self.fileManager,
                                                      self.console,
                                                      strict=self.strict,
                                                      verbose=self.verbose)
        self.servers = {}
        self.haveProxy = False
        self.proxyProcess = None
        self.activeEvents = {}

        self.console.addOption(
            "strict", self.strict,
            "Set level of strictness on HTTP message formatting (0-4)")
        self.console.addOption("verbose", self.verbose, "Show details")
        self.console.addOption(
            "stretch", self.stretch,
            "Multiply all delays by factor = stretch / 100")
        self.console.addOption(
            "timeout", self.timeout,
            "Set default timeout for wait (in milliseconds)")
        self.console.addOption("autotrace", self.autoTrace,
                               "Trace every request for which check fails")
        self.console.addCommand(
            "serve", self.doServe, "SID+",
            "Set up servers.  (Server with SID starting with '-' is disabled.)"
        )
        self.console.addCommand(
            "request", self.doRequest, "ID FILE SID",
            "Initiate request named ID for FILE from server SID")
        self.console.addCommand(
            "fetch", self.doFetch, "ID FILE SID",
            "Fetch FILE from server SID using request named ID")
        self.console.addCommand(
            "respond", self.doRespond, "ID+",
            "Allow servers to return reponses to requests")
        self.console.addCommand("delay", self.doDelay, "MS",
                                "Delay for MS milliseconds")
        self.console.addCommand(
            "check", self.doCheck, "ID [CODE]",
            "Make sure request ID handled properly and generated expected CODE"
        )
        self.console.addCommand(
            "generate", self.doGenerate, "FILE BYTES",
            "Generate file (extension '.txt' or '.bin') with specified number of bytes"
        )
        self.console.addCommand("delete", self.doDelete, "FILE+",
                                "Delete specified files")
        self.console.addCommand(
            "proxy", self.doProxy, "[PATH] ARG*",
            "(Re)start proxy server (pass arguments to proxy)")
        self.console.addCommand("external", self.doExternalProxy, "HOST:PORT",
                                "Use external proxy")
        self.console.addCommand("trace", self.doTrace, "ID+",
                                "Trace histories of requests")
        self.console.addCommand(
            "signal", self.doSignal, "[SIGNO]",
            "Send signal number SIGNO to process.  Default = 13 (SIGPIPE)")
        self.console.addCommand(
            "disrupt", self.doDisrupt, "(request|response) [SID]",
            "Schedule disruption of request or response by client [or server SID]"
        )
        self.console.addCommand(
            "wait", self.doWait, "* | ID+",
            "Wait until all or listed pending requests, fetches, and responses have completed"
        )