Caso aninhado no script bash

0

Eu comecei a escrever um script bash para automatizar a penetração em servidores da web neste i usado casos aninhados, mas gera um erro, mesmo se eu dar todo o recorte corretamente

código:

#!/bin/bash
figlet Automated Pentesting
select menu in "Information_gathering" "scanning" "exploitation"
do
    case $menu in
        "Information_gathering")
            echo "###################################################"
            select ch in "person" "domain_information" "email" "phonenumber"
            do
                case $ch in
                    "Information_gathering")
                        read -p "Enter Person name:" name
                        firefox -new-tab -url http://www.spokeo.com/social/profile?q=$name -new-tab -url https://pipl.com/search/protect?q=$name&in=5&l=&sloc=
                    ;;
                    "domain_information")
                        read -p "enter the domain:" domain
                        echo -e "3[31mwhois information of domain...........3[m"
                        whois $domain
                        echo -e "3[31mDNS information of domain........3[m"
                        dnsrecon -d $domain
                        echo -e "3[31mGet IP and hostnames from $domain......3[m"
                        fierce -dns $domain -wordlist host.txt
                        echo -e "3[31mGet emails of the domain.......3[m"
                        theharvester -d $domain -l 500 -b google -h myresults.html
                        echo "emails are stored in myresults.html file"
                    ;;
                    "email")
                        read -p "enter email address:" mal
                        firefox -new-tab -url http://www.spokeo.com/social/profile?q=$mal -new-tab -url https://pipl.com/search/protect?q=$mal&in=5&l=&sloc=
                    ;;
                    "phonenumber")
                        read -p "Enter the phonenumber with countrycode" phnumbr
                        firefox -new-tab -url https://www.truecaller.com/search/in/$phnumbr 
                    ;;
                esac
            done
        "scanning")
            read -p "enter the domain to scan" domain
            echo "3[31m scanning with nikto.........3[m"
            nikto -h $domain -output /niktoresults.html
            echo "3[31m vulnerablilty analysis with whatweb.......3[m"
            whatweb $domain
            echo  "3[31mscanning with nmap........3[m"
            nmap -sV $domain -oX /nmapresults.xml
        ;;

        "exploitation")
            echo "3[31m exploiting the domain......3[m"
            python metasploitHelper.py -i nmapresults.xml
        ;;
    esac
done

e o erro gerado é ./pentest.sh: linha 37: erro de sintaxe próximo do token inesperado )' ./pentest.sh: line 37: "scanning") '

    
por saivinay manapuram 05.03.2017 / 15:11

1 resposta

2

Cada seção de caso precisa terminar com ;; . Nesse caso, a seção executada quando $menu no nível externo case corresponde a "Information_gathering" não termina com ;; após seu% finaldone.

    
por 05.03.2017 / 15:17