Enviado em 20/11/2019 - 17:01h
Olá galera :) Comecei a estudar shell há um tempo mas ainda estou no nível básico e não cheguei em funções. Apesar disso gostaria de entender como essa função que tirei de um script funciona, eu tentei utilizar ela mas não obtive nenhum resultado e ela não está funcionando no script de onde a tirei porque ele não estava obsfucado. Se puderem me ajudar, talvez com exemplos de uso, ficaria muito grato. Segue abaixo a função:
ofuscate_fun () {
unset link_list
unset txt_ofuscatw
unset txtofus
number=$(expr length $1)
for((i=1; i<$number+1; i++)); do
txt[$i]=$(echo "$1" | cut -b $i)
case ${txt[$i]} in
".")
txt[$i]="#";;
"$")
txt[$i]=".";;
"1")
txt[$i]="@";;
"@")
txt[$i]="1";;
"2")
txt[$i]="?";;
"?")
txt[$i]="2";;
"3")
txt[$i]="&";;
"&")
txt[$i]="3";;
esac
txtofus+="${txt[$i]}"
done
link_list=$(echo $txtofus|rev)
txt_ofuscatw=$(echo $txtofus|rev)
}
ofuscate_fun () {
unset link_list
unset txt_ofuscatw
unset txtofus
number=$(expr length $1)
for((i=1; i<$number+1; i++)); do
txt[$i]=$(echo "$1" | cut -b $i)
case ${txt[$i]} in
".")
txt[$i]="#";;
"$")
txt[$i]=".";;
"1")
txt[$i]="@";;
"@")
txt[$i]="1";;
"2")
txt[$i]="?";;
"?")
txt[$i]="2";;
"3")
txt[$i]="&";;
"&")
txt[$i]="3";;
esac
txtofus+="${txt[$i]}"
done
link_list=$(echo $txtofus|rev)
txt_ofuscatw=$(echo $txtofus|rev)
}