[Chugalug] silly perl one liner to randomize passwords

AverageSecurityGuy stephen at averagesecurityguy.info
Wed Mar 5 21:47:02 UTC 2014


For the sake of your sanity DO NOT LEARN Perl. Learn Bash for simple stuff an Python for complex stuff. Let Perl DIAF.

--
Stephen Haywood
Owner, ASG Consulting
CISSP, OSCP
423.305.3700
asgconsulting.co



On Mar 5, 2014, at 4:20 PM, Alex Smith (K4RNT) <shadowhunter at gmail.com> wrote:

> Oh god, is that really a Perl script?
> 
> ...I don't think I want to learn it anymore. :P
> 
> " ' With the first link, the chain is forged. The first speech censured, the first thought forbidden, the first freedom denied, chains us all irrevocably.' Those words were uttered by Judge Aaron Satie as wisdom and warning... The first time any man's freedom is trodden on we’re all damaged." - Jean-Luc Picard, quoting Judge Aaron Satie, Star Trek: TNG episode "The Drumhead"
> - Alex Smith
> - Dulles Technology Corridor (Chantilly/Ashburn/Dulles), Virginia USA
> 
> 
> On Wed, Mar 5, 2014 at 4:09 PM, <flushy at flushy.net> wrote:
> 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.
> 
> --b
> 
> 
> _______________________________________________
> Chugalug mailing list
> Chugalug at chugalug.org
> http://chugalug.org/cgi-bin/mailman/listinfo/chugalug
> 
> _______________________________________________
> Chugalug mailing list
> Chugalug at chugalug.org
> http://chugalug.org/cgi-bin/mailman/listinfo/chugalug

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://chugalug.org/pipermail/chugalug/attachments/20140305/f422f4ae/attachment-0001.pgp>


More information about the Chugalug mailing list