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

Function IP2domain

plugin/util.py:90–121  ·  view source on GitHub ↗

IP转域名 :param base:原始IP :param timeout:超时时间 :return 域名 / False :except 返回False

(base, timeout=3)

Source from the content-addressed store, hash-verified

88
89
90def IP2domain(base, timeout=3):
91 """
92 IP转域名
93
94 :param base:原始IP
95 :param timeout:超时时间
96 :return 域名 / False
97 :except 返回False
98 """
99 try:
100 domains = set()
101 ip = base.split(':')[0] if ':' in base else base
102 q = "https://www.bing.com/search?q=ip%3A" + ip
103 c = requests.get(url=q,
104 headers={
105 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0'},
106 timeout=timeout
107 ).content
108 p = re.compile(r'<cite>(.*?)</cite>')
109 l = re.findall(p, c)
110 for each in l:
111 domain = each.split('://')[-1].split('/')[0]
112 domains.add(domain)
113 if len(domains) > 0:
114 ans_1 = base + ' -> '
115 for each in domains:
116 ans_1 += '|' + each
117 return ans_1
118 else:
119 return False
120 except Exception:
121 return False
122
123
124def checkPortTcp(target, port, timeout=3):

Callers

nothing calls this directly

Calls 3

splitMethod · 0.80
getMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected