此文章PDF文檔下載地址:點擊下載
0x00 寫在前面
大家應該都聽說過摩托羅拉C118配合Osmocom-BB實現GSM網絡下的短信攔截功能吧,在14年左右新出了一種玩法就是Osmocom-BB的sylvain/testing分支固件可以配合OpenBTS,,借助周圍信號強度較大的ARFCN偽造出一個新的基站信號。不過由於摩托羅拉C118的問題,無法實現語音通話功能只可以發送短信(默認只可以發送英文短信,修改源碼可以實現發送中文短信)
以下內容將會指導你怎樣用Osmocom-bb兼容的手機(如c115,c118,c123等)當作OpenBTS的無線收發機.
0x01 環境
已順利編譯運行過Osmocombb的可繼續往下看,否則請參考官方鏈接或優秀文章
首先安裝libosmo-dsp庫
先下載
$ git clone git://git.osmocom.org/libosmo-dsp.git
編譯前需要安裝fftw3
$ apt-get install libfftw3-3 libfftw3-dev libfftw3-doc
然后編譯
$ cd libosmo-dsp $ autoreconf -i $ ./configure $ make $ make install
0x02 Osmocom-BB
采用sylvain/testing分支(具體可看WIKI)
先下載
$ git clone git://git.osmocom.org/osmocom-bb.git
再切換分支編譯
$ cd osmocom-bb
$ git checkout sylvain/testing
默認編譯出的版本發送信號相關的功能是被注釋掉的,用mobile啟動layer23后會一直於搜信號的過程中,因為無法發送信號。
如果需要進行實網測試需要打開src/target/firmware/Makefile文件中的編譯開關
把osmocom-bb/src/target/firmware下的Makefile中的DCONFIG_TX_ENABLE宏打開:
# Uncomment this line if you want to enable Tx (Transmit) Support. #CFLAGS += -DCONFIG_TX_ENABLE
然后到src目錄下編譯
$ cd src make HOST_layer23_CONFARGS=--enable-transceiver
0x03 OpenBTS
這里使用的OpenBTS的版本是OpenBts-p2.8(嫌手動編譯麻煩的可以找我要DEB安裝的教程),首先安裝依賴
$ sudo apt-get install autoconf libtool libosip2-dev libortp-dev libusb-1.0-0-dev g++ sqlite3 libsqlite3-dev erlang libreadline6-dev libncurses5-dev
下載源碼
$ svn co http://wush.net/svn/range/software/public(svn版本必須 <= 1.7)
然后編譯安裝(有不懂的可以前往WIKI查看詳細資料)
$ cd a53/trunk $ make install $ cd openbts/trunk $ autoreconf -i $ ./configure $ make $ mkdir /etc/OpenBTS $ sqlite3 -init ./apps/OpenBTS.example.sql /etc/OpenBTS/OpenBTS.db ".quit" $ mkdir -p /var/lib/asterisk/sqlite3dir $ cd subscriberRegistry/trunk $ make $ sqlite3 -init subscriberRegistry.example.sql /etc/OpenBTS/sipauthserve.db ".quit" $ cd smqueue/trunk $ autoreconf -i $ ./configure $ make $ sqlite3 -init smqueue/smqueue.example.sql /etc/OpenBTS/smqueue.db ".quit"
安裝OpenBTS后按照WIKI的說明配置/etc/OpenBTS/OpenBTS.db
$ apt-get install sqlite3 sqliteman(ubuntu系統安裝,Kali自帶sqlitebrowser無需安裝)
然后在終端內輸入sqliteman啟動軟件,打開/etc/OpenBTS/目錄下的OpenBTS.db文件
Control.GSMTAP.TargetIP = 127.0.0.1 GSM.Radio.NeedBSIC = 1 GSM.Radio.Band = 900 GSM.CellSelection.Neighbors =(留空) GSM.RACH.MaxRetrans = 3 GSM.RACH.TxInteger = 8 GSM.Radio.C0 = (發射的頻點,數值1-124之間) Control.LUR.OpenRegistration =.*
0x04 刷入固件
用osmocon程序將trx.compalram.bin刷入手機
命令
$ sudo ./osmocon -p /dev/ttyUSB0 -m c123xor ../../target/firmware/board/compal_e88/trx.compalram.bin
0x05 開始執行
到OpenBTS/apps目錄下,將transceiver重命名為transceiver.bak新建腳本文件transceiver內容如下
#!/bin/bash exec <your path to osmocom-bb>/src/host/layer23/src/transceiver/transceiver <ARFCN>
<your path to osmocom-bb>替換成你自己的路徑,<ARFCN>替換成附近信號最強的ARFCN號
賦予執行權限
chmod +x transceiver
然后開4個終端窗口分別執行
$ cd openbts/trunk/apps
$ ./OpenBTS
$ cd subscriberRegistry/trunk
$ ./sipauthserve(開啟注冊服務)
$ cd smqueue/trunk/smqueue/
$ ./smqueue(開啟短信功能)
$ cd openbts/trunk/apps
$ ./OpenBTSCLI(打開OpenBTS控制台)
如果一切運行順利打開手機進入 設置-移動網絡-網絡運營商 即可看到我們創建的基站
在OpenBTSCLI的終端窗口可以輸入 help 查看命令幫助
輸入 tmsis 可以查看當前基站用戶的IMSI
輸入 sendsms IMSI 電話號碼 短信內容 即可發送任意顯示號碼的短信
0x06 結語
一入GSM深似海,作者不是學通信的,只是業余愛好,第一次寫文章投稿,文中不免紕漏和不妥之處,有任何建議或意見歡迎留言!
0x07參考資料
http://osmocom.org/projects/baseband/wiki/Transceiver
https://wush.net/trac/rangepublic/wiki/BuildInstallRun
https://wush.net/trac/rangepublic/wiki/DebOpenBTS
http://bb.osmocom.org/trac/blog/PHD2012
http://www.h-online.com/open/news/item/29C3-Budget-mobile-turns-into-GSM-base-station-1775204.html
http://blog.0x7678.com/2014/03/osmocombbopenbtsgsmcalypso.html
0x08效果演示
http://www.cnblogs.com/k1two2/p/5176030.html(此文章中含視頻演示)