MCPcopy
hub / github.com/Xyntax/POC-T / host2IP

Function host2IP

plugin/util.py:66–87  ·  view source on GitHub ↗

URL转IP :param url:原始URL :return IP:PORT :except 返回原始URL

(url)

Source from the content-addressed store, hash-verified

64
65
66def host2IP(url):
67 """
68 URL转IP
69
70 :param url:原始URL
71 :return IP:PORT
72 :except 返回原始URL
73 """
74 for offset in url:
75 if offset.isalpha():
76 break
77 else:
78 return url
79 try:
80 url = url if '://' in url else 'http://' + url # to get netloc
81 url = urlparse(url).netloc
82 ans = [i for i in socket.getaddrinfo(url.split(':')[0], None)[0][4] if i != 0][0]
83 if ':' in url:
84 ans += ':' + url.split(':')[1]
85 return ans
86 except Exception:
87 return url
88
89
90def IP2domain(base, timeout=3):

Callers 6

pocFunction · 0.90
pocFunction · 0.90
pocFunction · 0.90
pocFunction · 0.90
pocFunction · 0.90
pocFunction · 0.90

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected