forked from B16f00t/whapa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
772 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
[report] | ||
company = | ||
record = | ||
unit = | ||
examiner = | ||
notes = | ||
company = "" | ||
record = "" | ||
unit = "" | ||
examiner = "" | ||
notes = "" | ||
|
||
[google-auth] | ||
gmail = [email protected] | ||
# Optional. The account password or app password when using 2FA. | ||
password = | ||
password = yourpassword | ||
# Optional. Login using the oauth cookie. | ||
oauth = "" | ||
# Optional. The result of "adb shell settings get secure android_id". | ||
android_id = 0000000000000000 | ||
android_id = 0000000000000000 | ||
# Optional. Enter the backup country code + phonenumber be synchronized, otherwise it synchronizes all backups. | ||
# You can specify a list of celnumbr = BackupNumber1, BackupNumber2, ... | ||
celnumbr = | ||
celnumbr = "" | ||
|
||
[icloud-auth] | ||
icloud = [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
pycryptodome | ||
requests | ||
colorama | ||
configparser | ||
gpsoauth | ||
requests==2.21.0 | ||
pyicloud | ||
pandas | ||
numpy | ||
selenium | ||
webdriver-manager | ||
selenium-stealth | ||
ConfigObj | ||
pycryptodome |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
"""A python client library for Google Play Services OAuth.""" | ||
from __future__ import annotations | ||
|
||
from collections.abc import MutableMapping | ||
from importlib.metadata import version | ||
import ssl | ||
from typing import Any, Iterable | ||
|
||
import requests | ||
from urllib3.poolmanager import PoolManager # type: ignore | ||
|
||
from . import google | ||
|
||
__version__ = version(__package__) | ||
|
||
# The key is distirbuted with Google Play Services. | ||
# This one is from version 7.3.29. | ||
B64_KEY_7_3_29 = ( | ||
b"AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3" | ||
b"iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pK" | ||
b"RI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/" | ||
b"6rmf5AAAAAwEAAQ==" | ||
) | ||
|
||
ANDROID_KEY_7_3_29 = google.key_from_b64(B64_KEY_7_3_29) | ||
|
||
AUTH_URL = "https://android.clients.google.com/auth" | ||
USER_AGENT = "gpsoauth/" + __version__ | ||
|
||
# Google is very picky about list of used ciphers. Changing this list most likely | ||
# will cause BadAuthentication error. | ||
CIPHERS = [ | ||
"ECDHE+AESGCM", | ||
"ECDHE+CHACHA20", | ||
"DHE+AESGCM", | ||
"DHE+CHACHA20", | ||
"ECDH+AES", | ||
"DH+AES", | ||
"RSA+AESGCM", | ||
"RSA+AES", | ||
"!aNULL", | ||
"!eNULL", | ||
"!MD5", | ||
"!DSS", | ||
] | ||
|
||
|
||
class SSLContext(ssl.SSLContext): | ||
"""SSLContext wrapper.""" | ||
|
||
def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: | ||
""" | ||
ALPN headers cause Google to return 403 Bad Authentication. | ||
""" | ||
|
||
|
||
class AuthHTTPAdapter(requests.adapters.HTTPAdapter): | ||
"""HTTPAdapter wrapper.""" | ||
|
||
def init_poolmanager(self, *args: Any, **kwargs: Any) -> None: | ||
""" | ||
Secure settings from ssl.create_default_context(), but without | ||
ssl.OP_NO_TICKET which causes Google to return 403 Bad | ||
Authentication. | ||
""" | ||
context = SSLContext() | ||
context.set_ciphers(":".join(CIPHERS)) | ||
context.options |= ssl.OP_NO_COMPRESSION | ||
context.options |= ssl.OP_NO_SSLv2 | ||
context.options |= ssl.OP_NO_SSLv3 | ||
context.post_handshake_auth = True | ||
context.verify_mode = ssl.CERT_REQUIRED | ||
self.poolmanager = PoolManager(*args, ssl_context=context, **kwargs) | ||
|
||
|
||
def _perform_auth_request( | ||
data: dict[str, int | str | bytes], proxies: MutableMapping[str, str] | None = None | ||
) -> dict[str, str]: | ||
session = requests.session() | ||
session.mount(AUTH_URL, AuthHTTPAdapter()) | ||
if proxies: | ||
session.proxies = proxies | ||
|
||
res = session.post(AUTH_URL, data, headers={"User-Agent": USER_AGENT}) | ||
return google.parse_auth_response(res.text) | ||
|
||
|
||
def perform_master_login( | ||
email: str, | ||
password: str, | ||
android_id: str, | ||
service: str = "ac2dm", | ||
device_country: str = "us", | ||
operator_country: str = "us", | ||
lang: str = "en", | ||
sdk_version: int = 17, | ||
proxy: MutableMapping[str, str] | None = None, | ||
) -> dict[str, str]: | ||
""" | ||
Perform a master login, which is what Android does when you first add | ||
a Google account. | ||
Return a dict, eg:: | ||
{ | ||
'Auth': '...', | ||
'Email': '[email protected]', | ||
'GooglePlusUpgrade': '1', | ||
'LSID': '...', | ||
'PicasaUser': 'My Name', | ||
'RopRevision': '1', | ||
'RopText': ' ', | ||
'SID': '...', | ||
'Token': 'oauth2rt_1/...', | ||
'firstName': 'My', | ||
'lastName': 'Name', | ||
'services': 'hist,mail,googleme,...' | ||
} | ||
""" | ||
|
||
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, | ||
} | ||
|
||
return _perform_auth_request(data, proxy) | ||
|
||
|
||
def perform_master_login_oauth( | ||
email: str, | ||
oauth_token: str, | ||
android_id: str, | ||
service: str = "ac2dm", | ||
device_country: str = "us", | ||
operator_country: str = "us", | ||
lang: str = "en", | ||
sdk_version: int = 28, | ||
proxy: MutableMapping[str, str] | None = None, | ||
) -> dict[str, str]: | ||
""" | ||
Perform a master login, which is what Android does when you first add | ||
a Google account. | ||
Return a dict, eg:: | ||
{ | ||
'Auth': '...', | ||
'Email': '[email protected]', | ||
'GooglePlusUpgrade': '1', | ||
'LSID': '...', | ||
'PicasaUser': 'My Name', | ||
'RopRevision': '1', | ||
'RopText': ' ', | ||
'SID': '...', | ||
'Token': 'oauth2rt_1/...', | ||
'firstName': 'My', | ||
'lastName': 'Name', | ||
'services': 'hist,mail,googleme,...' | ||
} | ||
""" | ||
|
||
data: dict[str, int | str | bytes] = { | ||
"lang": lang, | ||
"google_play_services_version": 19629032, | ||
"sdk_version": sdk_version, | ||
"device_country": device_country, | ||
"Email": email, | ||
"service": service, | ||
"get_accountid": 1, | ||
"ACCESS_TOKEN": 1, | ||
"callerPkg": "com.google.android.gms", | ||
"add_account": 1, | ||
"Token": oauth_token, | ||
"callerSig": "38918a453d07199354f8b19af05ec6562ced5788", | ||
} | ||
|
||
return _perform_auth_request(data, proxy) | ||
|
||
|
||
def perform_oauth( | ||
email: str, | ||
master_token: str, | ||
android_id: str, | ||
service: str, | ||
app: str, | ||
client_sig: str, | ||
device_country: str = "us", | ||
operator_country: str = "us", | ||
lang: str = "en", | ||
sdk_version: int = 17, | ||
proxy: MutableMapping[str, str] | None = None, | ||
) -> dict[str, str]: | ||
""" | ||
Use a master token from master_login to perform OAuth to a specific Google service. | ||
Return a dict, eg:: | ||
{ | ||
'Auth': '...', | ||
'LSID': '...', | ||
'SID': '..', | ||
'issueAdvice': 'auto', | ||
'services': 'hist,mail,googleme,...' | ||
} | ||
To authenticate requests to this service, include a header | ||
``Authorization: GoogleLogin auth=res['Auth']``. | ||
""" | ||
|
||
data: dict[str, int | str | bytes] = { | ||
"accountType": "HOSTED_OR_GOOGLE", | ||
"Email": email, | ||
"has_permission": 1, | ||
"EncryptedPasswd": master_token, | ||
"service": service, | ||
"source": "android", | ||
"androidId": android_id, | ||
"app": app, | ||
"client_sig": client_sig, | ||
"device_country": device_country, | ||
"operatorCountry": operator_country, | ||
"lang": lang, | ||
"sdk_version": sdk_version, | ||
} | ||
|
||
return _perform_auth_request(data, proxy) |
Oops, something went wrong.