Bash 스크립트의 중첩 사례

Bash 스크립트의 중첩 사례

웹 서버 침투를 자동화하기 위해 bash 스크립트를 작성하기 시작했습니다. 이 예에서는 중첩된 사례를 사용했지만 모든 들여쓰기를 올바르게 지정했는데도 오류가 발생합니다.

암호:

#!/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 "\033[31mwhois information of domain...........\033[m"
                        whois $domain
                        echo -e "\033[31mDNS information of domain........\033[m"
                        dnsrecon -d $domain
                        echo -e "\033[31mGet IP and hostnames from $domain......\033[m"
                        fierce -dns $domain -wordlist host.txt
                        echo -e "\033[31mGet emails of the domain.......\033[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 "\033[31m scanning with nikto.........\033[m"
            nikto -h $domain -output /niktoresults.html
            echo "\033[31m vulnerablilty analysis with whatweb.......\033[m"
            whatweb $domain
            echo  "\033[31mscanning with nmap........\033[m"
            nmap -sV $domain -oX /nmapresults.xml
        ;;

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

발생한 오류는 ./pentest.sh: line 37: )' ./pentest.sh: line 37: 토큰 '스캔' 근처에 예기치 않은 구문 오류가 발생했습니다)' 입니다.

답변1

모든 사례 섹션은 ;;. 이 경우 $menu외부 일치 case에서 실행된 부분은 final 로 끝나지 "Information_gathering"않습니다 .;;done

관련 정보