基于Kali LInux Osmocom-BB的GSM SMS嗅探

首先在本文的开头感谢一下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

QAQ
拿到手首先接线子。顺序大概是这样:

红 TX
白 RX
黄/黑 GN

身为一个学电气的人,电路图怎么能看不懂。小case
QAQ
QAQ
然后把 USB 共享到虚拟机里。运行lsmod | grep usb后会有这个东西。
QAQ
同时 GND 处的红灯会亮起来。
如果你的环境配置好了,紧接着就开始刷固件了。
运行:

  cd osmocom-bb/src/host/osmocon/

./osmocon -m c123xor -p /dev/ttyUSB0 ../../target/firmware/board/compal_e88/layer1.compalram.bin

接着点一下开机键。如果成功了大概会这样:QAQ
QAQ
如果没有任何输出,说明你线子插错了。如果有Received FTMTOOL from phone, ramloader has aborted的错误,多多尝试几次,包括但不限于:

  • 拔了线重新运行
  • 多次点击关机键

祝你成功!!QAQ!!!
如果成功了,多开几个新的终端,一个运行:

cd ~/osmocom-bb/src/host/layer23/src/misc
./cell_log -O

大概会出现这样的东西。
QAQ
这里 ARFCN 使我们需要注意的。这里第一个是 58,中国移动。那就选它了。
接着运行:

./ccch_scan -i 127.0.0.1 -a 58

这里的 58 就是 ARFCN ID,然后回车。 
最后一个终端运行:wireshark -k -i lo -f 'port 4729'来抓包。过滤器里填写gsm_sms。 
如果有短信发进来的话,大概会出现这种东西。
QAQ

 参考链接:

http://www.freebuf.com/articles/wireless/11910.html

http://www.ricter.me/articles/160

http://cyrils.org/index.php/archives/20/

原文地址:https://www.cnblogs.com/i0ject/p/3788249.html