microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.57k stars 1.72k forks source link

Android device profile generator #1908

Open ale5000-git opened 1 year ago

ale5000-git commented 1 year ago

Hi, I have created a script to automatically generate a device profile (usable by microG) from a device connected via adb: https://github.com/micro5k/microg-unofficial-installer/blob/main/utils/profile-generator.sh https://github.com/micro5k/microg-unofficial-installer/blob/main/utils/dl-device-list.sh Only adb and a device are needed (on Windows you also need busybox to execute the script).

I would like a feedback from all interested people.

PS: It can create a profile from most devices and even emulators but it only make sense to create a profile from devices that pass SafetyNet.

@mar-v-in It would be nice if you could verify that it can correctly extract values from the devices you have.

Mohammedibrahim15 commented 1 year ago

Capture i have this on executing script . are things go right or i have an error? BTW when i press any key to continue the git get closed

ale5000-git commented 1 year ago

Hi, Build.BOOTLOADER may be missing on some devices, I think it is normal so it is fine.

Running the script directly will only show the profile, to create a file you have to run it like this:

This will create the profile xml file.

Mohammedibrahim15 commented 1 year ago

Thank you the file is created but i have a problem . My phone is Huawei without google services When i use Google nexus 5x profile to log in . I can successfully log in into my account But when i use custom profile created from another Huawei device which support google services i can't log in into my account and got error message saying there's a problem communicating with the Google servers. What is the problem with my custom profile then ?

ale5000-git commented 1 year ago

Before creating a profile from a device you must verify that, the device you create it from, passes SafetyNet.

In addition some devices may include Google Apps without being entitled to do it, only these devices are officially allowed: https://storage.googleapis.com/play_public/supported_devices.html

NOTE: You have to create a profile from an officially supported device with a stock ROM (preferably), the you can apply the created profile to all devices.

ale5000-git commented 1 year ago

@Mohammedibrahim15 Looking over the internet the HUAWEI nova 7i isn't certified. Is it correct?

Mohammedibrahim15 commented 1 year ago

Yes it is my phone and it was just a try to execute script .. I have created profile from 2 phones ( each passed safetynet and has google services) but i cannot login via them .. the only option that i could login with is google nexus 5X

Mohammedibrahim15 commented 1 year ago

Custom profiles.zip There is zip file including 2 custom profile files that i have created

ale5000-git commented 1 year ago

The latest version of the profile generator now also detect if the device is certified.

It is possible that the failure get cached by the server, the solution is:

Mohammedibrahim15 commented 1 year ago

Unfortunately nothing happens and that problem still exists. However thank you for your great efforts and i will sign in with Google nexus

ale5000-git commented 1 year ago

I'm not sure what's going on in your phone, in case you want to find out you can open a new issue and post a logcat.

Mohammedibrahim15 commented 1 year ago

I will do that but I wonder if you can upload a ready custom profile and i will try. If i could login with that profile so the problem was in my custom profiles .so please Can you upload a custom profile?

Mohammedibrahim15 commented 1 year ago

BTW, When I try to import custom profile to Vanced microg I successfully logged in. But in official microg I couldn’t

ale5000-git commented 1 year ago

It is possible that they reset the GSF ID, it is the same thing that you can obtain by Reset the data (not just cache) of microG Service Core. But if you don't import the profile before enabling internet microG will log without the profile before you have the time to import the new profile.

ale5000-git commented 1 year ago

@Mohammedibrahim15 You could try this, but I haven't had time to try it yet: huawei_p20_lite_28.zip

Mohammedibrahim15 commented 1 year ago

I have tried this but the problem seems to be in my phone, so I will login with google nexus profile and thank you for your attention and efforts

jhoncio commented 12 months ago

hi, friend. I recently got your script and it's exactly what I want, but I have a problem.

I try to run it, and it stays in this state:

Would you know why it happens?

image

Edit: Don't worry, I realized the cell phone must be on. She had it in bootloader mode. Sorry. ^.^

ale5000-git commented 7 months ago

The script works perfectly when the phone is booted correctly. It works also in recovery but the resulting xml may be incorrect because in the recovery not all props are set correctly. It won't work at all in bootloader mode.

mrd83 commented 5 months ago

The script works perfectly when the phone is booted correctly

@ale5000-git I did not find any guide for windows users (it may or may not be the result of my sloppy searching ;]) - so here goes (feel free to use it in your readme if you wish):

  1. To be able to use adb download and unpack platform tools OR install full Android SDK. Latest platform tools,
  2. To enable adb on your device go to developer options and turn on USB debugging. "adb devices" should return your phone's SN,
  3. Download device-info.sh, dl-device-list.sh, profile-generator.sh and busybox.exe and put those in a single directory,
  4. Open command prompt, cd to that directory,
  5. Hack number 1: use "busybox.exe sh -l" [<-- lowercase "L"], and then i.e. "sh device-info.sh" instead of "busybox sh device-info.sh",
  6. Hack number 2: if using platform tools first you have to execute 'export ANDROID_SDK_ROOT="D:/"' where D:/ is a directory where your platform tools reside (in my example it's D:/platform-tools),
  7. Execute "sh dl-device-list.sh", it creates a folder "data" with "device-list.csv" inside,
  8. And finally execute "sh microg_profile-generator.sh"/"sh microg_profile-generator.sh > profile.xml".

Forgive me if it's obvious, but I had to examine your script to debug "ERROR: adb is NOT available" when using platform tools and it took me a few minutes, hence this short guide.

And yes - the script works perfectly, thank you ;]

lightc786 commented 1 day ago

I noticed that the resulting xml does not include the IMEI. Is there any way to set the IMEI in the microg device profile? I want to make sure my Google account is associated to an OG Pixel with a valid IMEI when using microg gms.

Thanks in advance to anyone who can help with this.

ale5000-git commented 12 hours ago

I have created "device-info.sh" mostly for fun but also to get debugging info and this one also dislay the IMEI.

Instead profiles created with "profile-generator.sh" doesn't contains the IMEI because it isn't needed or used by microG, the Google account is still associated to the device using the serial number.

lightc786 commented 7 hours ago

@ale5000-git , thanks for the reply. The profile I generated on my Pixel 1 device running android 10 only shows a 'serial template' value and not a field for serial.

Do you have any idea why it would not pick up the serial when generating the profile?

Thanks again.

ale5000-git commented 1 hour ago

It is like this. The first time microG is used it generate a random serial that look valid by following the serial template. The generated value doesn't change unless you reset the device or reset microG data or change profile; so it keep the phone associated to the Google account.