Made shell dynamic for /shells route
This commit is contained in:
parent
a3b49ed7fc
commit
ceb1ab44d3
@ -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<Body>) -> impl IntoResponse {
|
||||
pub async fn shells_handler(Path(shell): Path<String>, req: Request<Body>) -> 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<Body>) -> 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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user