Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider newer Android API #56

Open
ghost opened this issue Aug 10, 2023 · 6 comments
Open

consider newer Android API #56

ghost opened this issue Aug 10, 2023 · 6 comments

Comments

@ghost
Copy link

ghost commented Aug 10, 2023

the current implementation:

data: dict[str, int | str | bytes] = {
"accountType": "HOSTED_OR_GOOGLE",
"Email": email,
"has_permission": 1,
"add_account": 1,
"EncryptedPasswd": google.construct_signature(
email, password, ANDROID_KEY_7_3_29
),
"service": service,
"source": "android",
"androidId": android_id,
"device_country": device_country,
"operatorCountry": operator_country,
"lang": lang,
"sdk_version": sdk_version,
"client_sig": client_sig,
"callerSig": client_sig,
"droidguard_results": "dummy123",
}

from what I can tell is based on Android API 19, which is dated around 2013:

https://apilevels.com

have you considered bumping up the implementation? it seems starting with API 21, Google is using something more like this:

POST /auth HTTP/1.1
Host: android.clients.google.com
Accept-Encoding: identity
Connection: Keep-Alive
User-Agent: GoogleAuth/1.4 (generic_x86 LSY66K); gzip
app: com.google.android.gms
content-type: application/x-www-form-urlencoded
device: 3760dcd91...

ACCESS_TOKEN=1&
add_account=1&
device_country=us&
droidguard_results=CgYXdhUgp-PSEFsAAHdU9h5a1xWSAFpFJRNTS5M9AC4R4ZGh9VMLBADDJ6...&
google_play_services_version=11055270&
is_dev_key_gmscore=1&
lang=en_US&
sdk_version=21&
service=ac2dm&
Email=s...&
androidId=3760dcd91...&
Token=oauth2_4%2F0Adeu5BVnTdwNdQyQ97hA6iZKM3KitofkyAKOb3yucDZ0JxPCvMJ3c7y-lmHr...

admittedly, getting that Token value to plug into the request is not simple, but after 10 years it might be time to start thinking about it.

@simon-weber
Copy link
Owner

I don't use this library for any of my own projects anymore so I'm not planning on making any major changes to it, but if someone else wants to look into it I can help get things merged.

@ghost
Copy link
Author

ghost commented Aug 18, 2023

OK might have hit a brick wall. it seems the /_/lookup/accountlookup request is protected by a value bgRequest, which is Google bot-guard protection.

@ghost
Copy link
Author

ghost commented Aug 20, 2023

OK I tested again by manually installing Google Play API 21 with the oldest apps I could get working:

package: name='com.android.vending' versionCode='81085000'
versionName='10.8.50-all [0] [PR] 206058588'

package: name='com.google.android.gms' versionCode='205066013'
versionName='20.50.66 (020700-351698872)'

package: name='com.google.android.gsf' versionCode='21'
versionName='5.0.2-1649326'

and I also blocked updates with this filter:

/~u play-apps-download-default.download.by-id/444

but still, the result is the request is protected by Google bot-guard. so I think I am out of ideas, because I am not skilled enough to reverse that.

@simon-weber
Copy link
Owner

Aw, ok. I don't think I'll be able to resolve that - it's been ages since I've done anything with Android - but I appreciate the attempt!

@GRodrig
Copy link

GRodrig commented Aug 21, 2023

@1268 The results from the (500+) tests I did:
Parameters:
'add_account' is required for some accounts to prevent an 'UNKNOWN ERROR' (aas token)
'client_sig' is needed if you want a longer expiration time for the token (auth token).

I couldn't find any more errors related to other parameters.

If you want to follow that approach (auth2_4 token) I suggest u to check:
https://gitlab.com/AuroraOSS/gplayapi/-/tree/master
https://github.com/whyorean/Authenticator (You can make it return the auth2_4 token, but you need to make changes)

@ghost
Copy link
Author

ghost commented Aug 22, 2023

OK well as of now I have switched to Android API 21, which means my package no longer supports email/password login:

3052/google@784a2a7

I dont think people will like that, but I am not really interested in supporting a 10 year old API any more. also I was able to rip out the custom TLS code, which make the process much better from a coding standpoint. I will leave this open in case @simon-weber or anyone has any ideas on the bot guard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants