Android emulator: Set mobile device number?

冷暖自知 提交于 2019-11-30 07:32:21

Mostly full control of the phone number detailed at the end of this blog:

http://blog.talosintel.com/2013/04/changing-imei-provider-model-and-phone.html

First 7 are fully configurable, last 4 can be one of 16 allowed port numbers.

It turns out that the phone number is stored on the SIM card. Since there is no actual SIM card, one is emulated. This emulated SIM is hard coded in the emulator-arm binary. The reason replacements for 1555521 failed is because SIM cards have a specification that does not store the MSISDN (Mobile Subscriber Integrated Services Digital Network-Number, AKA phone number) in plain text. Instead, each set of digits is swapped in some reverse nibbled endianness nightmare.

... A quick way to find the MSISDN is to search for %d%df%d in the binary (highlighted in red below). The corresponding source code is in external/qemu/telephony/sim_card.c on line 436 in the current repo. The following is the format string portion of that sprintf:

"+CRSM:144,0,ffffffffffffffffffffffffffffffffffff0781515525%d1%d%df%dffffffffffff"

The interesting part is 515525%d1 (highlighted in blue). Swapping each set of two digits produces 1555521%d (thanks again CodePainters). That looks like the prefix to our mobile number.

Edit it in a hex editor.

You can simulate incoming SMS and calls in the simulator (using the simulator's port) but that's all, you can not set a device number or anything like that. For that kind of thing you will need a real device.

As I have found each emulator already has a phone number. If you run two emulators you can call from one emulator to another. To find out this phone numbers you can run in the terminal window:

Path\To\Your\Android\Sdk\platform-tools>adb devices
List of devices attached
emulator-5554   device
emulator-5556   device

First phone number is +15555215554, second +15555215556, i.e. phone number is prefix +1555521 plus emulator suffix 5554 or 5556.

TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);

                 // get IMEI
                 String imei = tm.getDeviceId();
                 System.out.println("gfvnchgjvbnvhjbbnvgjvbncghvmn ngvm"+imei);

                 // get SimSerialNumber
                 String simSerialNumber = tm.getSimSerialNumber();
                 System.out.println("854755745588954754855ngvm"+simSerialNumber);

                 //get SimCardNumber
                 String number = tm.getLine1Number();
                 System.out.println("gfch5652345651szdxfcgvhbjnfcgvh ngvm"+number);



And Import :]->

import android.content.Context;

import android.telephony.TelephonyManager;

The mobile number of an emulator is the port number of that emulator. For more details. please check this link:

http://developer.android.com/guide/developing/devices/emulator.html#calling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!