예제 #1
0
def test_get_target_addr_http():
    https_target = "https://github.com"
    http_target = "http://github.com"
    url_target = "github.com"
    port_target = "80"
    ip_target = "140.82.113.3"

    method = "http"

    ip, port = GetTargetAddress(https_target, method)
    assert verify_ip(ip) and port == 80

    ip, port = GetTargetAddress(http_target, method)
    assert verify_ip(ip) and port == 80

    url, port = GetTargetAddress(url_target + ":" + port_target, method)
    assert url == url_target and port == int(port_target)

    ip, port = GetTargetAddress(ip_target + ":" + port_target, method)
    assert verify_ip(ip) and port == int(port_target)
예제 #2
0
 def __enter__(self):
     InternetConnectionCheck()
     self.method = GetMethodByName(self.name)
     self.target = GetTargetAddress(self.target_name, self.name)
     return self
예제 #3
0
def test_get_target_addr_out_method():
    target = "https://google.com"
    method = "outmet"

    assert GetTargetAddress(target, method) == target