»
S
I
D
E
B
A
R
«
Root your Phone with just 1-Click
Aug 3rd, 2010 by kanru

Today I read that someone demoed how to put rootkit into your phone during the Defcon. But there are no details, the keywords like kernel moudle, install apk, remote phone call, …, all reminds me the old phishing attack. Then I thought, can it be the trick used to root Droid X?

Actually this exploid works on almost every Android phone because it leverages a vulnerability in the framework. XDA developers also confirmed the success on various N1 model. But can it be used on real attack?

To demonstrate how dangerous the local exploit is, I wrote an Android application that inject the su program into your phone. With Superuser.apk you can gain root access whenever you run su from adb shell.

No additional permissions required! This works on my stock Nexus One and in theory any Android. Just one click I can root you phone (optionally take away your data simultaneously). Don’t trust me or any other similar programs floating around the market, or simply don’t install any program until your carrier fix this.

Download the apk here: http://0xlab.org/~kanru/RootDroid-release.apk

md5: 20894acd3be808c51ce32491872ba027
sha1: 889fc92692c0e58e83673dedbabbc66d5c6318b1

This vulnerability has been fixed in CyanogenMod two weeks ago, and the source code is landing the AOSP froyo branch, but there is still no official fix update from Google. Consider how dangerous this is, I may not install any third party application until an OTA arrives or just go ahead with a customized rom with my newly rooted phone ;-)

Parasite – Gtk+ UI 除錯開發工具
Mar 16th, 2009 by kanru

Parasite 是一個強大的 Gtk+ UI 除錯/開發工具,使用方法類似 Firefox 中很好用的 Firebug,可以附著於執行中的程式,顯示 widget tree 與 properties,動態修改 widget 屬性,甚至透過 python console 還可以隨時 coding 改變 widget 行為。

Parasite Python Shell

目前還沒有正式發行版,可以自己從 Git 拖回來編譯安裝。

$ git clone git://github.com/chipx86/gtkparasite

參考:

話說,現在 github 不只有 git hosting,還有 web page hosting 了,不少專案就這樣透過 github 快速成立,或許以後 github 會朝完整的 project hosting 發展?

為什麼 Git 比 X 好?
Dec 6th, 2008 by kanru

當初一看到這個標題心裡想的是 Git 怎麼拿來跟 X 比?原來這個 X 是指其他 SCM…

http://whygitisbetterthanx.com/

很多人都注意到了,但是現在有

http://zh-tw.whygitisbetterthanx.com/

囉,小小替 Git 宣傳一下 :p

Vim – 以游標位置為基礎捲動螢幕
Dec 1st, 2008 by kanru

不是人人都有大螢幕可以一次容納幾百行程式碼,且看文件時我們常會希望可以從頭看到尾,或者是寫文章時我們會希望可以從螢幕的最上頭開新段落然後一次寫一整個螢幕。

如果不熟悉以下命令,你可能常常要用 hjkl 或方向鍵去移動游標,調整顯示的範圍。但是,其實不用這麼辛苦。

zt 把游標下這行放到螢幕最上方

zz 放到中間

zb 放到最後

比如說,要開始寫新段落我只要 L 移動游標到最後,然後 zt ,我就會有一整頁空白的空間可以開始揮灑 :)

Vim – 檔名太長怎麼辦
Nov 30th, 2008 by kanru

這是 vim 的一個小技巧,考慮以下情境:

  1. 我現在在 ~/ 目錄
  2. 因為某個原因我打開 vim 編輯 /usr/src/foodir/src/bardoor.c
  3. 看了看,發現需要參考同目錄下的 bardoor.h,於是打入命令 :tabe
  4. 接下來怎麼辦?因為目前工作目錄是 ~/,如果要用 vim 的 tab 補完的話還是需要把路徑再打一次
  5. 想一想再看答案 :)

    Read the rest of this entry »

Abook Tags Support
Nov 23rd, 2008 by kanru

Abook 是一個文字模式的通訊錄軟體,可以跟 mutt 搭配使用。

功能很齊全,就是沒有群組的功能…這個 patch 新增一個 tags 欄位,讓 abook 在搜尋的時候會搜尋 NAME, NICK, EMAIL, TAGS 四個項目,模擬群組的功能。

不知道若原作者看到這種 patch 會做何感想 XD

X-Server 1.5.0 very sluggish
Sep 18th, 2008 by kanru

最近升到 xorg 1.5.0,某些操作 (terminal 快速更新) 會使 xserver 佔用非常多 cpu,看來是這個問題

Working on it … right now it looks like:

  • XShm pixmaps got accidentally reenabled in the course of Adam’s changes

  • Someone (maybe GTK, having tracked it down yet) is taking advantage
    of that by creating a shared pixmap and using it as the source for a composite operation.

  • That is not handled well in EXA and triggers migration of the destination back to system memory. (*)

– Owen

(*) One of the many cases where we’d be better off creating temporaries in video memory to avoid migration.

測測..

Emesene & SQL Optimization
Sep 17th, 2008 by kanru

最近都是用 emesene 上 MSN,不過他的啟動速度實在是非常慢,啟動的時候硬碟燈狂閃,判斷應該是在讀取聯絡人的資料快取。先用 python profiler 跑過一次,結果果然是 Logger.py 裡面從 sqlite 撈資料的函式在慢。

大小約 17MB 的 db,每個 query 竟然都要一秒以上,難怪 emesene 啟動要這麼久了。就來幫 emesene 最佳化一下 sql 吧。

以底下這個 query 為例:

    select e.stamp, ue.data 
    from event e, user_event ue, user u
    where e.id = ue.id_event and
    u.id = ue.id_user and
    e.name = "status-changed" and
    u.account = "%s"
    order by e.stamp desc
    limit 1
結果是
1221129396.22343|NLN
CPU Time: user 1.173822 sys 0.023997

用 explain query plan 看看

    0|1|TABLE user_event AS ue
    1|0|TABLE event AS e USING PRIMARY KEY
    2|2|TABLE user AS u USING PRIMARY KEY

應該是先把 user_event 與 event, user 三個 table join 在一起,最後再檢查 e.name 與 u.account。

來看看三個 table 的大小

  • user_event: 180801 row
  • event: 192968 row
  • user: 196 row

這樣 join 起來是多大的 table 呀

先試試改寫 from clause 裡的順序

    select e.stamp, ue.data 
    from user u, event e, user_event ue
    where e.id = ue.id_event and
    u.id = ue.id_user and
    e.name = "status-changed" and
    u.account = "%s"
    order by e.stamp desc
    limit 1
結果是
    1221129396.22343|NLN
    CPU Time: user 0.485926 sys 0.008998
很好,時間少了一半,explain query plan 顯示
    0|2|TABLE user_event AS ue
    1|0|TABLE user AS u USING PRIMARY KEY
    2|1|TABLE event AS e USING PRIMARY KEY
如果幫 user_event 建個 index 呢?
    create index ueiduser on user_event(id_user);
再 query 一次
    1221129396.22343|NLN
    CPU Time: user 0.017997 sys 0.004999
快了非常多吧!explain query plan 顯示:
    0|0|TABLE user AS u
    1|1|TABLE user_event AS ue WITH INDEX ueiduser
    2|2|TABLE event AS e USING PRIMARY KEY
這是因為 sqlite 會以 from clause 的第一個當作 outer loop,所以我把數量最小的 user 移到前面,再適當的建立 index,使得 query 的速度快了 100 倍…

參考

Patch 在此

Emesene svn trunk 已經收錄最新 patch :)

video-intel 2.5 & EXA
Sep 1st, 2008 by kanru

video-intel 自從 2.2 版就預設使用 EXA 加速,而這個新一代的加速引擎卻因為在文字的顯示上非常緩慢,掩蓋了 EXA 本身的優良特性,Debian BTS 上也怨聲載道。video-intel 2.5 Carl Worth 終於解決了這個問題,原來是因為使用過小的 buffer,導致每次 driver 都要等待上一次 composite operation 結束才能重新使用 buffer,在加大 buffer 之後,EXA 的 text rendering 速度甚至超過了 XAA!

全面轉換至 EXA,引入 GEM,video-intel 的效能只會越來越好 :-)

AnkhSVN 結合 Visual Studio 與 Subversion
May 31st, 2008 by kanru

最近很多時間都是待在 Visual Studio 的環境下寫程式,而 VCS 則是使用 Windows 下很方便的 TortoiseSVN。對於已經習慣在編輯器裡面修改程式,告一段落後到檔案總管(或是 shell)把修改提交到伺服器上的我來說,使用 TortoiseSVN 算是很習慣了。但是對於第一次接觸 VCS 的同學,可能會忘記要提交修改、要寫 Changelog、開始新的修改前要先 update 等。

AnkhSVN 則提供了一個與 Visual Studio 整合的方案,1.x 版的 AnkhSVN 可以由 VS 內執行 VCS 的命令,而開發中的 2.x 則實做了 Source Control Provider 的介面,與 VS 的環境更緊密的結合,可以完全取代預設的 Sourcesafe 方案,使用上應該與商業化的 Visual SVN 類似,可以直接 checkout 專案、看 changelog、看 diff 等。

solution

測試的時候的小插曲:因為 2.x 是 “stable, but unfinished”,只有提供 nightly build,但是我抓下來的安裝檔都沒辦法在 VS 2005 上面正常執行,後來直接到 #ankhsvn 求救,也很快獲得回應,原來是因為不小心參考到 2008 才有的介面,修正之後,最新的 snapshot 已經可以正常使用 :)

不過要注意的是,2.x 用的是最新版的 svn,所以 working copy 的 format 是第 9 版,而最新的 TortoiseSVN 的 1.4.x release 用的是第 8 版,會沒辦法共同使用,要把 TortoiseSVN 更新到開發中的 1.5 才能讓 working copy 相容。如果沒辦法接受使用兩個開發中軟體的話,還是可以用最新的 release 版本,還是很好用的 :p

»  Substance: WordPress   »  Style: Ahren Ahimsa
© Copyright 2004-2009 Kan-Ru Chen