start migrating to new system
Some checks failed
Build and Test / wii-u-chat (push) Failing after 5m20s
Build and Test / friends (push) Failing after 5m19s
Build and Test / sonic-transformed (push) Failing after 6m27s
Build and Test / splatoon-testfire (push) Failing after 6m28s
Build and Test / super-mario-maker (push) Failing after 6m46s
Build and Test / fast-racing-neo (push) Failing after 6m47s
Build and Test / wii-sports-club (push) Failing after 6m52s
Build and Test / puyopuyo (push) Failing after 6m52s
Build and Test / mario-tennis (push) Failing after 6m57s
Build and Test / splatoon (push) Failing after 7m2s
Build and Test / minecraft-wiiu (push) Failing after 8m6s

This commit is contained in:
Maple Nebel 2026-06-22 23:06:10 +02:00
commit 0f233fd355
6 changed files with 29 additions and 31 deletions

14
Cargo.lock generated
View file

@ -1693,7 +1693,7 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
"socket2 0.6.3",
"socket2 0.5.10",
"tokio",
"tower-service",
"tracing",
@ -2091,9 +2091,9 @@ checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
[[package]]
name = "nex-account"
version = "0.1.3"
version = "0.2.0"
source = "sparse+https://crates.spbr.net/api/v1/crates/"
checksum = "16be02914ed26b15f68fc8c0c11f719ca9796e90be5899523baad8a3bdf0069b"
checksum = "10e60c4ce2c2fd11862b85dd0176e0de57b4e9057b78ee98d9b00c82fa978601"
dependencies = [
"hmac 0.13.0",
"log",
@ -2787,7 +2787,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@ -3595,10 +3595,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.3.4",
"getrandom 0.4.2",
"once_cell",
"rustix",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@ -4237,7 +4237,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]

View file

@ -37,7 +37,7 @@ urlencoding = "2.1.3"
futures = "0.3.32"
async-trait = "0.1.89"
ctor = "1.0.7"
nex-account = { version = "0.1.3", registry = "spbr" }
nex-account = { version = "0.2.0", registry = "spbr" }
tonic = "0.14.6"
[dev-dependencies]

View file

@ -3,6 +3,7 @@ use cfg_if::cfg_if;
use chrono::{Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc};
use hmac::Hmac;
use hmac::Mac;
use md5::digest::generic_array::GenericArray;
use md5::{Digest, Md5};
use rc4::KeyInit;
use rc4::cipher::StreamCipherCoreWrapper;
@ -28,18 +29,6 @@ pub const SESSION_KEY_LENGTH: usize = SessionLengthTy::USIZE;
type Md5Hmac = Hmac<md5::Md5>;
pub fn derive_kerberos_key(pid: PID, nex_key: [u8; 16]) -> [u8; 16] {
let iteration_count = pid % 1024;
let mut key = nex_key;
for _ in 0..iteration_count {
let mut md5 = Md5::new();
md5.update(key);
key = md5.finalize().try_into().unwrap();
}
key
}
#[derive(Pod, Zeroable, Copy, Clone, Debug, Eq, PartialEq)]
#[repr(transparent)]
pub struct KerberosDateTime(pub u64);

View file

@ -12,7 +12,7 @@ pub struct Account {
impl Account {
pub fn new(pid: PID, username: &str, passwd: &str) -> Self {
let iteration_count = 65000;
let iteration_count = 65000 + pid % 1024;
// we do one iteration out here to ensure the key is always 16 bytes
let mut key: [u8; 16] = {

View file

@ -5,7 +5,7 @@ use cfg_if::cfg_if;
use log::{info, warn};
use macros::rmc_struct;
use rnex_core::PID;
use rnex_core::kerberos::{KerberosDateTime, Ticket, derive_kerberos_key};
use rnex_core::kerberos::{KerberosDateTime, Ticket};
use rnex_core::nex::account::Account;
use rnex_core::rmc::protocols::OnlyRemote;
use rnex_core::rmc::protocols::auth::{Auth, RawAuth, RawAuthInfo, RemoteAuth};
@ -37,8 +37,8 @@ pub fn generate_ticket(
source_act_login_data: (PID, [u8; 16]),
dest_act_login_data: (PID, [u8; 16]),
) -> Box<[u8]> {
let source_key = derive_kerberos_key(source_act_login_data.0, source_act_login_data.1);
let dest_key = derive_kerberos_key(dest_act_login_data.0, dest_act_login_data.1);
let source_key = source_act_login_data.1;
let dest_key = dest_act_login_data.1;
let internal_data = kerberos::TicketInternalData::new(source_act_login_data.0);
@ -58,7 +58,7 @@ pub fn generate_ticket_with_string_user_key(
let source_key: [u8; 8] = rand::random();
let key_string = hex::encode(source_key);
let key_data: [u8; 16] = key_string.as_bytes().try_into().unwrap();
let dest_key = derive_kerberos_key(dest_act_login_data.0, dest_act_login_data.1);
let dest_key = dest_act_login_data.1;
let internal_data = kerberos::TicketInternalData::new(source_act);

View file

@ -1,14 +1,17 @@
use std::env;
use std::io::{Cursor, Write};
use std::ops::Deref;
use std::sync::{LazyLock, Weak};
use std::sync::{Arc, atomic::AtomicU32};
use std::sync::{LazyLock, Weak};
use bytemuck::bytes_of;
use hmac::Mac;
use log::info;
use macros::rmc_struct;
use rnex_core::rmc::protocols::account_management::{AccountExtraInfo, AccountManagement, RawAccountManagement, RawAccountManagementInfo, RemoteAccountManagement};
use rnex_core::rmc::protocols::account_management::{
AccountExtraInfo, AccountManagement, RawAccountManagement, RawAccountManagementInfo,
RemoteAccountManagement,
};
use rnex_core::rmc::protocols::friends_wiiu::{
FriendsWiiU, RawFriendsWiiU, RawFriendsWiiUInfo, RemoteFriendsWiiU,
};
@ -49,8 +52,8 @@ use rnex_core::rmc::structures::data::Data;
use crate::executables::common::get_db;
use nex_account::derive_pid_hmac;
use nex_account::grpc::nex_account_service_client::NexAccountServiceClient;
use nex_account::grpc::ActCreateInfoNoPid;
use nex_account::grpc::nex_account_service_client::NexAccountServiceClient;
define_rmc_proto!(
proto FriendsUser{
@ -293,6 +296,8 @@ impl AccountManagement for FriendsGuest {
email: String,
auth_data: Any,
) -> Result<(PID, String), ErrorCode> {
todo("fix breaking changes in the code below")
/*
println!("{}, {}, {}, {}", principal_name, key, groups, email);
if let Ok(data) = auth_data.try_get_as::<NintendoCreateAccountData>() {
@ -328,11 +333,15 @@ impl AccountManagement for FriendsGuest {
let new_account: ActCreateInfoNoPid = ActCreateInfoNoPid {
principal_name,
key: nexkey.into(),
email,
};
let pid = client.create_new_sequential_or_update_and_get_account(new_account).await.map_err(|_| ErrorCode::Core_Unknown)?.into_inner();
let pid = client
.create_new_sequential_or_update_and_get_account(new_account)
.await
.map_err(|_| ErrorCode::Core_Unknown)?
.into_inner();
let mac = derive_pid_hmac(pid.pid, &nexkey);
@ -341,6 +350,6 @@ impl AccountManagement for FriendsGuest {
return Ok((pid.pid, hex_str));
}
Err(ErrorCode::Authentication_InvalidParam)
Err(ErrorCode::Authentication_InvalidParam)*/
}
}