Created
June 24, 2019 16:35
-
-
Save bxiehq/90fc410650adebb7d92dab4f5103e5f5 to your computer and use it in GitHub Desktop.
tianyancha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import threading | |
import re | |
targets = [] | |
names = [] | |
def icp_info(host): | |
url = "https://icp.chinaz.com/ajaxsync.aspx?at=beiansl&callback=jQuery111305329118231795913_1554378576520&host=%s&type=host"%host | |
html = requests.get(url,timeout=(5,10)).text | |
pattern = re.compile('SiteName:"(.*?)",MainPage:"(.*?)"',re.S) | |
info = re.findall(pattern,html) | |
for i in range(0,32): | |
try: | |
name = info[i][0] | |
target = info[i][1] | |
print("%s:%s"%(name,target)) | |
if target not in targets: | |
targets.append(target) | |
with open("icp_info.txt","a+") as f: | |
f.write("%s:%s"%(name,target) + "\n") | |
continue | |
else: | |
continue | |
except Exception as e: | |
continue | |
def start(): | |
with open("url.txt","r+") as a: | |
for b in a: | |
b = b.strip() | |
icp_info(host=b) | |
a.close() | |
def main(): | |
thread = threading.Thread(target=start,) | |
thread.start() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment