验证中...
Languages: Python
Categories: 其他
Latest update 2019-06-25 17:54
get github dns from ipaddress.com
Raw Copy
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""加速github访问。将结果添加到/etc/hosts"""
import requests
from bs4 import BeautifulSoup
hosts = [
"github.global.ssl.fastly.Net",
"global-ssl.fastly.Net",
"github.com",
"assets-cdn.github.com",
"documentcloud.github.com",
"gist.github.com",
"help.github.com",
"nodeload.github.com",
"raw.github.com",
"status.github.com",
"training.github.com",
"github.io",
"raw.githubusercontent.com",
"gist.githubusercontent.com",
"cloud.githubusercontent.com",
"camo.githubusercontent.com",
"avatars0.githubusercontent.com",
"avatars1.githubusercontent.com",
"avatars2.githubusercontent.com",
"avatars3.githubusercontent.com",
"avatars4.githubusercontent.com",
"avatars5.githubusercontent.com",
"avatars6.githubusercontent.com",
"avatars7.githubusercontent.com",
"avatars8.githubusercontent.com",
"github.githubassets.com",
]
for i in hosts:
url = "http://" + i.strip().lower() + ".ipaddress.com/"
resp = requests.get(url, headers={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36'})
soup=BeautifulSoup(resp.text)
all_a=soup.find_all("a")
for a in all_a:
if 'ipv4' in a['href']:
print a.string, i.strip()

Comment list( 0 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025