首先在本文的開頭感謝一下cyrils的博文,看了他的博文坑了一夜~其次感謝ricter
本機環境:Kali(amd64),CP2102,C118,
做一個不坑爹的人,配置環境處女Kali.
下面開始:
0x01編譯環境</p>
1.vim /etc/apt/sources.list
2.deb http://mirrors.ustc.edu.cn/kali kali main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali main non-free contrib
deb http://mirrors.ustc.edu.cn/kali-security kali/updates main contrib non-free//把這三行添加在最后,然后:wq
3.apt-get update
4.aptitude install libtool shtool autoconf git-core pkg-config make gcc
5.apt-get install build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 \
libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev
6.wget -c http://bb.osmocom.org/trac/raw-attachment/wiki/GnuArmToolchain/gnu-arm-build.2.sh
7.chmod +x gnu-arm-build.2.sh
8.mkdir build install src
9.cd src/
10.
這里呢,包都有幾十M,虛擬機的下載可能比較慢,可以放 到本機里的迅雷里,下載完后到/src里,因為wget的命令默認的下載目錄就是當前的目錄
wget http://www.gnuarm.com/bu-2.16.1_gcc-4.0.2-c-c++_nl-1.14.0_gi-6.4_x86-64.tar.bz2
wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
10.1(64位)
tar xf bu-2.16.1_gcc-4.0.2-c-c++_nl-1.14.0_gi-6.4_x86-64.tar.bz2
mv gnuarm-* ~/gnuarm
export PATH=~/gnuarm/bin:$PATH
11.cd ..
12. ./gnu-arm-build.2.sh / /之后按回車就行,漫長的等待
13.echo "export PATH=\$PATH:/root/install/bin">/root/.bashrc//這是把這目錄加到環境變量里
14.source /root/.bashrc //立刻生效
15.cd ~
16.git clone git://git.osmocom.org/libosmocore.git//開始編譯libosmocore,git會比較慢,你懂的
17.cd libosmocore/
18.autoreconf -i//第一個爆點。。。。可能會提示autoreconf命令找不到,解決也很簡單,打開一個terminal ,sudo apt-get install autoconf automake libtool 就行了
19../configure
20.make
21.make install
22.cd ..
23..ldconfig//很多講到的都沒有這步,建議加上吧,說是可能后面會出錯了
24.git clone git://git.osmocom.org/osmocom-bb.git//開始編譯osmoconbb了,主角登場
25.cd ~/osmocom-bb
26.git checkout --track origin/luca/gsmmap
27.cd src
28. git pull --rebase
29.make//編譯開始
Q1:
<pre><code>/root/osmocom-bb/src/target/firmware/include/asm/swab.h: Assembler messages:
/root/osmocom-bb/src/target/firmware/include/asm/swab.h:32: Error: no such instruction: `eor %edx,%ecx,%ecx,ror’
make[4]: *** [gsmtap_util.lo] 錯誤 1
make[4]: Leaving directory `/root/osmocom-bb/src/shared/libosmocore/build-target/src’
make[3]: *** [all] 錯誤 2
make[3]: Leaving directory `/root/osmocom-bb/src/shared/libosmocore/build-target/src’
make[2]: *** [all-recursive] 錯誤 1
make[2]: Leaving directory `/root/osmocom-bb/src/shared/libosmocore/build-target’
make[1]: *** [all] 錯誤 2
make[1]: Leaving directory `/root/osmocom-bb/src/shared/libosmocore/build-target’
make: *** [shared/libosmocore/build-target/src/.libs/libosmocore.a] 錯誤 2
A1:
重新完成10.1這一步。
Q2:
make[1]: *** [board/compal_e88/hello_world.compalram.elf] 錯誤 1
make[1]: Leaving directory `/root/osmocom-bb/src/target/firmware’
make: *** [firmware] 錯誤 2
A2:
git clean -dfx
make

拿到手首先接線子。順序大概是這樣:
紅 TX
白 RX
黃/黑 GN
身為一個學電氣的人,電路圖怎么能看不懂。小case

然后把 USB 共享到虛擬機里。運行lsmod | grep usb后會有這個東西。
同時 GND 處的紅燈會亮起來。
如果你的環境配置好了,緊接着就開始刷固件了。
運行:
cd osmocom-bb/src/host/osmocon/
./osmocon -m c123xor -p /dev/ttyUSB0 ../../target/firmware/board/compal_e88/layer1.compalram.bin
接着點一下開機鍵。如果成功了大概會這樣:

如果沒有任何輸出,說明你線子插錯了。如果有Received FTMTOOL from phone, ramloader has aborted的錯誤,多多嘗試幾次,包括但不限於:
- 拔了線重新運行
- 多次點擊關機鍵
祝你成功!!QAQ!!!
如果成功了,多開幾個新的終端,一個運行:
cd ~/osmocom-bb/src/host/layer23/src/misc
./cell_log -O
大概會出現這樣的東西。
這里 ARFCN 使我們需要注意的。這里第一個是 58,中國移動。那就選它了。
接着運行:
./ccch_scan -i 127.0.0.1 -a 58
這里的 58 就是 ARFCN ID,然后回車。
最后一個終端運行:wireshark -k -i lo -f 'port 4729'來抓包。過濾器里填寫gsm_sms。
如果有短信發進來的話,大概會出現這種東西。
參考鏈接:
http://www.freebuf.com/articles/wireless/11910.html
http://www.ricter.me/articles/160
http://cyrils.org/index.php/archives/20/
