#!/bin/bash
source pakuri.conf

function help_exploit()
{
    clear
    echo -e "${RED_b}+---+"
    echo -e "${RED_b}| 2 |  Exploit"
    echo -e "${RED_b}+---+${NC}"
    echo -e "${BOLD}-----------------Exploit Menu Assist------------------${NC}"
    echo -e ""
    echo -e "${BLUE_b}+---+"
    echo -e "${BLUE_b}| 1 |  Password Crack"
    echo -e "${BLUE_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Brute force attack using Brutespray."
    echo -e ""
    echo -e ""
    echo -e "${RED_b}+---+"
    echo -e "${RED_b}| 2 |  Metasploit"
    echo -e "${RED_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Helping you work with Metasploit."
    echo -e "${RED_b}(We're not going to execute the Exploit code directly.)${NC}"
    echo -e "   ${BLUE_b}[1]${NC} Password Crack"
    echo -e "   ${RED_b}[2]${NC} Metasploit"
    echo -e "   ${YELLOW_b}[3]${NC} Searchsploit"
    echo -e ""
    echo -e ""
    echo -e "${YELLOW_b}+---+"
    echo -e "${YELLOW_b}| 3 |  Searchsploit"
    echo -e "${YELLOW_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Search the Exploit Database for keywords."
    echo -e ""
    echo -e ""
}

function help_passcrack()
{
    clear
    echo -e ""
    echo -e "${RED_b}+---+  ${BLUE_b}+---+"
    echo -e "${RED_b}| 2 |  ${BLUE_b}| 1 |  Password Crack"
    echo -e "${RED_b}+---+  ${BLUE_b}+---+${NC}"
    echo -e "${BOLD}------------------------------------------------------${NC}"
    echo -e "Overview"
    echo -e "   Use Brutespray to make a brute-force attack on a login-attemptable port."
    echo -e ""
    echo -e "${GREEN_b}Step 1${NC}"
    echo -e "   First, use NMAP to find out which ports are open."
    echo -e ""
    echo -e "Use Command:"
    echo -e "   nmap -T4 -p- --max-retries 1 --max-scan-delay 20 --defeat-rst-ratelimit --open -oX <.xml file> -iL <Target ip lists>"
    echo -e "Options:"
    echo -e "   --max-retries <tries>: Caps number of port scan probe retransmissions."
    echo -e "   --scan-delay/--max-scan-delay <time>: Adjust delay between probes"
    echo -e "   --defeat-rst-ratelimit: Ignore rate limit"
    echo -e "   --open: Only show open (or possibly open) ports"
    echo -e "   -iL <inputfilename>: Input from list of hosts/networks"
    echo -e ""
    echo -e "${GREEN_b}Step 2${NC}"
    echo -e "   Next, Brutespray is executed based on the result of Nmap executed in Step1."
    echo -e ""
    echo -e "Use Command:"
    echo -e "   brutespray --file <Nmap execution results in xml format> --output <output directory> --threads 5 --hosts 5"
    echo -e "Options:"
    echo -e "   -f FILE, --file FILE: GNMAP or XML file to parse"
    echo -e "   -o OUTPUT, --output OUTPUT: Directory containing successful attempts"
    echo -e "   -t THREADS, --threads THREADS: number of medusa threads"
    echo -e "   -T HOSTS, --hosts HOSTS: number of hosts to test concurrently"
}

function help_metasploitmenu()
{
    clear
    echo -e ""
    echo -e "${RED_b}+---+  ${RED_b}+---+"
    echo -e "${RED_b}| 2 |  ${RED_b}| 2 |  Metasploit"
    echo -e "${RED_b}+---+  ${RED_b}+---+${NC}"
    echo -e "${BOLD}----------------Metasploit Menu Help----------------${NC}"
    echo -e ""
    echo -e "${BLUE_b}+---+"
    echo -e "${BLUE_b}| 1 |  Setup"
    echo -e "${BLUE_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Configure the settings for Metasploit."
    echo -e "   ${BLUE_b}[1]${NC} Create DB"
    echo -e "   ${RED_b}[2]${NC} Delete DB"
    echo -e ""
    echo -e ""
    echo -e "${RED_b}+---+"
    echo -e "${RED_b}| 2 |  Start / Stop Metasploit"
    echo -e "${RED_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Start and stop Metasploit."
    echo -e ""
    echo -e ""
}

function help_metasploitsetup()
{
    clear
    echo -e ""
    echo -e "${RED_b}+---+  ${RED_b}+---+  ${BLUE_b}+---+"
    echo -e "${RED_b}| 2 |  ${RED_b}| 2 |  ${BLUE_b}| 1 |  Setup"
    echo -e "${RED_b}+---+  ${RED_b}+---+  ${BLUE_b}+---+${NC}"
    echo -e "${BOLD}----------------Metasploit Menu Help----------------${NC}"
    echo -e ""
    echo -e "${BLUE_b}+---+"
    echo -e "${BLUE_b}| 1 |  Create DB"
    echo -e "${BLUE_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Create and initialize the msf database."
    echo -e ""
    echo -e ""
    echo -e "${RED_b}+---+"
    echo -e "${RED_b}| 2 |  Delete DB"
    echo -e "${RED_b}+---+"
    echo -e "------------------------------------------------------${NC}"
    echo -e "Delete the msf database."
    echo -e ""
    echo -e ""
}

case $1 in
    main)
        help_exploit;;
    21)
        help_passcrack;;
    22)
        help_metasploitmenu ;;
    221)
        help_metasploitsetup ;;
esac
