SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/usr/bin/perl -w | |
| 2 | # | |
| 3 | # grabsms.pl | |
| 4 | # print sms and mms in unencrypted GSMTAP pcap, work well with OsmocomBB | |
| 5 | # 2013.06.01, @tombkeeper | |
| 6 | # | |
| 7 | ||
| 8 | # tshark -G fields | grep gsm_sms | |
| 9 | my $cmdline = "tshark -r $ARGV[0] -R gsm_sms -Tfields -Eseparator=\\; " . | |
| 10 | "-e gsm_sms.tp-oa -e gsm_sms.tp-da -e mmse.from " . | |
| 11 | "-e mmse.content_location -e gsm_sms.sms_text 2>/dev/null"; | |
| 12 | my @smsinfo = `$cmdline`; | |
| 13 | ||
| 14 | foreach(@smsinfo) | |
| 15 | {
| |
| 16 | chomp($_); | |
| 17 | (my $tpoa, my $tpda, my $mmsfrom, my $mmsloc, my $sms) = split(";", $_, 5);
| |
| 18 | if($tpoa) { print( "From: $tpoa\n" ); }
| |
| 19 | if($tpda) { print( "To: $tpda\n" ); }
| |
| 20 | if($sms) | |
| 21 | {
| |
| 22 | $sms=~s/\\x([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
| |
| 23 | print("Message: $sms\n");
| |
| 24 | } | |
| 25 | if($mmsfrom) { print( "MMSFrom: $mmsfrom\n" ); }
| |
| 26 | if($mmsloc) { print( "MMSLocation: $mmsloc\n" ); }
| |
| 27 | ||
| 28 | if($tpoa || $tpda || $mmsfrom) { print('-'x74 . "\n"); }
| |
| 29 | } |