Getting android cell phone number using command line

3k Views Asked by At

I would like to get the cell phone number of any android device using the command line.

I have tried using:

adb shell service call iphonesubinfo 4 

and

adb shell service call iphonesubinfo 5/6/7/8

and it returns Permission denied.

I was wondering if anyone has another solution?

Ps: phones are android 4.1 and above

Thanks you in advance.

1

There are 1 best solutions below

1
On

You have to obtain root access by using :

adb root

Then you'll find those command work. Usually the phone number will be returned by :

adb shell service call iphonesubinfo 5

or by :

adb shell service call iphonesubinfo 6

It depends on the device is single or dual sim. You'll need to do some string parsing work if you need this result to be recognized by machine.