Esempio n. 1
0
  def setUpClass(cls):
    super(GRRHTTPServerTest, cls).setUpClass()

    cls.config_overrider = test_lib.ConfigOverrider({
        "Rekall.profile_server":
            rekall_test_lib.TestRekallRepositoryProfileServer.__name__
    })
    cls.config_overrider.Start()

    # Frontend must be initialized to register all the stats counters.
    front_end.FrontendInit().RunOnce()

    # Bring up a local server for testing.
    port = portpicker.PickUnusedPort()
    ip = utils.ResolveHostnameToIP("localhost", port)
    cls.httpd = frontend.GRRHTTPServer((ip, port),
                                       frontend.GRRHTTPServerHandler)

    if ipaddr.IPAddress(ip).version == 6:
      cls.address_family = socket.AF_INET6
      cls.base_url = "http://[%s]:%d/" % (ip, port)
    else:
      cls.address_family = socket.AF_INET4
      cls.base_url = "http://%s:%d/" % (ip, port)

    cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)
    cls.httpd_thread.daemon = True
    cls.httpd_thread.start()
Esempio n. 2
0
  def setUpClass(cls):
    super(GRRHTTPServerTest, cls).setUpClass()
    # Frontend must be initialized to register all the stats counters.
    front_end.FrontendInit().RunOnce()

    # Bring up a local server for testing.
    cls.httpd = http_server.GRRHTTPServer(
        ("127.0.0.1", portpicker.PickUnusedPort()),
        http_server.GRRHTTPServerHandler)

    cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)
    cls.httpd_thread.daemon = True
    cls.httpd_thread.start()

    cls.base_url = "http://%s:%s/" % cls.httpd.server_address
Esempio n. 3
0
    def setUpClass(cls):
        super(GRRHTTPServerTest, cls).setUpClass()
        # Frontend must be initialized to register all the stats counters.
        front_end.FrontendInit().RunOnce()

        # Bring up a local server for testing.
        port = portpicker.PickUnusedPort()
        ip = utils.ResolveHostnameToIP("localhost", port)
        cls.httpd = http_server.GRRHTTPServer((ip, port),
                                              http_server.GRRHTTPServerHandler)

        if ipaddr.IPAddress(ip).version == 6:
            cls.address_family = socket.AF_INET6
            cls.base_url = "http://[%s]:%d/" % (ip, port)
        else:
            cls.address_family = socket.AF_INET4
            cls.base_url = "http://%s:%d/" % (ip, port)

        cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)
        cls.httpd_thread.daemon = True
        cls.httpd_thread.start()