巧用google-hosts使用google服务

自从google访问不正常后,gmail以及google广告都无法正常访问了,没办法,最简单的方法就是ip访问或修改本地hosts,但不同的ip会有总有麻烦事。
有人在网上专门做了google-hosts的插件,一键使用,很方便。
使用后,可正常访问包含了大部分Google服务, G+, Drive, Gmail, Hangouts, Calendar等
域名参考了smarthosts, ipv6-hosts.

如何自己用程序找IP

find.sh查询某段IP详细信息,可接受一个或多个参数(这个可检测IP是否被封锁, 443端口是否被封锁)

$ cd google-hosts/scripts
# 查询 192.168.1.x
$ ./find.sh 192.168.1
# 查询 192.168.x.x
$ ./find.sh 192.168
# 查询 192.168.x.x, 192.169.x.x, 192.170.1.x
$ ./find.sh 192.168 192.169 192.170.1

filter.sh从output目录(由find.sh生成)过滤域名

$ cd google-hosts/scripts
# 过滤可用于*.google.com的域名
$ ./filter.sh *.google.com
# 过滤可用于mail.google.com的域名
$ ./filter.sh mail.google.com

use.sh使用过滤出的某个IP并更新hosts.all文件

$ cd google-hosts/scripts
# 使用可用于*.google.com 的IP 192.168.1.1
$ ./use.sh *.google.com 192.168.1.1
# 使用可用于mail.google.com 的IP 192.168.1.1
$ ./use.sh mail.google.com 192.168.1.1

select.sh结合了filter.sh, use.sh,自动选择最佳IP写入hosts.all文件, 并做了些特殊域名处理

$ cd google-hosts/scripts
$ ./select.sh

apply.sh使用hosts.all文件更新../hosts文件

$ cd google-hosts/scripts
$ ./apply.sh

auto.sh结合了find.sh, select.sh, apply.sh自动查询后选择最佳IP写入../hosts文件

$ cd google-hosts/scripts
# 查询192.168.x.x,192.169.1.x, 并在查询完后自动选择最佳IP更新../hosts文件
$ ./auto.sh 192.168 192.169.1

输出的四个字段含义

IP LOSS TIME SSL
此IP 丢包率 PING值 可用ssl域名

获取Google IP段可供参考

$ nslookup -q=TXT _netblocks.google.com 8.8.4.4

使用当前的hosts

如果此hosts文件内的IP失效, 就需要你自己用上面提到的脚本查询了
下面的程序不会覆盖你原有的hosts

Windows 用户

  1. 请先退出所有杀毒软件
  2. Windows XP 以上请使用管理员身份运行或赋予hosts文件可写权限*nix/OSX 用户
    1. 使用及更新: 打开终端运行$ curl http://tx.txthinking.com/fuckGFW.py | sudo python

    必读技巧

    • 请使用国际版google. 防止google本地化重定向: 访问一下https://www.google.com/ncr
    • 请使用https替代http访问.

    Contributing

    • vim:ts=4:sw=4:expandtab:ff=unix:encoding=utf8
    • Please create your pull request on develop branch

下载地址:https://github.com/txthinking/google-hosts

版权声明:
作者:admin
链接:https://www.bttme.com/archives/472.html
来源:bttme
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>