コード例 #1
0
def get():
    start_time = time.time()
    content, status, response = front.request("GET", "dns.xx-net.com", path="/query?domain=www.google.com")
    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #2
0
ファイル: test.py プロジェクト: chenqiuyan/XX-Net
def get():
    start_time = time.time()
    content, status, response = front.request("GET", "dns.xx-net.net", path="/query?domain=www.google.com")
    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #3
0
ファイル: test.py プロジェクト: zsmhub/XX-Net
def loop():
    while connect_control.keep_running:
        get()
        time.sleep(0)

    xlog.info("Exiting heroku_front module...")
    front.stop()
コード例 #4
0
ファイル: test.py プロジェクト: LawyerWebber/XX-Net
def loop():
    while connect_control.keep_running:
        get()
        time.sleep(0)

    xlog.info("Exiting heroku_front module...")
    front.stop()
コード例 #5
0
ファイル: test.py プロジェクト: chenqiuyan/XX-Net
def get():
    start_time = time.time()
    content, status, response = front.request("GET", "center.xx-net.net", "/", timeout=10)
    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #6
0
ファイル: proxy.py プロジェクト: dingli950411/learngit
def terminate():
    global ready, proxy_server

    xlog.info("start to terminate GAE_Proxy")
    ready = False
    front.stop()
    direct_front.stop()
    proxy_server.shutdown()
コード例 #7
0
ファイル: proxy.py プロジェクト: Suwmlee/XX-Net
def terminate():
    global ready, proxy_server

    xlog.info("start to terminate GAE_Proxy")
    ready = False
    front.stop()
    direct_front.stop()
    proxy_server.shutdown()
コード例 #8
0
ファイル: test.py プロジェクト: xx-Chen/XX-Net
def t1():
    content, status, response = front.request("GET",
                                              "scan1.xx-net.net",
                                              timeout=1000)
    print status

    del response
    #print("del response")
    front.stop()
コード例 #9
0
def get():
    start_time = time.time()
    content, status, response = front.request("GET",
                                              "scan1.xx-net.com",
                                              path="/wait?time=5")
    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #10
0
ファイル: test.py プロジェクト: Suwmlee/XX-Net
def t1():
    content, status, response = front.request("GET", "scan1.xx-net.net", timeout=1000)
    print status

    del response

    content, status, response = front.request("GET", "scan1.xx-net.net", timeout=1000)
    print status

    front.stop()
コード例 #11
0
def get():
    start_time = time.time()
    content, status, response = front.request("GET",
                                              "center.xx-net.net",
                                              "/",
                                              timeout=10)
    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #12
0
ファイル: test.py プロジェクト: Suwmlee/XX-Net
def get():
    start_time = time.time()

    content, status, response = front.request("GET", "scan1.xx-net.net", "/", timeout=10)
    #content, status, response = front.request("GET", "dns.xx-net.net", path="/query?domain=www.google.com")

    if isinstance(content, memoryview):
        content = content.tobytes()

    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #13
0
ファイル: test.py プロジェクト: gwm478268110/fanqiang-one
def get():
    start_time = time.time()

    content, status, response = front.request("GET",
                                              "scan1.xx-net.net",
                                              "/",
                                              timeout=10)
    #content, status, response = front.request("GET", "dns.xx-net.net", path="/query?domain=www.google.com")

    if isinstance(content, memoryview):
        content = content.tobytes()

    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()
コード例 #14
0
    sys.path.append(extra_lib)

from front import front
from xlog import getLogger
xlog = getLogger("cloudflare_front")
xlog.set_buffer(2000)


def get():
    start_time = time.time()
    #content, status, response = front.request("GET", "scan1.xx-net.net", "/", timeout=10)
    content, status, response = front.request(
        "GET", "dns.xx-net.net", path="/query?domain=www.google.com")

    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()


if __name__ == '__main__':
    import traceback

    try:
        get()
    except Exception:
        traceback.print_exc(file=sys.stdout)
    except KeyboardInterrupt:
        front.stop()
        sys.exit()
コード例 #15
0
def terminate():
    global ready, proxy_server
    ready = False
    proxy_server.shutdown()
    front.stop()
    xlog.info("start to terminate GAE_Proxy")
コード例 #16
0
ファイル: test.py プロジェクト: chenqiuyan/XX-Net
    extra_lib = "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python"
    sys.path.append(extra_lib)



from front import front
from xlog import getLogger
xlog = getLogger("heroku_front")
xlog.set_buffer(2000)


def get():
    start_time = time.time()
    content, status, response = front.request("GET", "dns.xx-net.net", path="/query?domain=www.google.com")
    time_cost = time.time() - start_time
    xlog.info("GET cost:%f", time_cost)
    xlog.info("status:%d content:%s", status, content)
    front.stop()


if __name__ == '__main__':
    import traceback

    try:
        get()
    except Exception:
        traceback.print_exc(file=sys.stdout)
    except KeyboardInterrupt:
        front.stop()
        sys.exit()
コード例 #17
0
ファイル: web_control.py プロジェクト: pokerfacs/XX-Net
    def do_GET(self):
        path = urlparse.urlparse(self.path).path
        if path == "/log":
            return self.req_log_handler()
        elif path == "/status":
            return self.req_status_handler()
        else:
            xlog.debug('GAEProxy Web_control %s %s %s ', self.address_string(), self.command, self.path)


        if path == '/deploy':
            return self.req_deploy_handler()
        elif path == "/config":
            return self.req_config_handler()
        elif path == "/ip_list":
            return self.req_ip_list_handler()
        elif path == "/scan_ip":
            return self.req_scan_ip_handler()
        elif path == "/ssl_pool":
            return self.req_ssl_pool_handler()
        elif path == "/workers":
            return self.req_workers_handler()
        elif path == "/download_cert":
            return self.req_download_cert_handler()
        elif path == "/is_ready":
            return self.req_is_ready_handler()
        elif path == "/test_ip":
            return self.req_test_ip_handler()
        elif path == "/check_ip":
            return self.req_check_ip_handler()
        elif path == "/debug":
            return self.req_debug_handler()
        elif path.startswith("/ipv6_tunnel"):
            return self.req_ipv6_tunnel_handler()
        elif path == "/quit":
            front.stop()
            direct_front.stop()
            data = "Quit"
            self.wfile.write(('HTTP/1.1 200\r\nContent-Type: %s\r\nContent-Length: %s\r\n\r\n' % ('text/plain', len(data))).encode())
            self.wfile.write(data)
            #sys.exit(0)
            #quit()
            #os._exit(0)
            return
        elif path.startswith("/wizard/"):
            file_path = os.path.abspath(os.path.join(web_ui_path, '/'.join(path.split('/')[1:])))
            if not os.path.isfile(file_path):
                self.wfile.write(b'HTTP/1.1 404 Not Found\r\n\r\n')
                xlog.warn('%s %s %s wizard file %s not found', self.address_string(), self.command, self.path, file_path)
                return

            if file_path.endswith('.html'):
                mimetype = 'text/html'
            elif file_path.endswith('.png'):
                mimetype = 'image/png'
            elif file_path.endswith('.jpg') or file_path.endswith('.jpeg'):
                mimetype = 'image/jpeg'
            else:
                mimetype = 'application/octet-stream'

            self.send_file(file_path, mimetype)
            return
        else:
            xlog.warn('Control Req %s %s %s ', self.address_string(), self.command, self.path)

        # check for '..', which will leak file
        if re.search(r'(\.{2})', self.path) is not None:
            self.wfile.write(b'HTTP/1.1 404\r\n\r\n')
            xlog.warn('%s %s %s haking', self.address_string(), self.command, self.path )
            return


        filename = os.path.normpath('./' + path)
        if self.path.startswith(('http://', 'https://')):
            data = b'HTTP/1.1 200\r\nCache-Control: max-age=86400\r\nExpires:Oct, 01 Aug 2100 00:00:00 GMT\r\nConnection: close\r\n'

            data += b'\r\n'
            self.wfile.write(data)
            xlog.info('%s "%s %s HTTP/1.1" 200 -', self.address_string(), self.command, self.path)
        elif os.path.isfile(filename):
            if filename.endswith('.pac'):
                mimetype = 'text/plain'
            else:
                mimetype = 'application/octet-stream'
            #self.send_file(filename, mimetype)
        else:
            self.wfile.write(b'HTTP/1.1 404\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n404 Not Found')
            xlog.info('%s "%s %s HTTP/1.1" 404 -', self.address_string(), self.command, self.path)
コード例 #18
0
    def do_GET(self):
        path = urlparse.urlparse(self.path).path
        if path == "/log":
            return self.req_log_handler()
        elif path == "/status":
            return self.req_status_handler()
        else:
            xlog.debug('GAEProxy Web_control %s %s %s ', self.address_string(),
                       self.command, self.path)

        if path == '/deploy':
            return self.req_deploy_handler()
        elif path == "/config":
            return self.req_config_handler()
        elif path == "/ip_list":
            return self.req_ip_list_handler()
        elif path == "/scan_ip":
            return self.req_scan_ip_handler()
        elif path == "/ssl_pool":
            return self.req_ssl_pool_handler()
        elif path == "/workers":
            return self.req_workers_handler()
        elif path == "/download_cert":
            return self.req_download_cert_handler()
        elif path == "/is_ready":
            return self.req_is_ready_handler()
        elif path == "/test_ip":
            return self.req_test_ip_handler()
        elif path == "/check_ip":
            return self.req_check_ip_handler()
        elif path == "/debug":
            return self.req_debug_handler()
        elif path.startswith("/ipv6_tunnel"):
            return self.req_ipv6_tunnel_handler()
        elif path == "/quit":
            front.stop()
            direct_front.stop()
            data = "Quit"
            self.wfile.write((
                'HTTP/1.1 200\r\nContent-Type: %s\r\nContent-Length: %s\r\n\r\n'
                % ('text/plain', len(data))).encode())
            self.wfile.write(data)
            #sys.exit(0)
            #quit()
            #os._exit(0)
            return
        elif path.startswith("/wizard/"):
            file_path = os.path.abspath(
                os.path.join(web_ui_path, '/'.join(path.split('/')[1:])))
            if not os.path.isfile(file_path):
                self.wfile.write(b'HTTP/1.1 404 Not Found\r\n\r\n')
                xlog.warn('%s %s %s wizard file %s not found',
                          self.address_string(), self.command, self.path,
                          file_path)
                return

            if file_path.endswith('.html'):
                mimetype = 'text/html'
            elif file_path.endswith('.png'):
                mimetype = 'image/png'
            elif file_path.endswith('.jpg') or file_path.endswith('.jpeg'):
                mimetype = 'image/jpeg'
            else:
                mimetype = 'application/octet-stream'

            self.send_file(file_path, mimetype)
            return
        else:
            xlog.warn('Control Req %s %s %s ', self.address_string(),
                      self.command, self.path)

        # check for '..', which will leak file
        if re.search(r'(\.{2})', self.path) is not None:
            self.wfile.write(b'HTTP/1.1 404\r\n\r\n')
            xlog.warn('%s %s %s haking', self.address_string(), self.command,
                      self.path)
            return

        filename = os.path.normpath('./' + path)
        if self.path.startswith(('http://', 'https://')):
            data = b'HTTP/1.1 200\r\nCache-Control: max-age=86400\r\nExpires:Oct, 01 Aug 2100 00:00:00 GMT\r\nConnection: close\r\n'

            data += b'\r\n'
            self.wfile.write(data)
            xlog.info('%s "%s %s HTTP/1.1" 200 -', self.address_string(),
                      self.command, self.path)
        elif os.path.isfile(filename):
            if filename.endswith('.pac'):
                mimetype = 'text/plain'
            else:
                mimetype = 'application/octet-stream'
            #self.send_file(filename, mimetype)
        else:
            self.wfile.write(
                b'HTTP/1.1 404\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n404 Not Found'
            )
            xlog.info('%s "%s %s HTTP/1.1" 404 -', self.address_string(),
                      self.command, self.path)
コード例 #19
0
ファイル: proxy.py プロジェクト: pokerfacs/XX-Net
def terminate():
    global ready, proxy_server
    ready = False
    proxy_server.shutdown()
    front.stop()
    xlog.info("start to terminate GAE_Proxy")