use clap::{Arg, Command};
use indicatif::{ProgressBar, ProgressStyle};
use itertools::Itertools;
use prettytable::{row, Table};
use rayon::prelude::;
use reqwest::blocking::Client;
use colored::;
use reqwest::StatusCode;
use retry::{delay::Exponential, retry};
use serde::Serialize;
use std::collections::HashSet;
use std::error::Error;
use std::fs;
use std::io::{self, BufRead};
use std::path::Path;
use std::time::Duration;
use thiserror::Error;
use rand::{thread_rng, Rng};
use rand::distributions::Alphanumeric;
use tracing::{debug, error, info};
use tracing_subscriber::fmt::format::FmtSpan;
// Parse command-line arguments
let matches = Command::new("Roblox Channel Checker")
.version("1.0")
.author("Your Name <youremail@example.com>")
.about("Checks for valid Roblox channels based on wordlist combinations")
.arg(
Arg::new("input")
.short('i')
.long("input")
.value_name("FILE")
.help("Sets a custom input wordlist file"),
)
.arg(
Arg::new("output")
.short('o')
.long("output")
.value_name("FILE")
.help("Sets an output file to save results in JSON format"),
)
.arg(
Arg::new("concurrency")
.short('c')
.long("concurrency")
.value_name("NUMBER")
.help("Sets the level of concurrency for HTTP requests")
.default_value("8"),
)
.arg(
Arg::new("timeout")
.short('t')
.long("timeout")
.value_name("SECONDS")
.help("Sets the timeout for HTTP requests in seconds")
.default_value("10"),
)
.arg(
Arg::new("verbose")
.short('v')
.help("Increases verbosity level"),
)
.arg(
Arg::new("prefixes")
.short('p')
.long("prefixes")
.value_name("PREFIXES")
.help("Comma-separated list of prefixes to add to words"),
)
.arg(
Arg::new("suffixes")
.short('s')
.long("suffixes")
.value_name("SUFFIXES")
.help("Comma-separated list of suffixes to add to words"),
)
.arg(
Arg::new("random-strings")
.short('r')
.long("random-strings")
.value_name("NUMBER")
.help("Number of random alphanumeric strings to generate and add to the wordlist"),
)
.get_matches();
// Read wordlist from file or stdin
let wordlist = if let Some(input_path) = matches.get_one::<String>("input") {
read_wordlist_from_file(input_path)?
} else {
info!("Reading wordlist from stdin. Enter words followed by Enter. Press Ctrl+D (Unix) or Ctrl+Z (Windows) to finish:");
read_wordlist_from_stdin()?
};
// Deduplicate wordlist
let mut unique_wordlist: Vec<String> = wordlist.into_iter().unique().collect();
unique_wordlist.sort();
// Wordlist Augmentation
if let Some(prefixes_str) = matches.get_one::<String>("prefixes") {
let prefixes: Vec<&str> = prefixes_str.split(',').collect();
augment_wordlist_with_prefixes(&mut unique_wordlist, &prefixes);
}
if let Some(suffixes_str) = matches.get_one::<String>("suffixes") {
let suffixes: Vec<&str> = suffixes_str.split(',').collect();
augment_wordlist_with_suffixes(&mut unique_wordlist, &suffixes);
}
if let Some(num_random_str) = matches.get_one::<String>("random-strings") {
let num_random: usize = num_random_str.parse().unwrap_or(0);
augment_wordlist_with_random_strings(&mut unique_wordlist, num_random);
}
if unique_wordlist.is_empty() {
error!("Wordlist is empty. Please provide at least one word.");
return Ok(());
}
info!("Generating combinations...");
let combinations = generate_combinations(&unique_wordlist);
info!("Total combinations generated: {}", combinations.len());
// Configure HTTP client
let timeout = matches
.get_one::<String>("timeout")
.unwrap()
.parse::<u64>()
.unwrap_or(10);
let client = Client::builder()
.timeout(Duration::from_secs(timeout))
.build()?;
// Setup progress bar
let pb = ProgressBar::new(combinations.len() as u64);
pb.set_style(
ProgressStyle::default_bar()
.template("{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({eta})")
.unwrap()
.progress_chars("#>-"),
);
let concurrency = matches
.get_one::<String>("concurrency")
.unwrap()
.parse::<usize>()
.unwrap_or(8);
rayon::ThreadPoolBuilder::new()
.num_threads(concurrency)
.build_global()
.unwrap();
info!("Starting channel checks with concurrency level: {}", concurrency);
// Process combinations in parallel
let results: Vec<ChannelInfo> = combinations
.par_iter()
.map(|combination| {
let result = check_channel(&client, combination);
pb.inc(1);
result
})
.filter_map(|res| res)
.collect();
pb.finish_with_message("Channel checks completed.");
// Display results in table format
if results.is_empty() {
info!("No valid channels found.");
} else {
let mut table = Table::new();
table.add_row(row![
"Channel",
"Roblox.exe",
"DeployHistory.txt",
"Mac DeployHistory.txt",
"ClientSettings",
]);
for info in &results {
table.add_row(row![
info.colored_channel,
info.roblox_exe,
info.deploy_history,
info.mac_deploy_history,
info.client_settings,
]);
}
table.printstd();
}
code
// Save results to file if output path is provided
if let Some(output_path) = matches.get_one::<String>("output") {
info!("Saving results to {}", output_path);
save_results_to_file(&results, output_path)?;
}
Ok(())
}
// Reads wordlist from a file
fn read_wordlist_from_file<P: AsRef>(path: P) -> Result<Vec, AppError> {
info!("Reading wordlist from file: {:?}", path.as_ref());
let file = fs::File::open(path)?;
let reader = io::BufReader::new(file);
let wordlist = reader
.lines()
.filter_map(Result::ok)
.filter(|line| !line.trim().is_empty())
.collect();
Ok(wordlist)
}
// Reads wordlist from standard input
fn read_wordlist_from_stdin() -> Result<Vec, AppError> {
let stdin = io::stdin();
let wordlist = stdin
.lock()
.lines()
.filter_map(Result::ok)
.filter(|line| !line.trim().is_empty())
.collect();
Ok(wordlist)
}
// Generates combinations of words
fn generate_combinations(wordlist: &[String]) -> HashSet {
let mut combinations = HashSet::new();
let max_combination_length = 3; // Adjust as needed
code
for length in 1..=max_combination_length {
for combo in wordlist.iter().permutations(length) {
let concatenated = combo.into_iter().join("");
combinations.insert(concatenated);
}
}
combinations
}
// Augments the wordlist with prefixes
fn augment_wordlist_with_prefixes(wordlist: &mut Vec, prefixes: &[&str]) {
let mut new_words = Vec::new();
for prefix in prefixes {
for word in wordlist.iter() {
new_words.push(format!("{}{}", prefix, word));
}
}
wordlist.append(&mut new_words);
}
// Augments the wordlist with suffixes
fn augment_wordlist_with_suffixes(wordlist: &mut Vec, suffixes: &[&str]) {
let mut new_words = Vec::new();
for suffix in suffixes {
for word in wordlist.iter() {
new_words.push(format!("{}{}", word, suffix));
}
}
wordlist.append(&mut new_words);
}
// Augments the wordlist with random strings
fn augment_wordlist_with_random_strings(wordlist: &mut Vec, num_strings: usize) {
let rng = thread_rng();
for _ in 0..num_strings {
let random_string: String = rng
.clone()
.sample_iter(&Alphanumeric)
.take(8) // Adjust the length of random strings as needed
.map(char::from)
.collect();
wordlist.push(random_string);
}
}
// Checks a single channel and returns ChannelInfo if valid
fn check_channel(client: &Client, channel_name: &str) -> Option {
let base_url = format!("http://setup.rbxcdn.com/channel/z{}", channel_name);
let endpoints = [
("Roblox.exe", format!("{}/Roblox.exe", base_url)),
("DeployHistory.txt", format!("{}/DeployHistory.txt", base_url)),
(
"Mac DeployHistory.txt",
format!("{}/mac/DeployHistory.txt", base_url),
),
(
"ClientSettings",
format!(
"http://clientsettings.roblox.com/v2/settings/application/RCCBootstrapper/bucket/z{}",
channel_name
),
),
];
code
let mut results = vec![];
for (name, url) in &endpoints {
let result = retry(Exponential::from_millis(500).take(3), || {
debug!("Checking {} at {}", name, url);
match client.get(url).send() {
// Use GET instead of HEAD to get the response body
Ok(response) => {
if response.status() == StatusCode::OK {
if *name == "ClientSettings" {
// Check ClientSettings response body
let body = response.text().unwrap_or_default();
Ok(!body.contains(r#"{"applicationSettings":null}"#)) // Valid if not null
} else {
Ok(true) // Other endpoints are valid if status is OK
}
} else {
Ok(false)
}
}
Err(e) => {
error!("Error checking {}: {}", url, e);
Err(e)
}
}
})
.unwrap_or(false);
results.push(result);
}
if results[0] {
Some(ChannelInfo {
colored_channel: color_code_channel(channel_name),
original_channel: channel_name.to_string(),
roblox_exe: results[0],
deploy_history: results[1],
mac_deploy_history: results[2],
client_settings: results[3],
})
} else {
None
}
To massively improve the UI/UX of your Roblox Channel Checker, we'll transform it from a command-line application into a web-based application using the Actix-web framework. This will allow users to interact with the tool through a web browser, providing a more intuitive and accessible interface.
Overview of Changes:
Transition to a Web Application: Utilize Actix-web to handle HTTP requests and serve web pages.
Create an Interactive Frontend: Build a user-friendly interface with HTML, CSS, and JavaScript for inputting data and displaying results.
Implement Asynchronous Processing: Leverage Rust's async capabilities for efficient handling of concurrent tasks.
Enhance User Feedback: Provide real-time progress updates and error handling in the UI.
Reorganize Codebase: Refactor the existing code to fit the web application architecture.
Step-by-Step Transformation:
1. Setting Up Actix-web:
Add the necessary dependencies to your Cargo.toml:
toml
[dependencies]
actix-web = "4"
actix-multipart = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }
itertools = "0.10"
reqwest = { version = "0.11", features = ["json", "stream"] }
futures = "0.3"
rand = "0.8"
thiserror = "1.0"
2. Restructuring the Application:
We'll reorganize the code into modules for better maintainability:
main.rs: Starts the Actix-web server.
routes.rs: Defines HTTP routes and handlers.
handlers.rs: Contains functions to process requests.
processing.rs: Contains the logic for wordlist processing and channel checking.
models.rs: Defines data structures.
templates/: Stores HTML templates.
static/: Stores CSS and JavaScript files.
3. Writing the Server (main.rs):
rust
use actix_web::{App, HttpServer};
mod routes;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
println!("Starting server at http://127.0.0.1:8080");
HttpServer::new(|| {
App::new()
.configure(routes::init)
.service(actix_files::Files::new("/static", "./static"))
})
.bind("127.0.0.1:8080")?
.run()
.await
}
4. Defining Routes (routes.rs):
rust
use actix_web::web;
use crate::handlers;
pub fn init(cfg: &mut web::ServiceConfig) {
cfg.service(
web::resource("/")
.route(web::get().to(handlers::index))
)
.service(
web::resource("/process")
.route(web::post().to(handlers::process))
);
}
5. Implementing Handlers (handlers.rs):
rust
use actix_web::{HttpResponse, Result, web};
use serde::Deserialize;
use crate::processing::process_wordlist;
use crate::models::FormData;
pub async fn index() -> Result<HttpResponse> {
let contents = std::fs::read_to_string("templates/index.html")?;
Ok(HttpResponse::Ok().content_type("text/html").body(contents))
}
pub async fn process(form: web::Form<FormData>) -> Result<HttpResponse> {
// Process the form data
let results = process_wordlist(form.into_inner()).await;
// Return results as JSON
Ok(HttpResponse::Ok().json(results))
}
Accessibility: Users can access the application through a web browser without needing to install Rust or any dependencies.
Interactivity: A graphical interface makes it easier to input data and understand outputs.
Real-Time Feedback: Users receive immediate feedback through progress indicators and dynamic content updates.
Improved Error Handling: Validation and error messages are presented in a user-friendly manner.
Enhanced Visualization: Results are displayed in a structured table format, improving readability.
Running the Application:
Install Dependencies:
Ensure you have Rust and Cargo installed.
Run the Server:
bash
cargo run
Access the Application:
Open your browser and navigate to http://127.0.0.1:8080.
Additional Enhancements:
File Upload: Allow users to upload a wordlist file.
Download Results: Provide an option to download results as a JSON or CSV file.
Responsive Design: Make the UI mobile-friendly.
Live Updates: Utilize WebSockets for real-time progress updates.
Search and Filter: Enable searching and filtering in the results table.
By transforming your application into a web-based tool, we've massively improved the UI/UX, making it more accessible and user-friendly for a broader audience.
Let me know if you need further assistance or additional features added to the application!