escalation666 Posted September 2, 2007 Report Share Posted September 2, 2007 Neavand un script care sa-mi genereze parole dupa anumite date personale, am apelat la putin bash pentru a face acest script.Stiu ca arata cam primitiv, asa si este, dar isi face treaba si asta conteaza Puteti pune de exemplu numele site-ului, numele adminului, adresa de email, adresa etc (si asta pentru ca am intalnit cazuri in care parolele erau ceva de genul user:siteul si pass:meu pentru site-ul www.siteulmeu.com, unii admini foloseau drept parola adresa de email etc...)#!/usr/bin/bashclearecho "----------Simple password generator----------"echo "----------------------by 35c666--------------"echo "Introdu prima data personala"read var1echo "Introdu a doua personala"read var2echo "Introdu a treia data personala"read var3echo "Introdu a patra data personala"read var4echo "Introdu a cincea data personala"read var5echo ""echo $var1 > date.txtecho $var2 >> date.txtecho $var3 >> date.txtecho $var4 >> date.txtecho $var5 >> date.txtecho $var1$var1 >> date.txtecho $var1$var2 >> date.txtecho $var1$var3 >> date.txt echo $var1$var4 >> date.txtecho $var1$var5 >> date.txtecho $var2$var1 >> date.txtecho $var2$var2 >> date.txtecho $var2$var3 >> date.txtecho $var2$var4 >> date.txtecho $var2$var5 >> date.txtecho $var3$var1 >> date.txtecho $var3$var2 >> date.txtecho $var3$var3 >> date.txtecho $var3$var4 >> date.txtecho $var3$var5 >> date.txtecho $var4$var1 >> date.txtecho $var4$var2 >> date.txtecho $var4$var3 >> date.txtecho $var4$var4 >> date.txtecho $var4$var5 >> date.txtecho $var5$var1 >> date.txtecho $var5$var2 >> date.txtecho $var5$var3 >> date.txtecho $var5$var4 >> date.txtecho $var5$var5 >> date.txtecho $var1$var1$var1 >> date.txtecho $var1$var2$var1 >> date.txtecho $var1$var1$var2 >> date.txtecho $var1$var2$var2 >> date.txtecho $var1$var3$var1 >> date.txtecho $var1$var1$var3 >> date.txtecho $var1$var2$var3 >> date.txtecho $var1$var3$var2 >> date.txtecho $var2$var2$var2 >> date.txtecho $var2$var1$var2 >> date.txtecho $var2$var2$var1 >> date.txtecho $var2$var1$var1 >> date.txtecho $var2$var3$var2 >> date.txtecho $var2$var2$var3 >> date.txtecho $var2$var1$var3 >> date.txtecho $var2$var3$var1 >> date.txtecho $var3$var3$var3 >> date.txtecho $var3$var1$var3 >> date.txtecho $var3$var2$var1 >> date.txtecho $var3$var1$var1 >> date.txtecho $var3$var2$var3 >> date.txtecho $var3$var3$var2 >> date.txtecho $var3$var1$var2 >> date.txtecho $var3$var3$var1 >> date.txtecho "generez si parole cu caractere alfanumerice pana la 100?[da/pt nu tasteaza orice altceva]"read rasprasp=$raspif [ "$rasp" == "da" ]; thenfor i in `seq 1 100`; do echo $var1$i >> date.txt echo $var2$i >> date.txt echo $var1$var1$i >> date.txt echo $var1$i$var2 >> date.txt echo $var2$var2$i >> date.txt echo $var2$i$var1 >> date.txt done fiecho "Parole generate:"wc -l date.txt | awk '{print $1}'de ex----------Simple password generator--------------------------------by 35c666---------------------introdu prima data personalajijiintrodu a doua personalasiteulintrodu a treia data personalameuintrodu a patra data personala[email]eu@test.com[/email]introdu a cincea data personalaspanacgenerez si parole cu caractere alfanumerice pana la 100?[da/pt nu tasteaza orice altceva]daParole generate:654produce ceva de genu:jijisiteulmeu[email]eu@test.com[/email]spanacjijijijijijisiteuljijimeu[email]jijieu@test.com[/email]jijispanacsiteuljijisiteulsiteulsiteulmeu[email]siteuleu@test.com[/email]siteulspanacmeujijimeusiteulmeumeu[email]meueu@test.com[/email]meuspanac[email]eu@test.comj[/email]iji[email]eu@test.coms[/email]iteul[email]eu@test.comm[/email]eu[email]eu@test.comeu@test.com[/email][email]eu@test.coms[/email]panacspanacjijispanacsiteulspanacmeu[email]spanaceu@test.com[/email]spanacspanacjijijijijijijijisiteuljijijijijijisiteuljijisiteulsiteuljijimeujijijijijijimeujijisiteulmeujijimeusiteulsiteulsiteulsiteulsiteuljijisiteulsiteulsiteuljijisiteuljijijijisiteulmeusiteulsiteulsiteulmeuetc etc Quote Link to comment Share on other sites More sharing options...
moubik Posted September 4, 2007 Report Share Posted September 4, 2007 ca sa-ti simplifici scriptu poti sa faci si chestii de genul$$var si reprezinta $(de valoarea variabilei)nu prea mi-a iesit explicatia.exemplu:$val1 = "1";$val2 = "2";$var = "val1";$$var reprezinta 1;stiu ca la php merge ... la bash nu stiu Quote Link to comment Share on other sites More sharing options...