Executive Summary: Using strong passwords is a necessity nowadays. To create strong passwords, you can use RandPass.hta. This HTML Application provides a simple GUI that lets you generate a list of random passwords in seconds. You can make the passwords as long as needed (up to 128 characters) and as complex as needed (you can use uppercase letters, lowercase letters, numbers, and/or symbols). |
It's often useful to be able to generate random passwords for various uses. For example, your backup strategy might require you to use a privileged account that's protected with a long and complex password. To make it easy to generate random passwords, I wrote RandPass.hta, which you can download by clicking the Download the Code Here button at the top of the page. As Figure 1 shows, this HTML Application (HTA) has an easy-to-use GUI.
Figure 1: RandPass.hta's GUI |
 |
You just choose the types of characters the random passwords should include, the length of the passwords, and the number of passwords the HTA should generate. When you click the Generate Passwords button, the HTA populates the list box with randomly generated passwords meeting the specified criteria. RandPass.hta can generate up to 128 passwords of up to 128 characters each. The Copy to Clipboard button will copy the entire list to the clipboard. You can also select and copy passwords using a mouse.
By default, RandPass.hta generates random passwords using English uppercase letters, English lowercase letters, and the numbers 0 through 9. You can also select Symbols, which contains the following:
! # $ ' * + , - . / : ; = ? @ [ \ ] _ { } ~
Some symbols (e.g., " < >) have special interpretations when used at a command prompt, so I intentionally skipped them to avoid potential problems. If the list of characters isn't sufficient for your needs, open RandPass.hta in a plain-text editor (such as Notepad) and scroll down to the lines of code shown in Listing 1.
Listing 1: Code That Defines RandPass.hta's Character Classes |
 |
Modify the characters between the double quotes and save the file. Note that the backslash (\) is doubled because the backslash is JScript's escape character. Also, if you want to include the double quote (") in the Symbols set, you must escape it with a backslash (i.e., \") to avoid a syntax error.
Inside the HTA
The most interesting part of RandPass.hta is the code that makes it work. Like any HTA, RandPass.hta consists of HTML tags and code that responds to events. Table 1 lists the HTML tags that correspond to the application's GUI elements.
Table 1: RandPass.hta's GUI Elements and Associated HTML Markup
| GUI Element |
HTML Markup |
| Check boxes |
<input type="checkbox" ... /> |
| Input boxes |
<input type="text" ... /> |
| Submit button |
<input type="submit" ... /> |
| Text area |
<textarea> ... </textarea> |
| Standard buttons |
<input type="button" ... /> |
RandPass.hta uses four check boxes (for the character classes), two input boxes (for the Password length and Number of passwords fields), a submit button (for the Generate Passwords button), a text area (for the list of passwords), and three standard buttons (for the Copy to Clipboard, Clear List, and Close buttons).