Good afternoon,
I'm programming in C and it's the first time I'm programming in Bash (shell-script).
I did some bash functions, learned to call and created an interactive menu with the user, my program does "basically" reading a wordlist and searches for files / folders within a certain location.
What happens "or rather it does not happen" is, there is no program error message, nor does it 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 tell me the possible problems? PS: Taking all the interactive menu, taking the functions and letting only what has run within the function the program rotates.
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