Removed unnecessary replace_shell_params function
This commit is contained in:
parent
8dc4b91ba2
commit
a3b49ed7fc
@ -1,4 +1,3 @@
|
||||
use std::net::SocketAddr;
|
||||
use axum::{
|
||||
body::Body,
|
||||
http::{Request, StatusCode},
|
||||
@ -7,11 +6,6 @@ use axum::{
|
||||
|
||||
use crate::config;
|
||||
|
||||
fn replace_shell_params(cmd: &str, lhost: &str, lport: &u16) -> String {
|
||||
cmd.replace("{LHOST}", lhost)
|
||||
.replace("{LPORT}", &lport.to_string())
|
||||
}
|
||||
|
||||
pub async fn shells_handler(req: Request<Body>) -> impl IntoResponse {
|
||||
let conf = config::load_config();
|
||||
let Some(host) = req.headers()
|
||||
@ -22,8 +16,11 @@ pub async fn shells_handler(req: Request<Body>) -> impl IntoResponse {
|
||||
|
||||
let ip = host.split(":").next().unwrap();
|
||||
match conf.get_shell("bash") {
|
||||
Some(res) => (StatusCode::OK, replace_shell_params(&res, ip, &conf.shell_port)),
|
||||
Some(res) => {
|
||||
let cmd = res.replace("{LHOST}", ip)
|
||||
.replace("{LPORT}", &conf.shell_port.to_string());
|
||||
(StatusCode::OK, cmd)
|
||||
},
|
||||
None => (StatusCode::NOT_FOUND, "Invalid shell name.".to_string()),
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user