feat: add RSA patch for AccountRSAKey
This commit is contained in:
26
hkrpg/src/modules/crypto.rs
Normal file
26
hkrpg/src/modules/crypto.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use crate::{
|
||||
addr::{GAME_ASSEMBLY_BASE, rva_config},
|
||||
il2cpp_string::Il2cppString,
|
||||
};
|
||||
|
||||
use super::{HkrpgModule, HkrpgModuleContext};
|
||||
|
||||
pub struct Crypto;
|
||||
|
||||
const ACCOUNT_RSA_KEY_REPLACEMENT: &str = include_str!("../../sdk_public_key.xml");
|
||||
|
||||
impl HkrpgModule for HkrpgModuleContext<Crypto> {
|
||||
unsafe fn init(&mut self) -> Result<(), ilhook::HookError> {
|
||||
let config = rva_config();
|
||||
if config.sdk_public_key != 0 {
|
||||
unsafe {
|
||||
*(GAME_ASSEMBLY_BASE.wrapping_add(config.sdk_public_key) as *mut Il2cppString) =
|
||||
Il2cppString::new(ACCOUNT_RSA_KEY_REPLACEMENT)
|
||||
}
|
||||
println!("[crypto::init] AccountRSAKey replaced")
|
||||
} else {
|
||||
println!("[crypto::init] pattern is outdated! disabling AccountRSAKey replacement")
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ impl HkrpgModule for HkrpgModuleContext<HkCheck> {
|
||||
self.base.wrapping_add(config.hk_check2),
|
||||
HkCheck::replacement,
|
||||
)?;
|
||||
println!("[hk_check::init] hk_check bypassed")
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::marker::PhantomData;
|
||||
use crate::{addr, interceptor::Interceptor};
|
||||
|
||||
pub mod censorship_patch;
|
||||
pub mod crypto;
|
||||
pub mod hk_check;
|
||||
pub mod network;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ impl HkrpgModule for HkrpgModuleContext<Network> {
|
||||
self.base.wrapping_add(config.make_initial_url),
|
||||
Network::on_make_initial_url,
|
||||
)?;
|
||||
println!("[network::init] network patch enabled")
|
||||
} else {
|
||||
println!("[network::init] pattern is outdated! disabling http redirection")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user