Skip to content
Open

pr #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@

点击下载---->>>>>>><a href="https://github.com/guoruibiao/crosswall/raw/master/crowall.exe"><img src="https://github.com/guoruibiao/crosswall/raw/master/downloadicon.png"></a>

更多细节,可以参考下面的文章链接 http://blog.csdn.net/marksinoberg/article/details/52934770

更多细节,可以参考下面的文章链接 http://blog.csdn.net/marksinoberg/article/details/52943194
---

![Google](https://camo.githubusercontent.com/6f787bdcb60b630c8cb9dd463ffe73b3bcacba70/68747470733a2f2f7777772e676f6f676c652e636f6d2f6c6f676f732f646f6f646c65732f323031362f676f6f676c65732d313874682d62697274686461792d353636313533353637393534353334342d687032782e676966)


先说说这个小工具的原理吧,就是替换hosts文件。然后其依赖于GitHub上一个维护小组(https://github.com/racaljk/hosts)的hosts更新文件。
先说说这个小工具的原理吧,就是替换hosts文件。然后其依赖于GitHub上一个维护小组( https://github.com/racaljk/hosts )的hosts更新文件。

然后这个工具在每次运行的时候,都会自动的下载最新的hosts文件,并在备份当前的hosts文件为hosts_bak后自动的完成替换工作。

Expand Down
9 changes: 7 additions & 2 deletions crowall.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ def crosswall(systemtype='Window'):
os.system('pause')
print 'It\'s done on Windows! And Try your browser!'
elif systemtype == "Linux":
os.system('cp /etc/hosts /etc/hosts_bak')
os.system('cp /etc/hosts.txt /etc/hosts_bak')
os.system('mv ./hosts /etc/hosts')
os.system('pause')
os.system('sudo /etc/init.d/networking restart ')
print 'It\'s done on Linux! And Try your browser!'
elif systemtype == "Darwin":
os.system('sudo cp /etc/hosts /etc/host_bak')
os.system('sudo mv ./hosts.txt /etc/hosts')
os.system('sudo ifconfig en0 down && sudo ifconfig en0 up')
print 'It\'s done on Mac! And Try your browser!'
except Exception as e:
print e



if __name__ == '__main__':

url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts'
url = 'https://raw.githubusercontent.com/googlehosts/hosts/master/hosts-files/hosts'
downloadHosts(url=url)
print 'Hosts update success!'
crosswall(platform.system())
Expand Down