OSMOCOM-BB 构建与使用

因为啊蛋的杂货铺上线,推了快一个月,不好意思哈。。应用时在ccch_scan出现了小插曲。还在研究。还有这个分支可不是GSM Sniffing的分支哦~不过我在扫描基站号的时候用到了这个分支。   硬件准备: 可以来这里购买全套(数据线是焊好的,给自己做个广告:D):http://shop.love521.org/?p=152 Moto C118 cp2102模块 2.5MM公头三节数据线   硬件准备好后,按下图焊接数据线 hanjie   软件准备: ubuntu 12.04 aptitude install libtool shtool autoconf git-core pkg-config make gcc   获取代码

用git来获取代码,在一个目录下,执行以下命令:

  $ git clone git://git.osmocom.org/osmocom-bb.git

  $ cd osmocom-bb

  $ git pull --rebase

设置编译器(在这一步失败了很多次)

$ wget http://www.gnuarm.com/bu-2.15_gcc-3.4.3-c-c++-java_nl-1.12.0_gi-6.1.tar.bz2

剪切至/opt/gnuarm-3.4.3

在/home目录下找到.bashrc最后加上:

export PATH=$PATH:/opt/gnuarm-3.4.3/bin

这样就把交叉编译器的路径加到了系统环境变量中了,我们可以在shell中调用编译工具链。

编译,运行,测试

编译

Osmocom-bb的主分支(main branch)不支持对SIM卡的读写相关操作,如果要对真实的SIM卡与网络进行试验,必须转 到另外一个分支上 去,即sylvain/testing, 我们可以运行以下命令转到这个分支上:

$ cd osmocom-bb

$ git checkout -b testing remotes/origin/sylvain/testing

下一步就是将 $osmocom-bb/src/target/firmwire/下的Makefile中的 CONFIG_TX_ENABLE宏打开:

# Uncomment this line if you want to enable Tx (Transmit) Support.

-#CFLAGS +=-DCONFIG_TX_ENABLE

+CFLAGS +=-DCONFIG_TX_ENABLE

然后你就可以运行$osmocom-bb/src/目录下的makefile来编译出可以进行实网测试的binary.

运行

现在可以通过命令在测试机上运行layer1,以及短按手机上得电源按钮来将layer1的binary加载到手机的RAM中:

$ cd src/host/osmocon/

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

现在运行Desktop端的mobile程序,负责layer2,layer3的功能实现,开启新的终端,运行命令如下:

$ cd src/host/layer23/src/mobile

$ ./mobile -i 127.0.0.1

还可以用著名的wireshark 1.4来抓取GSM的信令消息,开启新的终端,运行的命令如下:

$ nc -u -l 4729>/dev/null &

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

在开启telnet服务进行手机控制之前,先要建立配置文件/etc/osmocom/osmocom.cfg,用touch命令来建立:

$ sudo mkdir /etc/osmocom/

$ sudo touch /etc/osmocom/osmocom.cfg

  运行命令:

$ telnet localhost 4247

如果telnet连接成功,则有以下输出:

Trying 127.0.0.1...Connected to localhost.

Escape character is'^]'.

Welcome to the OpenBSC Control interface

OsmocomBB>

这是mobile程序建立的telnet服务,等待客户端去连接,OsmocomBB目前用这个用户接口来控制手机各种功能。

在此输入命令:

OsmocomBB>enable

OsmocomBB# sim reader 1

运行此命令后,如果观察Wireshark的log输出,我们应该可以看到Location Update 的信令流程。

然后还可以通过命令查看SIM卡信息:

OsmocomBB# show subscriber

如果要打电话,运行以下命令:

OsmocomBB# call 1 112

参考资料:http://blog.csdn.net/alexu2002/article/details/6783021

有些基友正在玩GSM Sniffing,上个月已经完成了大部分,扫描到了基站号,但是在关键部分ccch_scan出现错误。还望有兴趣的基友一起交流

posted @ 2013-07-15 01:36  test.cfs  阅读(779)  评论(0编辑  收藏  举报