Log in

No account? Create an account

Saturday Morning Applescript - Password Generator

« previous entry | next entry »
Jan. 19th, 2008 | 09:52 am

If you find yourself wanting to generate pretty secure passwords to paste into code quite a lot (and I do) or even want a password for a website which is impossible to remember but will likely not be cracked by brute force, here's some Applescript to put into your user scripts folder.

set passLength to (text returned of (display dialog "Password length:" default answer 24 with icon note)) as integer

set myPassword to do shell script "perl -e '@c = (\"a\"..\"z\", \"A\"..\"Z\", \"0\"..\"9\"); while($f++<" & passLength & "){$p .= $c[rand @c];} print $p;'"

set the clipboard to myPassword

display dialog "Password " & myPassword & " copied to clipboard." buttons {"OK"} default button 1 with icon note

This is the sort of thing I do whilst waiting for my brain to boot properly. Sometimes.

Link | Leave a comment |

Comments {0}