|
| 1 | +use walkdir::WalkDir; |
| 2 | +use rayon::prelude::*; |
| 3 | +use colored::*; |
| 4 | +use std::{fs, io, path::{Path, PathBuf}, time::Instant}; |
| 5 | + |
| 6 | +const HEADER_PART_1: &str = r#" |
| 7 | + _ __ __ __ ______ |
| 8 | + / | / /_ ___ __/ /_ / / / / _/ |
| 9 | + / |/ / / / / |/_/ __/ / / / // / |
| 10 | + / /| / /_/ /> </ /_ / /_/ // / |
| 11 | +/_/ |_/\__,_/_/|_|\__/ \____/___/ |
| 12 | +"#; |
| 13 | + |
| 14 | +const HEADER_PART_2: &str = r#" |
| 15 | + ____ ____ |
| 16 | + / __ \_________ / __ )__ ______ ____ ___________ |
| 17 | + / /_/ / ___/ __ \ / __ / / / / __ \/ __ `/ ___/ ___/ |
| 18 | + / ____/ / / /_/ / / /_/ / /_/ / /_/ / /_/ (__ |__ ) |
| 19 | +/_/ /_/ \____/ /_____/\__, / .___/\__,_/____/____/ |
| 20 | + /____/_/ |
| 21 | +"#; |
| 22 | + |
| 23 | +const VERIFY_URL: &str = "https://api.nuxtlabs.com/ui-pro/verify"; |
| 24 | +const BYPASS_URL: &str = "https://httpbin.org/status/200"; |
| 25 | +const TARGET: &str = "node_modules/@nuxt"; |
| 26 | + |
| 27 | +fn main() -> io::Result<()> { |
| 28 | + control::set_override(true); |
| 29 | + |
| 30 | + let start = Instant::now(); |
| 31 | + |
| 32 | + print!("{}", HEADER_PART_1.bright_blue()); |
| 33 | + println!("{}", HEADER_PART_2.bright_green()); |
| 34 | + println!("{} {}", "[i]".bright_yellow(), "This script is intended only for showing the problem".bright_black()); |
| 35 | + println!("{} {}", "[!]".bright_red(), "Never use it in production it is illegal xd!!!)".bright_black()); |
| 36 | + println!("{} {}", "[@]".bright_cyan(), "By qweme32 ( https://github.com/qweme32 )".bright_black()); |
| 37 | + |
| 38 | + let root = Path::new(TARGET); |
| 39 | + |
| 40 | + if !root.exists() || !root.is_dir() { |
| 41 | + println!("{} {}", "[X]".bright_red(), format!("Dir {} does not exist or is not accessible.", TARGET)); |
| 42 | + |
| 43 | + return Ok(()); |
| 44 | + } |
| 45 | + |
| 46 | + println!("{} {} {}", "[?]", "Scanning dir:".bright_black(), TARGET.bright_black()); |
| 47 | + |
| 48 | + // Collect paths |
| 49 | + let paths: Vec<PathBuf> = WalkDir::new(&root) |
| 50 | + .into_iter() |
| 51 | + .filter_map(Result::ok) |
| 52 | + .filter(|entry| { |
| 53 | + entry.file_type().is_file() |
| 54 | + && matches!( |
| 55 | + entry.path().extension().and_then(|e| e.to_str()), |
| 56 | + Some("js") | Some("mjs") | Some("ts") | Some("mts") |
| 57 | + ) |
| 58 | + }) |
| 59 | + .filter(|entry| { |
| 60 | + fs::read_to_string(entry.path()) |
| 61 | + .map(|content| content.contains(VERIFY_URL)) |
| 62 | + .unwrap_or(false) |
| 63 | + }) |
| 64 | + .map(|entry| entry.into_path()) |
| 65 | + .collect(); |
| 66 | + |
| 67 | + // Zero paths check |
| 68 | + if paths.len() == 0 { |
| 69 | + println!("{} {}", "[X]".bright_red(), "It looks like you have already bypassed the check or the script is outdated"); |
| 70 | + return Ok(()); |
| 71 | + } |
| 72 | + |
| 73 | + // Rewrite for bypass |
| 74 | + paths.par_iter().for_each(|path| { |
| 75 | + match fs::read_to_string(path) { |
| 76 | + Ok(content) => { |
| 77 | + let new_content = content.replace(VERIFY_URL, BYPASS_URL); |
| 78 | + match fs::write(path, new_content) { |
| 79 | + Ok(_) => println!("{} {} {}", "[+]".green(), "Bypassed", path.as_path().to_str().unwrap().bright_black()), |
| 80 | + Err(err) => eprintln!("{} {} {}", "[X]".bright_red(), "Rewrite failed", err), |
| 81 | + } |
| 82 | + } |
| 83 | + Err(err) => eprintln!("{} {} {}", "[X]".bright_red(), "Rewrite failed", err), |
| 84 | + } |
| 85 | + }); |
| 86 | + |
| 87 | + // Finish |
| 88 | + let dur = start.elapsed().as_millis(); |
| 89 | + println!("\n{} {}", "[T]".bright_magenta(), format!("{}ms elapsed", dur.to_string()).bright_black()); |
| 90 | + |
| 91 | + Ok(()) |
| 92 | +} |
| 93 | + |
0 commit comments