bugfreeforsvn

在网上花了九牛二虎之力,没下到bugfreeforsvn.tar.gz。这个软件是没有人维护了,但这么多人下了,也没一个做个镜像,实在是看不下去了。

还好,最后在51cto找到个人,是近期还在网上有活动的,给他发邮件要到了。

不过下来一看,这代码质量也太烂了。因为又找又发邮件的花了太多时间,在拿到文件之前,我就已经根据能看到的其原理,自己写了一个postcommit.pl

今天把这两个都分享出来。二选一即可。算是做个好人。

立即下载:

postcommit_pl.tar.gz BugFreeforSVN.tar.gz

发表在 未分类 | 留下评论

使iphone ssh可以输入中文

结论很简单,把以下内容写入/etc/inputrc
set input-meta on
set meta-flag on
set output-meta on
set convert-meta off

过程:通过gdb调试/bin/bash,从rl_read_init_file开始调试,后来强制调用rl_variable_dumper,输出信息。
在正常的linux上,写测试代码调用rl_variable_dumper输出调试信息,两相比对,再逐步化简得出结论。

发表在 ios | 留下评论

手机中毒

iphone 4s, ios5.
表现: ssh一直不能使用,不能连接到iphone的sshd. 用sbsettings开,关无效。
怀疑 sbsettings,启用ssh后卸载,重启,无效。
重装openssh,无效,多次重装发现,在装的过程中可以连上,但很快失效。
利用装的进程的短短时间快速记录进程,与不能用的时候对比,发现sshd被杀。
发现文件系统上 /usr/sbin/sshd 在能连上时存在,不能连时,此文件被删除。
因此怀疑有进程删除了/usr/sbin/sshd

经过排查和google,找到了可疑进程poc-bbot,原来这个竟然是 iphone ikee worm。
删除办法 http://www.iphonefaq.org/archives/97723
此毒是通过扫描网段里的22端口,用root帐号alpine密码登录传染jailbroken iphone的。
我的手机root密码早就改了,在越狱之后不久就改了。回想起来,应该就是在这一很短的时间里就中了ikee病毒。还好此毒危害不大,以后不能在公共wifi下越狱了。

发表在 ios | 留下评论

build arm toolchain

#this is not a bash script file, just log of commands.
export ARCH=arm
export TARGET=arm-pc-linux-gnueabi
export PREFIX=/usr/arm
export SYSROOT=$PREFIX/sysroot
export PATH=$PREFIX/bin:$PATH
 
#prepare
sudo mkdir $PREFIX
#chown to allow make install happy at user level so that we won't crash system files on error.
sudo chown $USER $PREFIX
mkdir -p $SYSROOT/usr/include
 
#build binutils
mkdir binutils-2.22/build ; cd binutils-2.22/build
../binutils-2.22/configure --target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT  --disable-nls
make
make install
 
#build gcc stage1
../gcc-4.6.3/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-languages=c --without-headers --disable-shared --disable-threads --with-gnu-as --with-gnu-ld
make all-gcc all-target-libgcc
#cd arm-* ; make libgcc_eh.a
make install-gcc install-target-libgcc
 
#linux headers
make at91rm9200dk_defconfig
make include/linux/version.h
cp -a include/linux          $SYSROOT/usr/include/
cp -a include/asm-generic    $SYSROOT/usr/include/
cp -a ./arch/arm/include/asm $SYSROOT/usr/include/
cp -a ./arch/x86/include/asm/ioctl.h  $SYSROOT/usr/include/asm/
cp -a ./arch/x86/include/asm/errno.h  $SYSROOT/usr/include/asm/
cp -a ./arch/avr32/include/asm/bitsperlong.h $SYSROOT/usr/include/asm/
 
#build eglibc
cd eglibc-2.14/libc ; ln -s ../linuxthreads . ; ln -s ../ports .
mkdir ../../build
cd ../../build
../eglibc-2.14/libc/configure --prefix=/usr --host=$TARGET --enable-add-ons --with-headers=$SYSROOT/usr/include
vim config.make
#add -march=armv6 -mfpu=vfp to CFLAGS
make
make install_root=$SYSROOT install
 
#build gcc stage2
../gcc-4.6.3/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++ --with-sysroot=$SYSROOT
 
#done
发表在 linux | 留下评论

fix openwrt network script bug

On my router there are some interfaces in /etc/config/network. The wan interface is configured as a PPPOE netowrk to connect my ISP. There is also a pptp-vpn connected named zvpn. I found it is very slow to run “/etc/init.d/network reload”, taking about 2 miniutes. If I comment out the zvpn interface, it runs fast.

Obviously, the vpn connection depends on my main connection — the wan interface which works in PPPOE mode. So this should be the key point. I spent many hours before to find how to config the dependency, including asking this question in the openwrt forum, but with no luck.  Today I wrote some debug statements in the network scripts and almost brick my router to find what is wrong, finaly I got it.

I thought it is because the vpn interface is inited before wan, so I named my vpn interface as zvpn to make it as the last one,  but I’m wrong.  I don’t need to care its name.  The network scripts load each interface in the order of what it is in the configration file — /etc/config/network. However, there is a problem: the network scripts also unload each interface in this order.

We know, the unload order should be the reverse of the load order. This can be changed by patch /sbin/ifdown.

This is the patch:

--- /rom/sbin/ifdown        2012-01-21 22:21:29.000000000 +0800
+++ ifdown      2012-01-23 17:23:46.000000000 +0800
@@ -7,10 +7,17 @@
 case "$1" in
        "-a")
                [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
+               TODO=
                config_cb() {
-                       [ interface != "$1" -o -z "$2" ] || eval "$0 -w $2"
+                       [ interface != "$1" -o -z "$2" ] || TODO="$2 $TODO"
                }
                config_load network
+               for i in $TODO ; do
+                       $0 -w $i
+               done
                exit 0
        ;;
        "-w") shift ;;

Openwrt has a recovery mode that helps me to unbrick my router after I made some bad modifications to the config files. To enter this mode, power off the router, hold reset button, power on, keep holding reset button until 192.168.1.1 replying ping requests. Then just telnet 192.168.1.1, mount -t jffs2 /dev/mtdblock3 /overlay/, and fix problems there.

发表在 linux | 标签为 | 留下评论

install vmware tools on debian (guest) for newest kernel (3.1.0)

vmware version: vmware workstation 8.0.1 build-528992
debian kernel: 3.1.0-1-486
vmware tools fails to install or run.

solution:
1. apt-get install libglib2.0-0
2. patch /usr/lib/vmware-tools/modules/source/vmhgfs.tar
unpack vmhgfs.tar, patch, repack.
the patch:

diff -ur vmhgfs-only-old/file.c vmhgfs-only/file.c
--- vmhgfs-only-old/file.c      2011-11-14 11:41:31.000000000 +0800
+++ vmhgfs-only/file.c  2012-01-19 17:59:47.899616529 +0800
@@ -84,6 +84,8 @@
 #if defined VMW_FSYNC_OLD
                      struct dentry *dentry,
 #endif
+                                        loff_t start,
+                                        loff_t end,
                      int datasync);
 static int HgfsMmap(struct file *file,
                     struct vm_area_struct *vma);
@@ -990,6 +992,8 @@
 #if defined VMW_FSYNC_OLD
           struct dentry *dentry,        // IN: Dentry for this file
 #endif
+                 loff_t start,
+                 loff_t end,
           int datasync)                        // IN: fdatasync or fsync
 {
    LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFsync: was called\n"));
diff -ur vmhgfs-only-old/filesystem.c vmhgfs-only/filesystem.c
--- vmhgfs-only-old/filesystem.c        2011-11-14 11:41:31.000000000 +0800
+++ vmhgfs-only/filesystem.c    2012-01-19 16:41:00.303867660 +0800
@@ -358,6 +358,8 @@
    HgfsSuperInfo *si;
    HgfsMountInfo *mountInfo;
    struct dentry *rootDentry;
+   struct dentry *tmpDentry;
+   struct inode *inode;
 
    ASSERT(sb);
 
@@ -408,15 +410,15 @@
     * and superblock. Then HgfsInstantiate will do the rest, issuing a getattr,
     * getting the inode, and instantiating the dentry with it.
     */
-   rootDentry = compat_d_alloc_name(NULL, "/");
+   inode = new_inode(sb);
+   tmpDentry = d_alloc_root(inode);
+   rootDentry = compat_d_alloc_name(tmpDentry, "/");
    if (rootDentry == NULL) {
       LOG(4, (KERN_WARNING "VMware hgfs: HgfsReadSuper: Could not allocate "
               "root dentry\n"));
       result = -ENOMEM;
       goto exit;
    }
-   rootDentry->d_parent = rootDentry;
-   rootDentry->d_sb = sb;
    result = HgfsInstantiate(rootDentry, HGFS_ROOT_INO, NULL);
    if (result) {
       LOG(4, (KERN_WARNING "VMware hgfs: HgfsReadSuper: Could not instantiate "
发表在 linux | 留下评论

some notes for mac osx dev.

set install_name for dylib
g++ -install_name xxx.o -o xxx.dylib

view install_name:
method1: otool -L xxx.dylib see the first row.

change install_name
install_name_tool -change old.dylib new.dylib xxx.dylib

pack libs
lipo -create a_32.dylib a_64.dylib -output a.dylib

发表在 MAC, 开发 | 留下评论

patch mindmanager to avoid fuzzy text.

mindmanager is a great tool, but it has a bug (or they the devlopers may think it’s a feature) not fixed for years. That is, the fuzzy text problem. Just search mindmanager fuzzy text , there are many results about this bug and some patches for the old versions of mindmanager. Just as what is said from http://forum.us.mindjet.com/viewtopic.php?f=16&t=3060 ,disabling the call to GdipSetTextRenderingHint fixes this bug.

steps to make a patch
1. open a debugger, ex: ollydbg, load mindmanager.
2. break at GdipSetTextRenderingHint (gdiplus.dll!_GdipSetTextRenderingHint@8)
3. when it break down, track the call to it. It’s something like:

00688A2D  call        00CC8792

goto 00CC8792 , it is something like:

00CC8792  jmp         dword ptr ds:[0E5A758h]

change it to :
retn 8
code bytes: c2 08 00 90 90 90
4. save the modification to mindmanager.exe
5. done, enjoy clear text.

发表在 破解狂 | 留下评论

patch openwrt to avoid “bad substitution”

when editing some configration of openwrt , this error maybe occured:
/sbin/ifup: eval: line 1: syntax error: bad substitution

I found at least one reason of this error code, and fixed it.

--- /rom/lib/network/config.sh
+++ config.sh
@@ -15,7 +15,7 @@
 
        local fam
        for fam in ipv4 ipv6; do
-               if [ -d /proc/sys/net/$fam ]; then
+               if ls /proc/sys/net/$fam/*/$ifn 2>/dev/null ; then
                        local key
                        for key in /proc/sys/net/$fam/*/$ifn/*; do
                                local val

If there is no such file , $key is “/proc/sys/net/ipv4/*/eth1:1/*” before this modification, statements in then case are not executed after modification. so this code resolved the problem of reporting:
/sbin/ifup: eval: line 1: syntax error: bad substitution

发表在 linux | 标签为 | 留下评论

Google’s IP Range

the following ip addresses belong to google.

64.233.160.0 – 64.233.191.255
66.102.0.0 – 66.102.15.255
66.249.64.0 – 66.249.95.255
72.14.192.0 – 72.14.255.255
74.125.0.0 – 74.125.255.255
209.85.128.0 – 209.85.255.255
216.239.32.0 – 216.239.63.255

发表在 软件使用 | 留下评论