25

I want to read the fingerprint of the computer. That fingerprint is shown when you connect it for the first time with your computer.

I googled a lot but I found nothing related. Do you have an idea or a helpful resource?

Micer
  • 8,731
  • 3
  • 79
  • 73
rekire
  • 47,260
  • 30
  • 167
  • 264
  • 4
    It seems that the keys are stored in `/data/misc/adb/adb_keys`. – rekire Sep 02 '14 at 14:24
  • 1
    The "fingerprint" is just an MD5 hash of the computer's public key, which is stored in `~/.android/adbkey.pub` in `base64` encoding. – Alex P. Sep 02 '14 at 22:40
  • @AlexP. I already read that, but I cannot read that file from the Android device. – rekire Sep 03 '14 at 05:26
  • 1
    This is handled internally by the adbd daemon, so there is nothing you can do without modifying it. The PC acts as a host, so you can't really send commands from Android either. If you want to identify the host, the host has to send you some identifier proactively as part of some protocol. Why do you need to identify the host anyway? – Nikolay Elenkov Dec 10 '14 at 06:08
  • That was an idea for a developer backdoor, since some devices have bugs when using `abd shell run-as`. That idea was also restricted to debug builds. – rekire Dec 10 '14 at 06:12
  • This related question might have some leads: https://stackoverflow.com/questions/40891108/how-to-get-list-of-usb-accessories-connected-to-android-device – william_grisaitis Jul 28 '19 at 21:47

2 Answers2

39

Enter this in your terminal:

awk '{print $1}' < ~/.android/adbkey.pub | openssl base64 -A -d -a | openssl md5 -c

Works just as it should for me. =)

From: https://android.stackexchange.com/questions/50922/how-can-i-see-the-fingerprint-of-my-adbkey?newreg=7d7d931b67d442019d3ba60ed114be04

which references the original source: http://nelenkov.blogspot.de/2013/02/secure-usb-debugging-in-android-422.html

Community
  • 1
  • 1
pd12
  • 805
  • 10
  • 12
  • Please correct me but this code is run on the computer right? I'm asking out of view of the app (on the mobile). By the way did you read the comments below the question? – rekire Dec 09 '14 at 08:23
  • oops, my bad. Yeah, I did read the comments, but totally missed that you were doing this from your Android device. You could try the command in a terminal emulator on Android? – pd12 Dec 09 '14 at 08:48
  • That is not possible. I basically want to know if a mobile is connected to a specific computer. – rekire Dec 09 '14 at 08:51
  • @scorpiodawg no. By the way the question would be a better place for this comment. – rekire Jun 01 '16 at 04:00
  • on modern hardware/software hash-function md5 is replaced with other, e.g sha256, also could try `awk '{print $1}' < ~/.android/adbkey.pub | openssl base64 -A -d -a | openssl sha256 -c` – Marisha Sep 23 '19 at 16:25
  • @Marisha sounds like case-by-case basis, I'm using Samsung S22 Ultra (released in 2022) and Motorola G60S (2021) and they encrypt RSA keys using md5. – M.Ed Jul 19 '23 at 10:43
-1

On Android 5 and up as far as I know hash-function md5 is replaced with sha256, try:

awk '{print $1}' < ~/.android/adbkey.pub | openssl base64 -A -d -a | openssl sha256 -c | awk '{print $2}'|tr '[:lower:]' '[:upper:]'

Marisha
  • 816
  • 9
  • 14