Closed Marcellux02 closed 1 year ago
I did a pull request to solve that. But to not wait the merge i tell you what to do:
Add that methods to BeFake/BeFake.py (in class BeFake):
def send_otp_cloud(self, phone: str) -> None:
self.phone = phone
# Request can only accept plain text JSON=> string
data = json.dumps({
"phoneNumber": phone,
})
apiUrl = "https://us-central1-befake-623af.cloudfunctions.net/login"
cloudRes = self.client.post(
apiUrl,
headers={
"content-Type": "application/text",
},
data=data
)
if not cloudRes.is_success:
raise Exception(cloudRes.content)
if cloudRes.status_code == 200:
responseToJson = json.loads(cloudRes.content)
self.otp_session = responseToJson["sessionInfo"]
And
def verify_otp_cloud(self, otp: str) -> None:
# Request can only accept plain text JSON=> string
data = json.dumps({
"code": otp,
"sessionInfo": self.otp_session,
"operation": "SIGN_UP_OR_IN"
})
apiUrl = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPhoneNumber?key=AIzaSyDwjfEeparokD7sXPVQli9NsTuhT6fJ6iA"
VerificationRes = self.client.post(
apiUrl,
headers={
"content-Type": "application/json",
},
data=data
)
if not VerificationRes.is_success:
raise Exception(VerificationRes.content)
VerificationRes = VerificationRes.json()
self.firebase_refresh_token = VerificationRes["refreshToken"]
self.firebase_refresh_tokens()
self.grant_access_token()
And now change in main.py line48-49 to:
@click.option("backend", "--backend", "-b", type=click.Choice(["vonage", "firebase", "recaptcha", "cloud"]), default="cloud",
show_default=True)
Also add down the correspondent if part (main.py)
def login(phone_number, deviceid, backend):
bf = BeFake(deviceId=deviceid)
if backend == "cloud":
bf.send_otp_cloud(phone_number)
otp = input("Enter otp: ")
bf.verify_otp_cloud(otp)
bf.save()
click.echo("Cloud login successful.")
elif backend == "vonage":
bf.send_otp_vonage(phone_number)
otp = input("Enter otp: ")
bf.verify_otp_vonage(otp)
bf.save()
click.echo("Vonage login successful.")
...
Else if throws an error comment the last line in BeFake/BeFake.py in method firebase_refresh_tokens()
def firebase_refresh_tokens(self) -> None:
res = self.client.post("https://securetoken.googleapis.com/v1/token", params={"key": self.gapi_key},
data={"grantType": "refresh_token",
"refreshToken": self.firebase_refresh_token
})
if not res.is_success:
raise Exception(res.content)
res = res.json()
self.firebase_refresh_token = res["refresh_token"]
self.firebase_token = res["id_token"]
self.firebase_expiration = pendulum.now().add(
seconds=int(res["expires_in"]))
self.user_id = res["user_id"]
#self.save()
And now you can do:
$ python befake.py login [PHONENUMBER]
Sorry for my english level hahah
@chemokita13 Thanks bro, you are a king 👍
Apparently Bereal has changed the authentication method, as it is no longer possible to authenticate to then receive the OTP