mirror of
https://github.com/nab138/isideload.git
synced 2026-03-02 06:26:16 +01:00
Fix SMS 2FA headers
This commit is contained in:
@@ -9,7 +9,7 @@ use cbc::cipher::{BlockDecryptMut, KeyIvInit};
|
|||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
use plist::Dictionary;
|
use plist::Dictionary;
|
||||||
use plist_macro::plist;
|
use plist_macro::plist;
|
||||||
use reqwest::header::HeaderMap;
|
use reqwest::header::{HeaderMap, HeaderValue};
|
||||||
use rootcause::prelude::*;
|
use rootcause::prelude::*;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use srp::{
|
use srp::{
|
||||||
@@ -294,6 +294,7 @@ impl AppleAccount {
|
|||||||
two_factor_callback: impl Fn() -> Option<String>,
|
two_factor_callback: impl Fn() -> Option<String>,
|
||||||
) -> Result<(), Report> {
|
) -> Result<(), Report> {
|
||||||
debug!("SMS 2FA required");
|
debug!("SMS 2FA required");
|
||||||
|
|
||||||
let request_code_url = self.grandslam_client.get_url("secondaryAuth").await?;
|
let request_code_url = self.grandslam_client.get_url("secondaryAuth").await?;
|
||||||
|
|
||||||
self.grandslam_client
|
self.grandslam_client
|
||||||
@@ -301,7 +302,7 @@ impl AppleAccount {
|
|||||||
.headers(self.build_2fa_headers().await?)
|
.headers(self.build_2fa_headers().await?)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.context("Failed to request SMS 2fa")?
|
.context("Failed to request SMS 2FA")?
|
||||||
.error_for_status()
|
.error_for_status()
|
||||||
.context("SMS 2FA request failed")?;
|
.context("SMS 2FA request failed")?;
|
||||||
|
|
||||||
@@ -315,26 +316,33 @@ impl AppleAccount {
|
|||||||
"code": code
|
"code": code
|
||||||
},
|
},
|
||||||
"phoneNumber": {
|
"phoneNumber": {
|
||||||
"id": "1"
|
"id": 1
|
||||||
},
|
},
|
||||||
"mode": "sms"
|
"mode": "sms"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
debug!("{}", body);
|
||||||
|
|
||||||
|
let mut headers = self.build_2fa_headers().await?;
|
||||||
|
headers.insert("Content-Type", HeaderValue::from_static("application/json"));
|
||||||
|
headers.insert(
|
||||||
|
"Accept",
|
||||||
|
HeaderValue::from_static("application/json, text/javascript, */*; q=0.01"),
|
||||||
|
);
|
||||||
|
|
||||||
let res = self
|
let res = self
|
||||||
.grandslam_client
|
.grandslam_client
|
||||||
.post("https://gsa.apple.com/auth/verify/phone/securitycode")?
|
.post("https://gsa.apple.com/auth/verify/phone/securitycode")?
|
||||||
.headers(self.build_2fa_headers().await?)
|
.headers(headers)
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.header("Accept", "application/json")
|
|
||||||
.body(body.to_string())
|
.body(body.to_string())
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.context("Failed to submit SMS 2fa code")?
|
.context("Failed to submit SMS 2FA code")?
|
||||||
.error_for_status()
|
.error_for_status()
|
||||||
.context("SMS 2FA code submission failed")?
|
.context("SMS 2FA code submission failed")?
|
||||||
.text()
|
.text()
|
||||||
.await
|
.await
|
||||||
.context("Failed to read SMS 2FA response text")?;
|
.context("Failed to read SMS 2FA response")?;
|
||||||
|
|
||||||
debug!("SMS 2FA response: {}", res);
|
debug!("SMS 2FA response: {}", res);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user