0

I stared writing a bash script for automate penetrating on web servers in this i used a nested cases but it raises a error even if i give all indentation correctly

code:

#!/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 

and the raised error is ./pentest.sh: line 37: syntax error near unexpected token )' ./pentest.sh: line 37: "scanning")'

2
  • 3
    You didn't end the Information_gathering with a ;; Commented Mar 5, 2017 at 14:14
  • Thank Kusalananda (by using the checkmark), he actually answered :) Commented Mar 5, 2017 at 15:50

1 Answer 1

2

Each case section needs to end with ;;. In this case, the section that is executed when $menu in the outer case matches "Information_gathering" does not end with ;; after its final done.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.