-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
'''
此脚本需要将hosts.txt的文件文件操作权限(修改、写入)赋予给当前user,不然会显示拒绝访问!
'''
import requests
import os
url = "https://github.com/jianboy/github-host/blob/master/hosts" # hosts源码
r = requests.get(url=url)
hosts = r.text
with open('C:\Windows\System32\drivers\etc\hosts.txt', 'w+') as f:
f.write(hosts)
os.system("ipconfig /flushdns")
print("hosts文件更新完毕,DNS缓存刷新完毕!")
jianboy
Metadata
Metadata
Assignees
Labels
No labels