Пример #1
0
    def __init__(self):
        self.running = True

        self.host_manager = HostManagerBase()

        ca_certs = os.path.join(current_path, "cacert.pem")
        self.openssl_context = SSLContext(
            logger,
            ca_certs=ca_certs,
            support_http2=False,
            cipher_suites=[
                'ALL', "!RC4-SHA", "!ECDHE-RSA-RC4-SHA",
                "!ECDHE-RSA-AES128-GCM-SHA256", "!AES128-GCM-SHA256",
                "!ECDHE-RSA-AES128-SHA", "!AES128-SHA"
            ])

        self.connect_creator = ConnectCreator(logger, front.config,
                                              self.openssl_context,
                                              self.host_manager)

        self.connect_manager = ConnectManager(logger, front.config,
                                              self.connect_creator,
                                              front.ip_manager,
                                              check_local_network)

        self.dispatchs = {}
Пример #2
0
    def __init__(self):
        config_path = os.path.join(module_data_path, "heroku_front.json")
        config = Config(config_path)

        openssl_context = SSLContext(logger)

        host_manager = HostManagerBase()
        connect_creator = ConnectCreator(logger, config, openssl_context, host_manager,
                                         debug=True)
        self.check_ip = CheckIp(logger, config, connect_creator)

        self.lock = threading.Lock()

        self.in_fd = open("good_ip.txt", "r")
        self.out_fd = open(
            os.path.join(module_data_path, "heroku_checked_ip.txt"),
            "w"
        )
Пример #3
0
def check_one(ip, top_domain, wait_time):
    config_path = os.path.join(module_data_path, "heroku_front.json")
    config = Config(config_path)

    openssl_context = SSLContext(logger)

    host_manager = HostManagerBase()
    connect_creator = ConnectCreator(logger, config, openssl_context, host_manager,
                                     debug=True)
    check_ip = CheckIp(logger, config, connect_creator)

    res = check_ip.check_ip(ip, host=top_domain, wait_time=wait_time)
    if not res:
        print("connect fail")
    elif res.ok:
        print(("success, domain:%s handshake:%d" % (res.domain, res.handshake_time)))
    else:
        print("not support")
Пример #4
0
    def __init__(self):
        ca_certs = os.path.join(current_path, "cacert.pem")
        openssl_context = SSLContext(
            logger, ca_certs=ca_certs,
            cipher_suites=['ALL', "!RC4-SHA", "!ECDHE-RSA-RC4-SHA", "!ECDHE-RSA-AES128-GCM-SHA256",
                           "!AES128-GCM-SHA256", "!ECDHE-RSA-AES128-SHA", "!AES128-SHA"]
        )
        host_manager = HostManagerBase()
        connect_creator = ConnectCreator(logger, config, openssl_context, host_manager,
                                         debug=True)
        self.check_ip = CheckIp(logger, config, connect_creator)

        self.lock = threading.Lock()

        self.in_fd = open("ipv6_list.txt", "r")
        self.out_fd = open(
            os.path.join(data_path, "ipv6_list.txt"),
            "w"
        )
Пример #5
0
    xlog.info("test ip:%s", ip)

    if len(sys.argv) > 2:
        host = sys.argv[2]
    xlog.info("host:%s", host)

    if len(sys.argv) > 3:
        wait_time = int(sys.argv[3])
    else:
        wait_time = 0

    config_path = os.path.join(module_data_path, "cloudflare_front.json")
    config = Config(config_path)

    openssl_context = SSLContext(logger)
    host_manager = HostManagerBase()
    connect_creator = ConnectCreator(logger,
                                     config,
                                     openssl_context,
                                     host_manager,
                                     debug=True)
    check_ip = CheckIp(logger, config, connect_creator)

    #check_all_domain(check_ip)
    check_all_ip(check_ip)
    exit(0)

    res = check_ip.check_ip(ip, host=host, wait_time=wait_time)
    if not res:
        xlog.warn("connect fail")
    elif res.ok: