[Chugalug] silly perl one liner to randomize passwords

flushy at flushy.net flushy at flushy.net
Wed Mar 5 21:09:37 UTC 2014

I was bored yesterday and a FB status spawned this:

sudo cat /etc/shadow | perl -pe 'sub r{$l=shift;open(R,"base64  
/dev/urandom|")||die$!;sysread(R,$R,$l*4);close(R);$R=~s/[^\w]//g;substr($R,0,$l)}@P=split/:/;if($P[1]=~/\$6/){$s=&r(8);$p=&r(16);$P[1]=crypt($p,"\$6\$$s");$_=join(":", at P);}'

It will ready in the shadow file, and output stdout with new shadow  
file data with any defined passwords randomized.


More information about the Chugalug mailing list