Skip to content
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
AkiaCode committed Apr 19, 2021
1 parent 61690a7 commit 8ff4688
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Cargo.toml
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"] }
12 changes: 11 additions & 1 deletion README.md
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);
}
```
49 changes: 49 additions & 0 deletions src/lib.rs
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();
}

0 comments on commit 8ff4688

Please sign in to comment.