예제 #1
0
    def __init__(self, server, options):
        super(WebMaster, self).__init__(options, server, WebState())
        self.addons.add(*builtins.default_addons())
        self.app = app.Application(
            self, self.options.wdebug, self.options.wauthenticator
        )
        # This line is just for type hinting
        self.options = self.options  # type: Options
        if options.rfile:
            try:
                self.load_flows_file(options.rfile)
            except exceptions.FlowReadException as v:
                self.add_log(
                    "Could not read flow file: %s" % v,
                    "error"
                )

        if options.outfile:
            err = self.start_stream_to_path(
                options.outfile[0],
                options.outfile[1]
            )
            if err:
                print("Stream file error: {}".format(err), file=sys.stderr)
                sys.exit(1)

        if self.options.app:
            self.start_app(self.options.app_host, self.options.app_port)
예제 #2
0
 def get_app(self):
     o = webmaster.Options()
     m = webmaster.WebMaster(o, proxy.DummyServer())
     return app.Application(m, None, None)
예제 #3
0
 def get_app(self):
     o = master.Options()
     m = master.WebMaster(None, o)
     return app.Application(m, None, None)