diff --git a/Cargo.lock b/Cargo.lock
index 2d67ff7..a2349be 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -219,6 +219,17 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "getrandom"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
[[package]]
name = "gimli"
version = "0.28.1"
@@ -323,6 +334,7 @@ name = "kawari"
version = "0.1.0"
dependencies = [
"axum",
+ "rand",
"serde",
"serde_json",
"tokio",
@@ -443,6 +455,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "ppv-lite86"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
+
[[package]]
name = "proc-macro2"
version = "1.0.82"
@@ -461,6 +479,36 @@ dependencies = [
"proc-macro2",
]
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom",
+]
+
[[package]]
name = "rustc-demangle"
version = "0.1.24"
diff --git a/Cargo.toml b/Cargo.toml
index e525c41..87cfe10 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,4 +28,5 @@ serde_json = { version = "1.0", default-features = false }
tokio = { version = "1.37", features = ["macros", "rt", "rt-multi-thread"], default-features = false }
tracing = { version = "0.1", default-features = false }
serde = { version = "1.0", features = ["derive"], default-features = false }
-tracing-subscriber = { version = "0.3", features = ["fmt"], default-features = false }
\ No newline at end of file
+tracing-subscriber = { version = "0.3", features = ["fmt"], default-features = false }
+rand = "0.8"
\ No newline at end of file
diff --git a/src/bin/kawari-login.rs b/src/bin/kawari-login.rs
index cbc6f16..f8de4e2 100644
--- a/src/bin/kawari-login.rs
+++ b/src/bin/kawari-login.rs
@@ -4,6 +4,8 @@ use axum::{Form, Json, Router, routing::get};
use axum::extract::Query;
use axum::response::Html;
use axum::routing::post;
+use rand::distributions::Alphanumeric;
+use rand::{random, Rng};
use serde::{Deserialize, Serialize};
use kawari::config::Config;
@@ -30,8 +32,15 @@ struct Input {
otppw: String
}
-async fn login_send(Form(input): Form) -> Html<&'static str> {
- Html("window.external.user(\"login=auth,ok,sid,5b1548e2aa30bb9ef4cc9a4a690eb900cf0c801332149eeb227df7f8,terms,1,region,2,etmadd,0,playable,1,ps3pkg,0,maxex,4,product,1\");")
+async fn login_send(Form(input): Form) -> Html {
+ let random_id: String = rand::thread_rng()
+ .sample_iter(&Alphanumeric)
+ .take(56)
+ .map(char::from)
+ .collect();
+ let sid = random_id.to_lowercase();
+
+ Html(format!("window.external.user(\"login=auth,ok,sid,{sid},terms,1,region,2,etmadd,0,playable,1,ps3pkg,0,maxex,4,product,1\");"))
}
#[tokio::main]