mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-28 09:27:45 +00:00
Dump unknown packets when encountered
This commit is contained in:
parent
b5afff068a
commit
5f0d6cc425
4 changed files with 11 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
/target
|
/target
|
||||||
.idea/
|
.idea/
|
||||||
config.json
|
config.json
|
||||||
|
packet.bin
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use kawari::packet::parse_packet;
|
||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ async fn main() {
|
||||||
.await
|
.await
|
||||||
.expect("Failed to read data!");
|
.expect("Failed to read data!");
|
||||||
|
|
||||||
println!("Recieved data: {:#?}", &buf[..n]);
|
parse_packet(&buf[..n]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ use rand::distributions::Alphanumeric;
|
||||||
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod patchlist;
|
pub mod patchlist;
|
||||||
|
pub mod packet;
|
||||||
|
|
||||||
pub fn generate_sid() -> String {
|
pub fn generate_sid() -> String {
|
||||||
let random_id: String = rand::thread_rng()
|
let random_id: String = rand::thread_rng()
|
||||||
|
|
6
src/packet.rs
Normal file
6
src/packet.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use std::fs::write;
|
||||||
|
|
||||||
|
pub fn parse_packet(data: &[u8]) {
|
||||||
|
write("packet.bin", data);
|
||||||
|
panic!("Unknown packet! Dumping to packet.bin.");
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue