From ceb1ab44d35ef252a7558be973be3f851e59bc2f Mon Sep 17 00:00:00 2001 From: Random936 Date: Sun, 22 Dec 2024 19:29:45 -0800 Subject: [PATCH] Made shell dynamic for /shells route --- src/shells.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shells.rs b/src/shells.rs index 7f6443b..fe83f6a 100644 --- a/src/shells.rs +++ b/src/shells.rs @@ -1,12 +1,13 @@ use axum::{ body::Body, + extract::Path, http::{Request, StatusCode}, response::IntoResponse }; use crate::config; -pub async fn shells_handler(req: Request) -> impl IntoResponse { +pub async fn shells_handler(Path(shell): Path, req: Request) -> impl IntoResponse { let conf = config::load_config(); let Some(host) = req.headers() .get("host") @@ -15,7 +16,7 @@ pub async fn shells_handler(req: Request) -> impl IntoResponse { }; let ip = host.split(":").next().unwrap(); - match conf.get_shell("bash") { + match conf.get_shell(&shell) { Some(res) => { let cmd = res.replace("{LHOST}", ip) .replace("{LPORT}", &conf.shell_port.to_string());