Files
benilla-octo/crates/benilla-protocol/examples/make_account.rs
T
SamandClaude Opus 5.5 8d9f007415 comments: protocol, the auth code, the live probes and their examples
1,071 comment lines become 573; the code is unchanged. The world
probe's field docs are its --help text, so the help is shorter now and
matches what each flag runs: --quest takes quest 783 from Willem to
McBride, --quest-item needs the starter item to survive, --giverstatus
queries once, --spells makes three casts. Also corrected:
- the aura-duration packet has a SessionEvent;
- the SRP xor hash is SHA1(N) XOR SHA1(g), not a hash of it;
- the cooldown probe picks Tri, else the first character.

benilla sending a stored integrity hash instead of hashing the install
is now marked as a deviation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 20:09:30 +07:00

35 lines
1.2 KiB
Rust

//! Dev helper: prints the SQL that creates a vmangos account, with the SRP6 verifier and salt
//! from `benilla-srp`. vmangos stores `v` and `s` as big-endian hex; we compute little-endian.
//!
//! ```text
//! cargo run -p benilla-protocol --example make_account -- <user> <pass> \
//! | docker exec -i <db-container> mariadb -uroot -ppassword realmd
//! ```
use benilla_srp::NormalizedString;
fn big_endian_hex(little_endian_bytes: &[u8]) -> String {
little_endian_bytes
.iter()
.rev()
.map(|b| format!("{b:02X}"))
.collect()
}
fn main() {
let args: Vec<String> = std::env::args().collect();
let user = args.get(1).expect("usage: make_account <user> <pass>");
let pass = args.get(2).expect("usage: make_account <user> <pass>");
let username = NormalizedString::new(user).expect("invalid username");
let password = NormalizedString::new(pass).expect("invalid password");
let (salt, verifier) = benilla_srp::generate_account(&username, &password);
println!(
"INSERT INTO account (username, v, s, gmlevel, expansion) VALUES ('{}', '{}', '{}', 3, 0);",
user.to_uppercase(),
big_endian_hex(&verifier),
big_endian_hex(&salt),
);
}