Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5399
  • Last Modified:

How to obtain Android phone number with adb command ?

Hello Experts,

I want to obtain phone number from Android phone for forensics with adb command.
I want to obtain it without operate Android phone directly.

Any hints welcome.
0
NobMiwa
Asked:
NobMiwa
3 Solutions
 
KimputerCommented:
You can't, even if there was a command. That's because the number is not known to you or the phone, or even the SIM card.Situation 1: You just don't know (query phone or sim returns null), only the operator knows.
Situation 2: You think you know it, because you query the SIM card. It's is the correct number.
Situation 3: You think you know it, because you query the SIM card. It's is the WRONG number (subscriber changed phone number, not SIM card, since operator can change it from remote).
Situation 5: You think you know it, because you query the phone. It's is the WRONG number (from past user input).
Situation 3: You think you know it, because you query the phone. It's is the correct number (from past user input).

As you can see, even if there as an adb command, you have a VERY high percentage it's not returning a number, and an equally high percentage it's the wrong number.

Unique numbers you can get (if SIM is inserted) is the SIM serial number. However, on the operator can link that to a phone number, something you probably won't be able to (if you're not law enforcement). The IMEI is also a unique number you can get (sometimes not necessary to use software, if you can remove the back of the phone, you can also read it on some label inside the phone)

Anyway, if you want to play roulette (as in, carry an investigation with unknown factors, including the risk of accusing wrong people, making wrong assumptions and wrong conclusions), try these commands:

service call iphonesubinfo 4
service call iphonesubinfo 5
service call iphonesubinfo 6
service call iphonesubinfo 7
service call iphonesubinfo 8
1
 
coke_ruCommented:
You can access your Android device via the adb command on the command line. . An Android virtual device can be freely accessed, a normal Android phone needs to get rooted, e.g. you need to remove the protection to do everything on this device.

The adb tools is located in the [android-sdks]/platform-tools directory. You should add this directory to your path to have direct access to this command.

The adb allows you to send commands to your Android device, pull and push files to it, gives shell access to the Android device and allows you to read information from your device, for example the current memory usage. The following chapter describe the usage of the corresponding commands.

If you have several devices running you can issue commands to one individual device.

# Lists all devices
adb devices
#Result
List of devices attached
emulator-5554 attached
emulator-5555 attached
# Issue a command to a specific device
adb -s emulator-5554 shell
0
 
btanExec ConsultantCommented:
Android iphonesubinfo service "keeps track" of the subscriber information including phone details.  iphonesubinfo does implement the Dump() method hence dumpsys shows phone details using service call command e.g. getLine1Number() or IPhoneSubInfo.getMsisdn(). However, it only reports Phone Details such as Phone Type (e.g., GSM) and Device ID (e.g., IMEI), not the phone number.  

Depending on the android version and your carrier one or two of the a/m commands will tell you the phone number. But note that this does not seem to work without rooting the phone.
service call iphonesubinfo 4 > getGroupIdLevel1
service call iphonesubinfo 5 > getIccSerialNumber
service call iphonesubinfo 6 > getLine1Number
service call iphonesubinfo 7 > getLine1AlphaTag
service call iphonesubinfo 8 >getMsisdn

As for the not direct approach, I was thinking over TCP leveraging the below (maybe over WIFI or simply via n/w)
(http://ppareit.github.io/AdbConnect/)
(https://docs.google.com/document/d/1-wMYWpljgHolnVHCsV2VGeMmBcc29Id9rMbHrZoCelE/edit)
e.g. adb tcpip <port>  - restarts the adbd daemon listening on TCP on the specified port
Such as below
adb tcpip 5555
adb connect 192.168.0.101:5555
Be sure to replace 192.168.0.101 with the IP address that is actually assigned to your device.

Find the IP address in two ways:
> Manual IP Discovery:  Go into Android's WiFi settings, click the menu button in the action bar (the vertical ellipsis), hit Advanced and see the IP address at the bottom of the screen.
> Use ADB to discover IP: Execute the following command via adb:
adb shell ip -f inet addr show wlan0

Apps to automate the process: There are also several apps on Google Play that automate this process. A quick search suggests adbWireless, WiFi ADB and ADB WiFi.

All of these require root access, but adbWireless requires fewer permissions. that may not be straightforward
0
 
NobMiwaAuthor Commented:
Thank you for all advice.

I understood I cannot get phone number with adb.
I will make small app which will be push into Android phone and dig phone number information.

Regards,
Nobuo Miwa
0
 
KimputerCommented:
Don't forget, the 5 situations I described are still in effect, app or no app. You're still having uncertainty with the phone number. That's just something you have to live with.
1

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now