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

Function redirectURL

plugin/util.py:50–63  ·  view source on GitHub ↗

获取跳转后的真实URL :param url:原始URL :param timeout:超时时间 :return 跳转后的真实URL

(url, timeout=3)

Source from the content-addressed store, hash-verified

48
49
50def redirectURL(url, timeout=3):
51 """
52 获取跳转后的真实URL
53
54 :param url:原始URL
55 :param timeout:超时时间
56 :return 跳转后的真实URL
57 """
58 try:
59 url = url if '://' in url else 'http://' + url
60 r = requests.get(url, allow_redirects=False, timeout=timeout)
61 return r.headers.get('location') if r.status_code == 302 else url
62 except Exception:
63 return url
64
65
66def host2IP(url):

Callers 2

pocFunction · 0.90
pocFunction · 0.90

Calls 1

getMethod · 0.80

Tested by

no test coverage detected