Kali-Linux 2016.1的 GSM Sniffer 搭建

Kali-Linux 2016.1的 GSM Sniffer 搭建

                                                     首先感谢ID:一只猿和diulei前辈的博文

设备:1.MOTOROLA c118手机一部

        2.2.5mm 3极耳机线一根

        3.USB转TTL模块一个

        4.笔记本虚拟机(最新版本Kali 2016.1  官方源)本文主要针对软件部分进行详解

第一步:对系统更新

 

~# apt-get update && apt-get upgrade

 

第二步:Osmocom-bb嗅探平台是需要自己在本地编译的,下面安装编译环境

~# apt-get install libusb-dev libpcsclite-dev libusb-0.1-4 libpcsclite1 libccid pcscd
~# apt-get install libtool shtool autoconf git-core pkg-config make gcc 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 libpcsclite-dev

第三步:建立工作目录armtoolchain下载ARM编译器为编译osmocombb做准备

~# mkdir armtoolchain
~# cd armtoolchain/
mkdir build install src // 建立三个子目录
wget http://bb.osmocom.org/trac/raw-attachment/wiki/GnuArmToolchain/gnu-arm-build.3.sh // 获取脚本gnu-arm-build.3.sh
# cd src
# wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.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

第四步:安装gnu-arm-build.3.sh

# cd ..
# chmod +x gnu-arm-build.3.sh // 获取执行权限
# ./gnu-arm-build.3.sh // 运行脚本

I will build an arm-none-eabi cross-compiler:

Prefix: /root/armtoolchain/install
Sources: /root/armtoolchain/src
Build files: /root/armtoolchain/build

Press ^C now if you do NOT want to do this.       // 直接回车进入编译流程

耐心等待,要很久 。。。

Build complete! Add /root/armtoolchain/install/bin to your PATH to make arm-none-eabi-gcc and friends
accessible directly.

要求安装完过后添加环境

# cd install/bin
# pwd // 查看路径
/root/armtoolchain/install/bin // 路径
# vi ~/./.bashrc // 添加环境变量
export PATH=$PATH:/root/armtoolchain/install/bin // 最后一行添加,保存退出
# source ~/.bashrc // 让环境变量生效

第五步:下载并编译osmocomBB

# cd ~/armtoolchain/     //回到armtoolchain目录下载osmocomBB
# git clone git://git.osmocom.org/libosmocore.git
# git clone git://git.osmocom.org/osmocom-bb.git
# wget https://www.samba.org/ftp/talloc/talloc-2.1.7.tar.gz // 安装Libosmocore执行./configure时所需的包talloc
# tar -zxvf talloc-2.1.7.tar.gz // 对其解压
# cd talloc-2.1.7/
# ./configure
# make
#make install

开始安装Libosmocore

# cd ..
# cd libosmocore/
# autoreconf -i
# ./configure
# make
# make install
# cd ..

开始编译osmocombb

# cd osmocom-bb
# git checkout --track origin/luca/gsmmap
# cd src
# make

细心地人应该观察到了它编译过程中出现很多警告,现在让我们来解决掉它- -

#cd ~
# vi armtoolchain/osmocom-bb/src/target/firmware/board/compal/highram.lds
# vi armtoolchain/osmocom-bb/src/target/firmware/board/compal/ram.lds
# vi armtoolchain/osmocom-bb/src/target/firmware/board/compal_e88/flash.lds
# vi armtoolchain/osmocom-bb/src/target/firmware/board/compal_e88/loader.lds
# vi armtoolchain/osmocom-bb/src/target/firmware/board/mediatek/ram.lds

找到里面的这一串代码

KEEP(*(SORT(.ctors)))

在下面加入

KEEP(*(SORT(.init_array)))如图

五个一一修改保存后,重新编译

# cd ~/armtoolchain/osmocom-bb/src/
# make -e CROSS_TOOL_PREFIX=arm-none-eabi-

好了,到此软件弄完了,插入设备之前还要安装你一个芯片驱动由于Kali Linux2016.1 内核是Debian 4.6.4-1集成了ch341的芯片驱动,于是就好办很多。

# cd ~
# apt-get install minicom

开始连接设备刷机

# cd ~
# cd armtoolchain/osmocom-bb/src/host/osmocon/
# ./osmocon -m c123xor -p /dev/ttyUSB0 ../../target/firmware/board/compal_e88/layer1.compalram.bin

 

回车后按下手机关机键等待刷机成功,手机出现Layer 1 字样

切记不要关闭终端,然后另开终端

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

继续开一个终端

# cd armtoolchain/osmocom-bb/src/host/layer23/src/misc
# ./ccch_scan -i 127.0.0.1 -a ARFCN

再开一个终端用wireshark进行抓包

wireshark -k -i lo -f 'port 4729'

wireshark会出现一个错误

Lua: Error during loading:
[string "/usr/share/wireshark/init.lua"]:45: dofile has been disabled

解决办法终端输入

# gedit /usr/share/wireshark/init.lua

修改倒数第二行

--dofile(DATA_DIR.."console.lua")

好了,到此已经可以抓到包

 用我手机小伙伴发我测试抓到的2g明文包

        

注意:GSM sniffer只针对GSM有效,对于电信和联通的CDMA是无效的,所以监听的范围也很有限。本

文只作为技术学习,切勿触碰法律法规。

                                                                                                                               

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2016-07-27 17:28  winter_小学生  阅读(2864)  评论(0编辑  收藏  举报