This repository has been archived by the owner on Sep 24, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "goodbye_kt" | ||
version = "0.1.0" | ||
authors = ["Akiacode <[email protected]>"] | ||
edition = "2018" | ||
documentation = "https://docs.rs/goodbye_kt" | ||
repository = "https://github.com/AkiaCode/GoodbyeKT" | ||
license = "MIT" | ||
description = "Rust library that can be reset if you think it's slow" | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
reqwest = { version = "0.11.3", features = ["blocking"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# goodbye_kt | ||
# GoodbyeKT | ||
Rust library that can be reset if you think it's slow | ||
|
||
|
||
### Example | ||
```rust | ||
fn main() { | ||
let status = goodbye_kt::reset(); | ||
|
||
println!("{}", status); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use std::collections::HashMap; | ||
use reqwest::Url; | ||
use reqwest::{header::USER_AGENT}; | ||
|
||
pub fn find_url() -> (String, String, String, String) { | ||
let client = reqwest::blocking::Client::new(); | ||
let request = client.get("http://access.olleh.com") | ||
.header(USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36") | ||
.send().unwrap(); | ||
|
||
let url = request.url(); | ||
|
||
let scheme = url.scheme().to_string(); | ||
let host = url.host().unwrap().to_string(); | ||
let port = url.port().unwrap().to_string(); | ||
let query = url.query().unwrap().to_string(); | ||
|
||
return (scheme, host, port, query); | ||
} | ||
|
||
pub fn enter_admin_url(data: (String, String, String, String)) -> String { | ||
format!("{}://{}:{}/enterAdminId.html?{}", data.0, data.1, data.2, data.3) | ||
} | ||
|
||
pub fn admin_url(data: (String, String, String, String)) -> String { | ||
format!("{}://{}:{}/reauth_said.html", data.0, data.1, data.2) | ||
} | ||
|
||
pub fn reset() -> String { | ||
let find_url = find_url(); | ||
|
||
let url = Url::parse(&enter_admin_url(find_url.clone())).unwrap(); | ||
let query: HashMap<String, String> = url.query_pairs().into_owned().collect(); | ||
|
||
let mut form = HashMap::new(); | ||
form.insert("userID", "reset"); | ||
form.insert("userPW", "reset1"); | ||
form.insert("sso", query.get("sso").unwrap()); | ||
form.insert("no", query.get("no").unwrap()); | ||
|
||
let client = reqwest::blocking::Client::new(); | ||
let response = client.post(admin_url(find_url.clone())) | ||
.header(USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36") | ||
.header("Referer", enter_admin_url(find_url)) | ||
.form(&form) | ||
.send().unwrap(); | ||
|
||
return response.status().to_string(); | ||
} |