def test_proxy_chain(): proxy = ProxyChain([ Proxy.from_url(SOCKS5_IPV4_URL), Proxy.from_url(SOCKS4_URL), Proxy.from_url(HTTP_PROXY_URL), ]) # noinspection PyTypeChecker status_code = make_request(proxy=proxy, url=TEST_URL) assert status_code == 200
def test_socks5_proxy_ipv4(url, rdns, resolve_host): proxy = Proxy.from_url(SOCKS5_IPV4_URL, rdns=rdns) status_code = make_request( proxy=proxy, url=url, resolve_host=resolve_host ) assert status_code == 200
def tunneling(self): """ This is the main function that parses the proxy and creates a tunnel. """ self.socket_connection = Proxy.from_url( url=self.tunnel_proxy, client=clients.Clients[self.client.upper()].value, proxy=self.proxy) self.sock = self.socket_connection.connect( dest_host=self.server_name, dest_port=self.server_port, timeout=self.timeout, )
def test_socks5_proxy_ipv4_with_auth_none(rdns): proxy = Proxy.from_url(SOCKS5_IPV4_URL_WO_AUTH, rdns=rdns) status_code = make_request(proxy=proxy, url=TEST_URL) assert status_code == 200
def test_http_proxy(): proxy = Proxy.from_url(HTTP_PROXY_URL) status_code = make_request(proxy=proxy, url=TEST_URL) assert status_code == 200
def test_socks4_proxy(rdns, resolve_host): proxy = Proxy.from_url(SOCKS4_URL, rdns=rdns) status_code = make_request(proxy=proxy, url=TEST_URL, resolve_host=resolve_host) assert status_code == 200
def test_socks5_proxy_ipv6(): proxy = Proxy.from_url(SOCKS5_IPV6_URL) status_code = make_request(proxy=proxy, url=TEST_URL) assert status_code == 200
def test_socks5_proxy_hostname_ipv4(): proxy = Proxy.from_url(SOCKS5_IPV4_HOSTNAME_URL) status_code = make_request(proxy=proxy, url=TEST_URL_IPV4, ) assert status_code == 200
def test_socks5_proxy_hostname_ipv6(rdns): proxy = Proxy.from_url(SOCKS5_IPV4_URL, rdns=rdns) status_code = make_request(proxy=proxy, url=TEST_URL_IPv6) assert status_code == 200
def test_answer(): os.mkdir("potatopath") proxy = Proxy.from_url('socks5://user:[email protected]:1080') assert inc(3) == 4