From c6048174dab2d8235ce5686da2f6168f3d644e36 Mon Sep 17 00:00:00 2001 From: 01rabbit Date: Thu, 9 Mar 2023 15:41:44 +0900 Subject: [PATCH] Add HTTP Server --- modules/auxiliary/53_kp_httpserver.sh | 65 +++++++++++++++++++++++++++ modules/auxiliary/auxiliarymenu.sh | 5 +++ 2 files changed, 70 insertions(+) create mode 100644 modules/auxiliary/53_kp_httpserver.sh diff --git a/modules/auxiliary/53_kp_httpserver.sh b/modules/auxiliary/53_kp_httpserver.sh new file mode 100644 index 0000000..cff44ee --- /dev/null +++ b/modules/auxiliary/53_kp_httpserver.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +source kp.conf +source $MODULES_PATH/misc_module.sh + +function menu_httpserver(){ + clear + figlet Python HTTP Server + num5 0 "Auxiliary" + num3 5 "Python HTTP Server" + num1 10 "Execute" + num9 10 "Back" + read -n 1 -s NUM + case $NUM in + 1) + cmd_httpserver + ;; + 9) + menu_auxiliary + ;; + *) + ;; + esac +} + +function cmd_httpserver(){ + clear + figlet Python HTTP Server + printf "┌─(${PURPLE}$TITLE${NC})${RED}${USERNAME}@${HOSTNAME}${NC}:${PURPLE}[5]Auxiliary${NC} > ${YELLOW}[3]Python HTTP Server${NC} > ${RED}[1]Execute${NC}\n" + printf "+${BLUE}positional arguments${NC}:\n" + printf "| ${YELLOW}port${NC}: specify alternate port (default: 8000)\n" + echo "|" + printf "+${BLUE}options${NC}:\n" + printf "| ${YELLOW}-h, --help${NC}: show this help message and exit\n" + printf "| ${YELLOW}--cgi${NC}: run as CGI server\n" + printf "| ${YELLOW}--bind ADDRESS, -b ADDRESS${NC}: specify alternate bind address (default: all interfaces)\n" + printf "| ${YELLOW}--directory DIRECTORY, -d DIRECTORY${NC}: specify alternate directory (default: current directory)\n" + read -p "> Enter the port number. If nothing is entered, the default (8000) is applied.: " PORT + if [ -n "$PORT" ];then + cmd="python3 -m http.server $PORT" + else + cmd="python3 -m http.server" + fi + echo "|" + printf "+${BLUE}usage${NC}: python3 -m http.server ${WHITE}[--cgi] [--bind ADDRESS] [--directory DIRECTORY] [port]${NC}\n" + echo "└─Command > $cmd" + echo "" + echo "> You ready?" + num1 0 "No" + num2 0 "Yes" + read -n 1 -s ANS + echo "" + if [ ! -z "$ANS" ];then + if [ $ANS = "2" ];then + show_number 531 "Python HTTP Server" + tmux split-window -v + tmux send-keys "${cmd};read;exit" C-m + tmux select-pane -t "${TITLE}".0 + else + : + fi + else + : + fi +} \ No newline at end of file diff --git a/modules/auxiliary/auxiliarymenu.sh b/modules/auxiliary/auxiliarymenu.sh index fb339a4..d57cef5 100644 --- a/modules/auxiliary/auxiliarymenu.sh +++ b/modules/auxiliary/auxiliarymenu.sh @@ -4,6 +4,7 @@ source kp.conf source $MODULES_PATH/misc_module.sh source $AUXILIARY_PATH/51_kp_undercover.sh source $AUXILIARY_PATH/52_kp_netcat.sh +source $AUXILIARY_PATH/53_kp_httpserver.sh function menu_auxiliary(){ clear @@ -11,6 +12,7 @@ function menu_auxiliary(){ num5 0 "Auxiliary" num1 5 "kali-undercover" num2 5 "Netcat" + num3 5 "Python HTTP Server" num9 5 "Main" read -n 1 -s NUM case $NUM in @@ -20,6 +22,9 @@ function menu_auxiliary(){ 2) menu_netcat ;; + 3) + menu_httpserver + ;; 9) mainmenu ;;