I've wrote a code to make a wordlist and I'm wondering how to make it run the $var1 input with the first char uppercase!
Basically I want to make the first char uppercase, generating two outputs e.g: character1.txt Character2.txt.
Made some search but didnt find anything useful, perhaps we could achieve it with an If statement or loop. Not really sure yet!
Take a look at the code:
#!/bin/bash -
#title :wordlist_creator.sh
#description :Feito para ajudar na criação de lista personalizadas direcionadas à alvos precisos.
#author :Henrique Silva
#date :2017-09-25
#version :v2
#usage :./wordlist_creator.sh
#notes :
#bash_version :4.4.12(1)-release
#============================================================================
read -p "Digite a letra: " var1
var2=${#var1}
printf "***************************** Adiciona um novo caracter na letra ****************************\n\n*"
var01=$((var2 + 1))
crunch $var01 $var01 -t $var1% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var01 $var01 -t %$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var01 $var01 -t $var1^ -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var01 $var01 -t ^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
printf "***************************** Adiciona 2 novos caracters na letra ****************************\n\n*"
var3=$((var2 + 2))
crunch $var3 $var3 -t $var1%% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var3 $var3 -t %%$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var3 $var3 -t $var1^% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var3 $var3 -t %^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var3 $var3 -t $var1^^ -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var3 $var3 -t ^^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
printf "***************************** Adiciona 3 novos caracters na letra ****************************\n\n*"
var4=$((var2 + 3))
crunch $var4 $var4 -t $var1%%^ -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1%^% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1^%% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1^^% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1^%^ -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1%^^ -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1%%% -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t $var1^^^ -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t %%^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t %^%$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t ^%%$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t ^^%$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t ^%^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t %^^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t %%%$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var4 $var4 -t ^^^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
printf "***************************** data de aniversário em YYYY ****************************\n\n*"
var5=$((var2 + 4))
crunch $var5 $var5 -t %%%%$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var5 $var5 -t $var1%%%% -o Wordlist$(date +'%d-%m-%Y-%s').txt
var6=$((var2 + 5))
crunch $var6 $var6 -t %%%%^$var1 -o Wordlist$(date +'%d-%m-%Y-%s').txt
crunch $var6 $var6 -t $var1^%%%% -o Wordlist$(date +'%d-%m-%Y-%s').txt
printf "***************************** Aguarde um pouco =D / organizando e juntando os arquvos ****************************\n\n*"
if [ -d $var1 ]; then
printf "***************************** Diretório já existe! ****************************\n\n*"
else
mkdir -p -v $var1/
fi
cat Wordlist* /usr/share/wordlists/fern-wifi/common.txt /usr/share/wordlists/fasttrack.txt > $var1/$var1-wordlist-$(date +'%d-%m-%Y-%H-sec%S').txt
sleep 10
rm Wordlist*
tr, sed, and awk can be used to make an identical string variable but with the first letter uppercased but here's a way with bash:
var1="character1.txt"; var2="${var1^}"
var1: character1.txt
var2: Character1.txt