On Thursday 01 December 2005 11:31, Mircea Ciocan wrote:
>  Am si eu o lista scarbava de tip:
> user,domeniu,parola
>
> e vreo metoda de shell wizardry sa pot detecta daca parola e mai
> scurta de 6 litere sau daca parola contine userul sau domeniul ca
> substring ca sa le vars intr-un fisier si sa se spele pe cap altii cu
> ele ?!?!?!?
>
>       Mircea "inca putin si scap 4ever de adminstrari pro-bono" C.
>
>
> P.S. Legatura cu linuxu' you say ??? Here's the standandard answer no.
> 3: Toate astea se fac pe un server Linux :)  !!!

$ echo -e "foo,bar,x
foo,bar,xxxfooxxx
foo,bar,xxxbarxxx
foo,bar,notf00b4r" | {
  OLDIFS="$IFS"; 
  IFS=","; 
  while read user domeniu parola; do 
    if [ ${#parola} -le 6 -o \
      "${parola#*$user*}" != "$parola" -o \
      "${parola#*$domeniu*}" != "$parola" ] ; then 
        echo "$parola - invalid password"; 
    else 
        echo "$parola - password OK"; 
    fi; 
  done; 
  IFS="$OLDIFS"; 
}

x - invalid password
xxxfooxxx - invalid password
xxxbarxxx - invalid password
notf00b4r - password OK


Mihai

_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug

Raspunde prin e-mail lui