mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-02 11:07:45 +00:00
Add an option to enable packet obsfucation for the World server
There's no point in doing this yet: 1. This *crashes* the client, nice. Most likely because we're not actually obsfucating anything, only tricking the client into thinking we were. Why this can crash the client is beyond me? 2. Obsfucation is still optional.
This commit is contained in:
parent
d94c3a8e03
commit
614e470669
4 changed files with 23 additions and 1 deletions
|
@ -204,6 +204,9 @@ pub struct WorldConfig {
|
||||||
/// Password of the RCON server, if left blank (the default) RCON is disabled.
|
/// Password of the RCON server, if left blank (the default) RCON is disabled.
|
||||||
#[serde(default = "WorldConfig::default_rcon_password")]
|
#[serde(default = "WorldConfig::default_rcon_password")]
|
||||||
pub rcon_password: String,
|
pub rcon_password: String,
|
||||||
|
/// Enable packet obsfucation. There's literally no reason to do this!
|
||||||
|
#[serde(default = "WorldConfig::default_packet_obsfucation")]
|
||||||
|
pub enable_packet_obsfucation: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for WorldConfig {
|
impl Default for WorldConfig {
|
||||||
|
@ -215,6 +218,7 @@ impl Default for WorldConfig {
|
||||||
scripts_location: Self::default_scripts_location(),
|
scripts_location: Self::default_scripts_location(),
|
||||||
rcon_port: Self::default_rcon_port(),
|
rcon_port: Self::default_rcon_port(),
|
||||||
rcon_password: Self::default_rcon_password(),
|
rcon_password: Self::default_rcon_password(),
|
||||||
|
enable_packet_obsfucation: Self::default_packet_obsfucation(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,6 +247,10 @@ impl WorldConfig {
|
||||||
fn default_rcon_password() -> String {
|
fn default_rcon_password() -> String {
|
||||||
String::default()
|
String::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_packet_obsfucation() -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WorldConfig {
|
impl WorldConfig {
|
||||||
|
|
|
@ -59,3 +59,6 @@ const SUPPORTED_EXPAC_VERSIONS: [(&str, Version); 5] = [
|
||||||
pub fn get_supported_expac_versions() -> HashMap<&'static str, Version<'static>> {
|
pub fn get_supported_expac_versions() -> HashMap<&'static str, Version<'static>> {
|
||||||
HashMap::from(SUPPORTED_EXPAC_VERSIONS)
|
HashMap::from(SUPPORTED_EXPAC_VERSIONS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Constant to enable packet obsfucation. Changes every patch.
|
||||||
|
pub const OBFUSCATION_ENABLED_MODE: u8 = 41;
|
||||||
|
|
|
@ -9,7 +9,9 @@ use std::{
|
||||||
use tokio::{net::TcpStream, sync::mpsc::Sender};
|
use tokio::{net::TcpStream, sync::mpsc::Sender};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
OBFUSCATION_ENABLED_MODE,
|
||||||
common::{GameData, ObjectId, Position, timestamp_secs},
|
common::{GameData, ObjectId, Position, timestamp_secs},
|
||||||
|
config::get_config,
|
||||||
opcodes::ServerZoneIpcType,
|
opcodes::ServerZoneIpcType,
|
||||||
packet::{
|
packet::{
|
||||||
CompressionType, ConnectionType, PacketSegment, PacketState, SegmentType, parse_packet,
|
CompressionType, ConnectionType, PacketSegment, PacketState, SegmentType, parse_packet,
|
||||||
|
@ -433,6 +435,8 @@ impl ZoneConnection {
|
||||||
|
|
||||||
// Init Zone
|
// Init Zone
|
||||||
{
|
{
|
||||||
|
let config = get_config();
|
||||||
|
|
||||||
let ipc = ServerZoneIpcSegment {
|
let ipc = ServerZoneIpcSegment {
|
||||||
op_code: ServerZoneIpcType::InitZone,
|
op_code: ServerZoneIpcType::InitZone,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
|
@ -440,6 +444,11 @@ impl ZoneConnection {
|
||||||
server_id: 0,
|
server_id: 0,
|
||||||
zone_id: self.zone.as_ref().unwrap().id,
|
zone_id: self.zone.as_ref().unwrap().id,
|
||||||
weather_id: 1,
|
weather_id: 1,
|
||||||
|
obsfucation_mode: if config.world.enable_packet_obsfucation {
|
||||||
|
OBFUSCATION_ENABLED_MODE
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -14,7 +14,9 @@ pub struct InitZone {
|
||||||
pub weather_id: u16, // index into Weather sheet probably?
|
pub weather_id: u16, // index into Weather sheet probably?
|
||||||
pub unk_really: u16,
|
pub unk_really: u16,
|
||||||
pub unk_bitmask1: u8,
|
pub unk_bitmask1: u8,
|
||||||
pub unk_bitmask2: u8,
|
/// Zero means "no obsfucation" (not really, but functionally yes.)
|
||||||
|
/// To enable obsfucation, you need to set this to a constant that changes every patch. See lib.rs for the constant.
|
||||||
|
pub obsfucation_mode: u8,
|
||||||
pub unk1: u8,
|
pub unk1: u8,
|
||||||
pub unk2: u32,
|
pub unk2: u32,
|
||||||
pub festival_id: u16,
|
pub festival_id: u16,
|
||||||
|
|
Loading…
Add table
Reference in a new issue