Try and fail to login
This commit is contained in:
parent
2331c7ecf1
commit
de54c1d0f6
|
@ -135,14 +135,15 @@ impl Context {
|
|||
}
|
||||
|
||||
// Send based on jobid to call_service_method etc.
|
||||
let jobid = message.header.jobid_target();
|
||||
if let Some(waker) = session.receive_wakers.remove(&jobid) {
|
||||
if session.receive_messages.insert(jobid, message).is_some() {
|
||||
log::info!("Received duplicate message for jobid {}", jobid);
|
||||
};
|
||||
waker.wake();
|
||||
} else {
|
||||
log::info!("Received message for unknown jobid {}", jobid);
|
||||
if let Some(jobid) = message.header.jobid_target {
|
||||
if let Some(waker) = session.receive_wakers.remove(&jobid) {
|
||||
if session.receive_messages.insert(jobid, message).is_some() {
|
||||
log::info!("Received duplicate message for jobid {}", jobid);
|
||||
};
|
||||
waker.wake();
|
||||
} else {
|
||||
log::info!("Received message for unknown jobid {}", jobid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,6 +258,11 @@ impl CMSession {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_steam_id(&mut self, new_steam_id: u64) {
|
||||
let mut inner = self.inner.lock().expect("Lock was poisoned");
|
||||
inner.steam_id = Some(new_steam_id);
|
||||
}
|
||||
|
||||
pub fn set_client_session_id(&mut self, new_client_session_id: i32) {
|
||||
let mut inner = self.inner.lock().expect("Lock was poisoned");
|
||||
inner.client_session_id = new_client_session_id;
|
||||
|
|
|
@ -9,7 +9,8 @@ use vapore_proto::{
|
|||
CAuthentication_PollAuthSessionStatus_Request,
|
||||
CAuthentication_PollAuthSessionStatus_Response, EAuthTokenPlatformType,
|
||||
},
|
||||
steammessages_clientserver_login::{CMsgClientHello, CMsgClientLogonResponse},
|
||||
steammessages_base::{cmsg_ipaddress, CMsgIPAddress},
|
||||
steammessages_clientserver_login::{CMsgClientHello, CMsgClientLogon, CMsgClientLogonResponse},
|
||||
};
|
||||
|
||||
mod connection;
|
||||
|
@ -70,11 +71,9 @@ pub async fn main() -> eyre::Result<()> {
|
|||
platform_type: Some(protobuf::EnumOrUnknown::new(
|
||||
EAuthTokenPlatformType::k_EAuthTokenPlatformType_SteamClient,
|
||||
)),
|
||||
// Windows 10
|
||||
os_type: Some(16),
|
||||
// Unknown
|
||||
gaming_device_type: Some(1),
|
||||
machine_id: Some(machine_id),
|
||||
// Windows 11
|
||||
os_type: Some(20),
|
||||
machine_id: Some(machine_id.clone()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
|
@ -90,40 +89,70 @@ pub async fn main() -> eyre::Result<()> {
|
|||
code.render::<qrcode::render::unicode::Dense1x2>().build()
|
||||
);
|
||||
|
||||
let cloned_session = session.clone();
|
||||
let poll_task = tokio::spawn(async move {
|
||||
let mut session = cloned_session;
|
||||
let mut interval = tokio::time::interval(tokio::time::Duration::from_secs_f32(
|
||||
response.body.interval(),
|
||||
));
|
||||
let mut interval = tokio::time::interval(tokio::time::Duration::from_secs_f32(
|
||||
response.body.interval(),
|
||||
));
|
||||
|
||||
loop {
|
||||
interval.tick().await;
|
||||
let request = CAuthentication_PollAuthSessionStatus_Request {
|
||||
client_id: response.body.client_id.clone(),
|
||||
request_id: response.body.request_id.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
let response: CMProtoBufMessage<CAuthentication_PollAuthSessionStatus_Response> =
|
||||
session
|
||||
.call_service_method(
|
||||
"Authentication.PollAuthSessionStatus#1".to_string(),
|
||||
request,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let (access_token, account_name) = loop {
|
||||
interval.tick().await;
|
||||
let request = CAuthentication_PollAuthSessionStatus_Request {
|
||||
client_id: response.body.client_id.clone(),
|
||||
request_id: response.body.request_id.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
let response: CMProtoBufMessage<CAuthentication_PollAuthSessionStatus_Response> = session
|
||||
.call_service_method(
|
||||
"Authentication.PollAuthSessionStatus#1".to_string(),
|
||||
request,
|
||||
)
|
||||
.await?;
|
||||
|
||||
log::debug!("Got auth poll status {:#?}", response.body);
|
||||
log::debug!("Got auth poll status {:#?}", response.body);
|
||||
|
||||
if let Some(new_url) = response.body.new_challenge_url {
|
||||
let code = qrcode::QrCode::new(new_url).unwrap();
|
||||
log::info!(
|
||||
"Got new QR code:\n{}",
|
||||
code.render::<qrcode::render::unicode::Dense1x2>().build()
|
||||
)
|
||||
};
|
||||
if let Some(access_token) = response.body.access_token {
|
||||
let account_name = response.body.account_name.unwrap_or_default();
|
||||
break (access_token, account_name);
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(new_url) = response.body.new_challenge_url {
|
||||
let code = qrcode::QrCode::new(new_url)?;
|
||||
log::info!(
|
||||
"Got new QR code:\n{}",
|
||||
code.render::<qrcode::render::unicode::Dense1x2>().build()
|
||||
)
|
||||
};
|
||||
};
|
||||
|
||||
log::debug!(
|
||||
"Got account name {}, access token {}",
|
||||
account_name,
|
||||
access_token
|
||||
);
|
||||
|
||||
// normal user, desktop instance, public universe
|
||||
session.set_steam_id(0x0110_0001_0000_0000);
|
||||
|
||||
session.send_notification(
|
||||
EMsg::k_EMsgClientLogon,
|
||||
CMsgClientLogon {
|
||||
account_name: Some(account_name),
|
||||
access_token: Some(access_token),
|
||||
machine_name: Some("vapore".to_string()),
|
||||
machine_id: Some(machine_id),
|
||||
client_language: Some("english".to_string()),
|
||||
protocol_version: Some(0x1002c),
|
||||
client_os_type: Some(20),
|
||||
client_package_version: Some(1721173382),
|
||||
supports_rate_limit_response: Some(true),
|
||||
should_remember_password: Some(true),
|
||||
obfuscated_private_ip: protobuf::MessageField::some(CMsgIPAddress {
|
||||
ip: Some(cmsg_ipaddress::Ip::V4(0xc8a8_0002 ^ 0xbaad_f00d)),
|
||||
..Default::default()
|
||||
}),
|
||||
deprecated_obfustucated_private_ip: Some(0xc8a8_0002 ^ 0xbaad_f00d),
|
||||
..Default::default()
|
||||
},
|
||||
)?;
|
||||
|
||||
let mut finish_receiver = session.subscribe_message_type(EMsg::k_EMsgClientLogOnResponse);
|
||||
|
||||
|
@ -131,8 +160,6 @@ pub async fn main() -> eyre::Result<()> {
|
|||
let response: CMProtoBufMessage<CMsgClientLogonResponse> =
|
||||
CMProtoBufMessage::deserialize(raw_response)?;
|
||||
|
||||
poll_task.abort();
|
||||
|
||||
log::debug!("Got logon response: {:#x?}", response);
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -28,6 +28,8 @@ impl<T: protobuf::Message> CMProtoBufMessage<T> {
|
|||
self.header.write_to_vec(&mut out)?;
|
||||
self.body.write_to_vec(&mut out)?;
|
||||
|
||||
log::trace!("Serialized message: {}", hex::encode(&out));
|
||||
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue