1
Good afternoon,
I program in C and it’s the first time I’m programming in Bash (shell-script).
I did some functions in bash, learned to call and created an interactive menu with the user, my program does "basically" reading a Wordlist and search files/folders within a certain location.
What happens "or better it doesn’t happen" is, there is no error message from the program, and it does not execute the identification code
The menu opens, runs, however when selecting the options it simply returns the menu. The program is very simple. Could someone point out the possible problems? PS: Taking out the entire interactive menu, taking out the functions and letting only what is inside the function the program runs.
many thanks to those who can help me, att.
#!/bin/bash
banner(){
clear
echo "------------------------------------------"
echo "| RECON DE DIRETORIOS E ARQUIVOS |"
echo "------------------------------------------"
echo "| Uso: $0 <local> |"
echo "------------------------------------------"
}
menu(){
clear
echo ""
echo "------------------------------------------"
echo "| RECON DE DIRETORIOS E ARQUIVOS |"
echo "------------------------------------------"
echo "| [1] - Consultar Diretorios |"
echo "| [2] - Consultar Arquivos |"
echo "| [3] - Consultar Arquivos/Diretorios |"
echo "| [4] - Sair |"
echo "------------------------------------------"
echo -n "| Escolha uma opcao: "
read OPT
case $OPT in
1) buscadir ;;
2) buscaarq ;;
3) buscadir;buscaarq ;;
4) exit ;;
*) echo "Opcao Invalida" ; echo ; menu ;
esac
}
buscadir(){
for palavra in $(cat lista2.txt)
do
resp=$(curl -s -o /dev/null -w "%{http_code}" $1/$palavra/)
if [ $resp == "200" ]
then
echo "Diretorio encontrado --> $palavra"
fi
done
}
buscaarq(){
for palavra in $(cat lista2.txt)
do
resp=$(curl -s -o /dev/null -w "%{http_code}" $1/$palavra)
if [ $resp == "200" ]
then
echo "Arquivo encontrado --> $palavra"
fi
done
}
if [ "$1" == "" ]
then
banner
else
menu
fi