跳至内容

Compiling SQLCipher under Ubuntu

I am working on a brand-new Ubuntu 12.04.

  1. Download source code for SQLCipher from: https://github.com/sqlcipher/sqlcipher. Click “Download ZIP” in the above link.
  2. Unzip the file. Say the folder is unzipped to ~/Downloads/sqlcipher-master.
  3. Type the following in Terminal:
    sudo apt-get install libssl-dev
    sudo apt-get install tcl8.5
    cd ~/Downloads/sqlcipher-master
    ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
    make
    sudo make install DESTDIR=/
  4. Now sqlcipher is installed to /usr/local/bin. Just type sqlicpher in the terminal and you can run it.

Enjoy!

Related link: https://groups.google.com/forum/#!topic/sqlcipher/SGPpmqhYqlE我使用的是全新安装的 Ubuntu 12.04.

  1. 从这里下载SQLCipher的源代码(英文):https://github.com/sqlcipher/sqlcipher在页面中点击Download ZIP。
  2. 解压文件。假设被解压到了~/Downloads/sqlcipher-master
  3. 在终端中输入:
    sudo apt-get install libssl-dev
    sudo apt-get install tcl8.5
    cd ~/Downloads/sqlcipher-master
    ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
    make
    sudo make install DESTDIR=/
  4. 现在sqlcipher已经安装到/usr/local/bin了。在终端中输入sqlicpher即可运行。

🙂

相关链接:https://groups.google.com/forum/#!topic/sqlcipher/SGPpmqhYqlE

Several “Tunnels” and “Ladders”

Well this is unnecessary outside the Great Wall, so I will just leave a blank page here. If you are interested,you can visit the Chinese page.感谢秦王为我们筑建的万里长城,抵御了多年的匈奴入侵。为保证我国长城的安全,特公布其中的一些隧道和梯子。做安全的工作很危险啊,为了这个我还专门备份了整个博客,大家点赞吧。

=-=-=-=-=-=-=-=-⊙▽⊙我是萌萌的神级的吓死爹分割线⊙▽⊙=-=-=-=-=-=-=-=-

=-=-=-=-=-=-=-=-⊙▽⊙防止不小心把危险内容发到微博⊙▽⊙=-=-=-=-=-=-=-=-

隧道:

  1. http://www.sshcenter.info/site-sshcenter/ 这个是我今天发现的,没有测试过。
  2. http://blog.onlybird.com/%E5%85%8D%E8%B4%B9ssh%E4%BB%A3%E7%90%86 老牌的隧道了,隧道一直很稳定,缺点是账号密码经常改变。
  3. http://www.cjb.net/ 如果你能先到长城外然后到这里注册个号,这个网站特别推荐,因为它注册了之后不需要改变账号密码。
  4. http://livessh.com/ 这个好像很久了,也一直没有被封过,账号密码会经常改变。

一些别的梯子:

  1. http://opengg.me/613/generate-hosts-for-google/ 通过改hosts的方法防止DNS污染。
  2. http://code.google.com/p/goagent/ 这个自然是长久之计了,只是你先需要一个临时的方法先跑到长城以外才能访问这里。

A useful website: ifconfig.me

网址已经够self-explanatory了,这是一个显示当前IP地址的网站,不过它配合cURL还能在命令行下运行。比如:

The domain name is self-explanatory enough, but with cURL it can even run in terminal. For example:

$ curl ifconfig.me
$ curl ifconfig.me/ip
$ curl ifconfig.me/host
$ curl ifconfig.me/ua
$ curl ifconfig.me/port
$ curl ifconfig.me/lang
$ curl ifconfig.me/keepalive
$ curl ifconfig.me/connection
$ curl ifconfig.me/encoding
$ curl ifconfig.me/mime
$ curl ifconfig.me/charset
$ curl ifconfig.me/via
$ curl ifconfig.me/forwarded

具体请访问:ifconfig.me


For details, visit ifconfig.me

OpenWrt Mounting External Drives + extroot + swap partition

Connect to OpenWrt’s background terminal with SSH

  1. Download and open PuTTY under Windows. Fill in the address of your router in the “Host Name” field (in my case 192.168.2.1). Enter 22 in “Port” field. Choose SSH as “Connection Type”. Click “Save” for future use, and click open. (You should modify your password in the administration interface / web interface before this step.)
  2. Login as root, hit enter, input password and hit enter, and now you are at the background console!

Mounting (thumb / hard-) drives on USB port

  1. First read closely to the “Attitude Adjustment” part in these articles:
    http://wiki.openwrt.org/doc/howto/usb.storage
    http://wiki.openwrt.org/doc/howto/usb.essentials
  2. Install the packages you need according to these articles. Here’s an example:
    opkg update
    opkg install kmod-usb-core kmod-usb2 kmod-fs-ext4 kmod-usb-storage
  3. Format the thumb drive. Mine is a Verbatim Store N Go 4G. I use Acronis Disk Director in Windows to create two partitions. The second one is of size 256MB at the end of the disk. Format it as Linux Swap partition. Create another partition in the free space before the second one, and format it as ext* partitions. I use ext2.
  4. SSH to console of OpenWrt, cd /mnt/, and ls; you should now see your automounted sda1 partition. If not, you can manually mount it by entering:
    mkdir -p /mnt/sda1
    mount -t ext2 /dev/sda1 /mnt/sda1 -o rw,sync

    Then ls /mnt/sda1 again, and see if you can see your files in the thumb disk. By default there should be a directory / folder called lost+found. You can also mkdir a directory in the thumb disk, plug it on to your computer, and use DiskGenius to check if the directory you just created exists.
  5. Creating Swap partitions in Windows can cause mysterious issues, so in the console of OpenWrt, execute: (Confirm that sda2 is the small 256MB partition on your thumb disk before this!)
    mkswap /dev/sda2
    to re-establish the Swap partition

Swap

Execute swapon /dev/sda2 and then freeto see if the volume beside Swap is non-zero. If it is non-zero then you succeeds.

extroot & autoswap

  1. Read closely to the “Attitude Adjustment” part in
    http://wiki.openwrt.org/doc/howto/extroot
    to confirm you do need extroot.
  2. Install packages you need. For instance,
    opkg update
    opkg install block-mount
  3. Confirm that your first large partition of the thumb disk is mount to /mnt/sda1 Copy ROM to the drive; here I use pivot root by executing:
    mkdir -p /tmp/cproot
    mount --bind / /tmp/cproot
    tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
    umount /tmp/cproot
    rmdir /tmp/cproot
  4. The most KEY step: configuring fstab file! It is located at /etc/config/fstab There are two versions of this file, one in the internal ROM / internal storage, and the other just copied into the thumb drive. Since we haven’t extrooted yet, if we visit the path above, you are accessing the fstab file in ROM. I’ll let the fstab file in ROM to deal with extroot only, so in my case, its content is as the following:
    config global automount
    option from_fstab 0
    option anon_mount 1
    config global autoswap
    option from_fstab 0
    option anon_swap 0
    config mount
    option target /
    option device /dev/sda1
    option fstype ext2
    option options rw,sync
    option enabled 1
    option enabled_fsck 0

    You can use vi to change the file. If you are not used to it, you can download the file, edit it, and upload it using WinSCP.
  5. Then run reboot After it reboots, SSH to console again, run df and see if volume of the root directory / is correct (it should be the volume of the first partition on your thumb disk. If it is correct, you have successfully extrooted
  6. Now visiting /etc/config/fstab you visit the file in the thumb drive, so it appears that you haven’t change the file. I use the fstab file in the thumb drive to autoswap, because it appears to me that the fstab file in ROM is loaded first, mounting /dev/sda1 to code> / according to config mount and then load the fstab file in the thum disk. Again, (after you successfully extrooted) run vi /etc/config/fstab and edit the file to be as the following:
    config global automount
    option from_fstab 0
    option anon_mount 1
    config global autoswap
    option from_fstab 1
    option anon_swap 0
    config swap
    option device /dev/sda2
    option enabled 1
  7. Then reboot, and confirm autoswap by executing free

BTW, refer to the following if you want to change the parameters in “global automount” and “global autoswap” in fstab:http://wiki.openwrt.org/doc/uci/fstab. For the usage of vi, refer tohttp://www.gentoo.org/doc/zh_cn/vi-guide.xml.

SSH到OpenWrt的后方控制台

  1. 下载打开PuTTY,在Host Name中填入路由器地址(我这里是192.168.2.1),Port为22,选中SSH,点一下下面的Save保存方便以后使用,然后Open。(这一步的前提是在路由器管理界面那里设置了密码。)
  2. login as输入root,回车,输入密码回车,就能来到OpenWrt的控制台了!

挂载U盘

  1. 首先仔细阅读下面这些文章中的Attitude Adjustment部分
    http://wiki.openwrt.org/doc/howto/usb.storage
    http://wiki.openwrt.org/doc/howto/usb.essentials
  2. 按照上面的方法,安装需要的包。这里给一个例子:
    opkg update
    opkg install kmod-usb-core kmod-usb2 kmod-fs-ext4 kmod-usb-storage
  3. 格式化U盘。把U盘插在电脑上,我的是Verbatim Store N Go 4G,在Windows下使用Acronis Disk Director重新分为两个分区,第二个分区在磁盘末尾,256MB,Linux Swap格式,前面剩下的分出第一个分区,我使用的是ext2格式。
  4. SSH到OpenWrt后台,cd进/mnt/目录,ls一下,应该就看到自动挂载的sda1分区了,如果没有,手动挂载一个:
    mkdir -p /mnt/sda1
    mount -t ext2 /dev/sda1 /mnt/sda1 -o rw,sync

    然后再次 ls /mnt/sda1 看看是否能显示U盘的文件。默认应该有一个lost+found的文件夹。也可以手动mkdir一个文件夹然后拔下来放到电脑里用Disk Genius看看文件夹是否存在来确认第一个分区是否加载成功。
  5. 在Windows下创建的Swap分区总有这样那样的问题,所以执行(执行前先确认sda2的确为U盘第二个256MB的小分区!)
    mkswap /dev/sda2
    来重新建立Swap分区。

Swap

执行swapon /dev/sda2后,执行free命令,观察Swap旁边的容量值是不是非零,如果非零则成功。

extroot & autoswap

  1. 首先仔细阅读下面这些文章中的Attitude Adjustment部分
    http://wiki.openwrt.org/doc/howto/extroot
    来确认你的确需要extroot这种东西
  2. 安装需要的包。比如:
    opkg update
    opkg install block-mount
  3. 确认U盘第一个大分区已经挂载到/mnt/sda1。复制Rom文件到U盘。这里使用pivot root的方法。执行:
    mkdir -p /tmp/cproot
    mount --bind / /tmp/cproot
    tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
    umount /tmp/cproot
    rmdir /tmp/cproot
  4. 最关键的一步来了!配置fstab文件。它的路径是/etc/config/fstab。这个文件分两个,一个是Rom中的,一个是刚刚复制到U盘中的。现在由于还没有进行extroot,访问上面这个路径会访问到Rom中的fstab。我让Rom中的fstab文件只管extroot,所以它的内容是:
    config global automount
    option from_fstab 0
    option anon_mount 1
    config global autoswap
    option from_fstab 0
    option anon_swap 0
    config mount
    option target /
    option device /dev/sda1
    option fstype ext2
    option options rw,sync
    option enabled 1
    option enabled_fsck 0

    使用vi来修改这个文件,如果不习惯vi,则用WinSCP下载这个文件然后修改然后上传到路由器。
  5. 然后执行reboot命令,重启路由器后重新SSH到路由器,执行df命令,看看根目录 / 的容量是否正确(即为U盘第一分区的容量)。如果正确就成功extroot了。
  6. 现在访问/etc/config/fstab会访问到U盘中的fstab文件,所以会看到修改前的样子。我使用U盘中的fstab文件来autoswap,因为据我观察似乎是先加载Rom中的fstab文件,根据config mount段把/dev/sda1加载到 / ,然后这时候就会再访问U盘上的fstab文件。这时(成功extroot后)重新vi /etc/config/fstab,更改这个文件为以下内容:
    config global automount
    option from_fstab 0
    option anon_mount 1
    config global autoswap
    option from_fstab 1
    option anon_swap 0
    config swap
    option device /dev/sda2
    option enabled 1
  7. 重启,通过free命令确认autoswap是否成功。

另外,fstab中的global automount和global autoswap的各项参数可以参考:http://wiki.openwrt.org/doc/uci/fstab。关于vi的使用可以看看这些链接:http://www.gentoo.org/doc/zh_cn/vi-guide.xml

OpenWrt LAN/WLAN configuration

刚安装好OpenWrt(的Attitude Adjustment版本)是没有Wifi信号发出来的,电脑和路由器用网线连接起来,登录192.168.1.1,进去后首先修改默认密码,然后点击Save & Apply

打开无线AP (Access Point)

  1. 进去Network下的Wifi标签页,默认有一个SSID为OpenWrt的AP,右边Edit。
  2. 进入后,到Interface Configuration部分,修改ESSID栏为无线AP的SSID,Network栏勾上选择LAN,其它保持默认。
  3. 到Interface Configuration部分的Wireless Security标签,Encryption选择加密方式,推荐WPA2-PSK,下面输入密码。
  4. 到MAC-Filter标签,选择Allow Listed Only,然后逐个输入允许的MAC地址。
  5. Save & Apply结束。

连上已有Wifi

即作为Client连接上已有的Wifi。

创建

  1. 进去Network下的Wifi标签页。
  2. 如果有以前创建的Client的无线网络,需要Disable之。Disable后界面没有明显变化,但是Edit点进去之后会看到Wireless network is disabled。否则可能出现神奇的问题!
  3. 点击Scan。
  4. 选择需要连接的热点,Join Network。
  5. 为了保证上面创建的无线AP不要消失,取消顶端的Replace Wireless Configuration复选框,WPA passphrase输进密码。Name of the new network必须每一个新的Client都用不同的名字。
  6. Firewall zone选择红色的wan。然后Submit。然后Save & Apply结束。按照下面的方法确认Interface。

切换

必须每次Disable已连接的Client的无线网络,然后在选择要连接的Client无线网络Edit进去,点Enable。选择Interfaces,看对应的Interface的uptime和MAC是否不为零,如果有异常点击旁边的Connect。

在以上每个步骤时随时检查电脑是否连接到了路由器,因为无线AP可能会断开电脑的连接。

设置DNS

  1. 进去Network下的DHCP and DNS
  2. DNS forwardings增加一些DNS地址,右面的按钮可以增加一个新行。下面是一些DNS地址:8.8.8.8,114.114.114.114,202.96.128.166。
  3. 电脑中的IP地址和DNS如果靠DHCP来分配,ipconfig是可以看到DNS是192.168.1.1(路由器地址)的。

更改路由器IP地址

更改路由器IP地址段以防止与上级路由器冲突。进入Network下的Interfaces,点击LAN旁边的Edit,在IPv4 address行改为需要的地址(例如192.168.2.1)即可。

备份设置

System标签的Backup / Flash Firmware下点击Generate archive下载备份包,在电脑中放好。

 

Install OpenWrt on Mercury MW151RM3G

上京东买了个Mercury MW151RM3G,85大洋,是跟TP-Link 703N和迅捷FWR171-3G是一样的硬件,但是比703N要便宜20大洋,而且比FWR171-3G好看一点。废话不多说,首先Google搜索下载MW151rm3G_to_wr703nv1,或者到本站下载;连接上路由器(通过网线或者通过Wifi),打开浏览器进入192.168.1.1,默认用户名和密码都是admin,然后右边系统工具,升级,选择文件MW151rm3G_to_wr703nv1.bin,然后刷入。其中千万不要断电,浏览器在loading时耐心等待。

如果是用wifi连接路由器的就注意了,在重启路由器的过程中热点会消失,然后电脑可能尝试连接其他路由器的热点,一不小心把其他路由器刷了就惨了。所以重新确认电脑连接的是这个Mercury MW151RM3G的路由器(通过热点名称,即SSID的后六位是否与路由器背面的MAC地址相符确认),然后登入192.168.1.1,再次通过标题栏的路由器型号(TP-Link 703N)和状态页面的MAC地址确认。然后同样右面系统工具,升级,选择openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin,刷入。(这个文件也可以在http://wiki.openwrt.org/toh/tp-link/tl-wr703n下载到。)

好了,现在再次进入192.168.1.1,用户名root密码admin。进去后首先修改默认密码,然后点击Save & Apply。然后点System标签页,Backup / Flash Firmware,Flash new firmware image,选择文件openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin,刷入。

这样OpenWrt就刷好了,继续探索+Google吧!

文章提到的软件下载:本地下载 或者

 

[Half-Original] Decoding database files of Android QQ2012 – Logics

最近在搞手机QQ 2012的聊天记录,用我的联想A765e双制式Android手机做平台,研究出很多东西,部分列举如下:

  1. 数据库在/data/data/com.tencent.mobileqq/databases/(qq号).db,是加密的。
  2. 加密的密钥(Key)为IMEI号。由于有上一台单电信卡手机做过测试,又下载过一堆破解手机QQ聊天记录的要钱的软件用过,大概知道使用IMEI号的。但是电信的手机是没有15位的IMEI号的,只有14位的MEID号。可能我的手机是电信卡作主导,所以尽管我的手机有IMEI也有MEID号,数据库也是用14位的MEID号作密钥。我的两台手机的MEID号均为A10000开头的。
  3. 知道密钥后,由于没有时间去碰撞加密方式,事情一直拖着。后来看到这篇帖子:http://bbs.pediy.com/showthread.php?t=163042,才知道只是简单的与Key异或运算。
  4. 但帖子中的情况跟我的情况有些不同。帖子的代码是用MFC/VC++来写的,大概看懂了逻辑,但是中间那段,当一个字符大于等于128时跳过两个字符然后对第三个字符进行处理却怎么也看不懂。而我准备用Java来实现,必须看懂代码本质才能重写。这个时候对于数据库中加密的QQ号的解密我已经能用Java实现了,因为它不涉及到中间这段代码。
  5. 后来才知道,原来是思维定势的问题。Java中的字符串用Unicode,每个字符两个字节。而这个数据库处理时用UTF-8,开始以为也是两个字节,后来才知道是三个。例如,”地”字在UTF-8里是0xE59CB0,而在Java的Unicode里是0x5830。另外,Java中的byte是-128~127,对于传统的0~255系统来说,大于等于128的数字会变成负数。
    例:
    byte[] b = "地".getBytes();
    for(byte bb:b)System.out.print(Integer.toHexString(bb)+" ");
    //输出ffffffe5 ffffff9c ffffffb0
    System.out.print(Integer.toHexString('地'));//输出5830
  6. 综上所述,原帖子中的代码的逻辑就很明了了:从密文中读取一个字节;如果一个字节大于等于128,则本字节与接下来两个字节组成一个UTF-8字符,处理这个字符,然后跳过这些字节读取下一个字节;否则本字节就是一个ASCII字符,处理这个字符,然后读取下一个字节。
  7. 上文中“处理”就是指密文与Key依次作异或运算。但是包括我下载的软件和帖子中的代码在内都没有考虑一个因素,导致解密出来的文字中会有一些乱码,特别是第一个中文字。通过对明文的猜测然后对Key的反推后发现,原来,对于明文中的中文和英文数字字符,Key的用法是不同的。具体如下:如果密文字符的第一个字节大于等于128,则Key中A0x10100x30,依此类推,然后用这个数字和密文字符的最后一个字节做按位异或;否则,Key中A0x4100x30,依此类推(直接用Key中字符的ASCII码),然后用这个数字和密文字符那一个字节做按位异或。

大概解密部分算法就是这样。准备研究Java的数据库读写。代码将在完整程序完成后放出不完整代码放在GitHub
cheers~

New mirror site at Blogger

New blogger mirror site is established at blogger.elsk.tk, or you can visit it from elskblog.blogspot.com if you are outside the wall or you have ladders. There are no posts there yet, but the posts in this wordpress-based site would soon be transferred to there. The currently functioning domains are as follows:

  1. http://www.elsk.tk, which will always be the main blog (which could be wordpress, blogger, or anything); it is equivalent to elsk.tk and blog.elsk.tk;
  2. wordpress.elsk.tk, which is the wordpress site for this blog (the alias of elsk.sinaapp.com);
  3. blogger.elsk.tk, which is the blogger site for this blog (the alias of elskblog.blogspot.com).

Currently, the main blog is the wordpress site based on Sina App Engine. It is possible that in the future this blog will turn to Blogger without notice.我刚刚开通了Blogger,目前作为我当前的博客的镜像,将来预计会取代现在的基于SAE的Wordpress站。新站地址为blogger.elsk.tk.
目前正在使用的二级域名如下:

  1. http://www.elsk.tk,作为永久的主博客域名;此域名与elsk.tk和blog.elsk.tk相等;
  2. wordpress.elsk.tk,本博客的WordPress站(elsk.sinaapp.com的别名);
  3. blogger.elsk.tk,指向Blogger上的镜像站;(elskblog.blogspot.com的别名)。

现在主站运行在新浪云平台上,但随时有可能不经过通知而修改。

DISM Console – a convenient command-line tool for backing up Windows systems

Known issue: no directory path for capturing / applying / mounting etc. should have a trailing “/”, or the program cannot recognize the next argument.

Updated: 2013/10/27

Fixed: the tool cannot find DISM.exe because the default path under administrator privileges is not the path of the tool,
but instead %windir%system32

Added: Separate unmounting from mounting images.

Changed: Use letters as indexes instead of numbers.

 

Updated: 2013/06/13

DISM console is a convenient command-line tool for backing up Windows systems. It is based on the DISM tool in Windows 8. It supports more functions than ImageX. It contains:

%windir%system32Dism

%windir%system32Dism.exe

There are known compatibility issues when imageX for Windows 7 is used to back up a Windows 8 system (err = 282). GImageX used to be a good tool to simplify the long command lines when using imageX to backup Windows systems, but the current version uses imageX for Windows 7. Then I discovered DISM, a better tool to make system images with more functions. But DISM has complicated command-line parameters, and it is hard to remember the usages of these parameters–even after reading the help document.

DISM console helps simplifying entering commands, just like a black and white GImageX. It current supports only the following commands:

  1. Creating a image;
  2. Appending changes to a current image;
  3. Applying an image;
  4. Displaying information of an image;
  5. Mounting the image to a certain directory;

which, I think, has included important usages of backing up images and restoring systems.

Download link (x86 & x64):


or you can download it here.

XD~已知问题:捕捉、应用、挂载镜像时目录路径不存在。解决方案:所有目录路径需要以“”结尾,否则程序无法识别下一个参数。

2013/10/27更新

修复:此工具无法找到DISM.exe,因为以管理员身份运行时默认路径并非工具本身路径,而是%windir%system32。问题已修复。

增加:把卸载镜像的功能与挂载镜像的功能分开。

修改:使用字母而不是数字作为输入的标号。

 

2013/06/13更新

一个简单的命令行工具,便于备份Windows系统。基于Windows 8的DISM工具,比ImageX功能更强、更多。DISM工具可以从Windows 8系统中直接提取,而不需要从WinAIK中提取。其中包含了:

%windir%system32Dism

%windir%system32Dism.exe

使用Windows 7下的ImageX来备份Windows 8系统时会有兼容性的错误(代码282)。原来在Windows 7下,GImageX是一个简化ImageX命令行操作的好工具,但是GImageX使用的ImageX是Windows 7下的。后来我发现了DISM,一个更加强大、有更多功能的创建系统映像的工具。不过DISM的命令行参数更为复杂,而且即使在看完帮助文档后用法还是难以记忆。

DISM命令行就是一个简化DISM的命令输入的工具,就如同一个黑白界面的GImageX一样。它支持以下DISM的参数:

  1. 创建镜像;
  2. 给已有镜像作增量备份;
  3. 应用镜像;
  4. 显示镜像信息;
  5. 把镜像挂载到某个目录。

这些应该就涵括大部分备份还原系统的操作了。

下载地址: (x86 & x64):


or you can download it here.

XD~

A cross-platform Hosts auto-fetch ladder

Since ladders are only useful inside the Great Wall, this article is not translated. However, you can read the Chinese version here.由于最近在用Google Drive,是长城的重点关注对象,而我电脑的IE死了导致没有办法更改系统的代理设置,Google Drive也没有单独的代理设置,于是就返回在用GoAgent之前的时候的Hosts大法了。具体Hosts是怎么工作的就不在这里讨论了。而由于Google的IP地址经常在更换,实时更改Hosts中的IP地址也显得尤为重要。这里我主要用到两个资源:

  1. 鲁夫大大做的php,实时生成的Hosts文件,地址是http://opengg.me/613/generate-hosts-for-google/
  2. cURL,下载地址:http://curl.haxx.se/,是一个可以获取网络文件的命令行程序,有Windows、Mac、Linux版本。

主要思路是自己写一个脚本,用cURL从opengg.me上获取新的hosts文件以替换系统的hosts文件。主要的核心代码是(以Windows为例子):

curl -o "%windir%System32Driversetchosts" http://opengg.me/wp-content/uploads/2011/09/hosts.php?4

然后把这个脚本设为开机启动,或者在Google不工作的时候运行一下就好了。

Windows平台下我写的完整的脚本在这里:Fetch Google Hosts,把.txt后缀改为.bat就可以了。其他平台写出类似脚本即可。

PS其实非常好奇鲁夫大大是怎么用PHP来获取IP地址然后生成hosts文件的。本人对PHP不太了解,所以要是能找到代码研究研究多好啊。

通过 WordPress.com 设计一个这样的站点
从这里开始