Table of Contents
Want a cure for password writer's block? Well, here is pswrdgeniron to iron out your password creation blues. The heart of this application is written in Python and Microsoft's IronPython 2.0A4 is its bridge to the .NET world.
There are many differences between IronPython 1 and 2. As of this writing, IronPython 2 is still Alpha, however it can still get the job done. One of the biggest differences between the two versions is the handling of passing variables between the non-native IronPython objects and the PythonEngine. In version 1 the
PythonEngine.Globals method was used to set and get variables created in Python code. That method has been removed in IronPython 2 and in its place is the use of
Microsoft.Scripting.ScriptDomainManager.<br />CurrentManager.Host.DefaultModule.SetVariable. Long namespace? Yes it is, but it fits with Microsoft's Dynamic Language Runtime (DLR) model. So what about this pswrdgeniron? Well, let me explain. pswrdgen.py is written in CPython 2.4 and is designed to run on any operating system. It is a CLI app. pswrdgeniron imports all of the methods in pswrdgen and provides a GUI for Windows users.
(Figure 1) Flow of pswrdgen.py, IronPython, and pswrdgeniron
Figure 1 shows the
Form1_Load method fire
bootstrap() which handles importing the pswrdgen.py via the
IronPythonEngine ("pe"). Once this is done, the parallel variables get constructed in pswrdgeniron.
bootstrap() also checks and makes sure the user has Python24. It is needed to import the OS module for pswrdgen.py. Within the IronPythonEngine.pe, a pswrdgen.py instance was created named "i". The user may change the values of the settings by modifying the controls in the user interface. Most of the autoupdating of the other controls are dependent upon the minimum length of the password. Once when "Min Length" control is changed, it changes other controls to avoid non-logical settings. For example, if the minimum length of a password is 6, you cannot capitalize more that 6, so 7 will not be listed as a valid choice in the dropdownbox control. When the user activates bRun_Click, "
i.run()" is called with IronPythonEngine.pe. pswrdgen.py's "
run" method generates just one completed password so this call is looped to
GENCOUNT (GENerate password COUNT).
When calling for objects to be returned from the
IronPythonEngine, it is necessary to cast the objects back and in some cases return an instance. For example, SWAPS is a
PythonDictionary object created from the
textbox text from
tbSwapSet and needs an instance of the object, so
Clone() is called.
SWAPS = (PythonDictionary)pe.EvaluateAs<pythondictionary />(tbSwapSet.Text.Trim()).Clone();
Custom Word files can be added using pswrdgeniron or pswrdgen.py. Using pswrdgeniron involves browsing to the new wordlist file. If the file is valid, it will be sent to the
IronPythonEngine and added to
i.WORDFILELISTS. There is currently no way to save custom file additions using pswrdgeniron directly. The workaround to do this is to update pswrdgen.py directly. This workaround is described here (Issue 17). All other settings are saved directly to the pswrdgen.py itself. When
bSavesettings_Click is fired
pe.ExecuteCommand("i._savesettings()") is called and the
IronPythonEngine handles opening pswrdgen.py to append the changes to the settings section.
If you believe passwords can be secure and still be remembered by administrators, then you may enjoy using pswrdgen and pswrdgeniron.
- Automatically chooses fresh nouns from WordNet
- Random capitalization of characters in chosen words
- Define your own swapping ruleset to use in chosen words
- Choose the lengths of your desired passwords
- Auto-update feature for pswrdgen.py
- Random character insertion into a chosen word
- Use custom word list files not just WordNet
- Save your custom settings (Does not save custom word lists)
If you just wish to run the application, make sure you have downloaded </a />WordNet and .NET 2.0 runtime before running the binary Windows Installation setup. If you wish to work with the source, you will need Microsoft's IronPython 2.0Ax and reference to it and
pswrdgeniron is a semantic password generator that uses WordNet, random capitalization, and character swapping. Maybe I didn't search the Internet long enough to find something like this application to generate passwords that I like. This application generates amusing and secure passwords that administrators can remember and it does this at lightning speeds compared to indecisive people like myself. Who knows, you might even discover some words you have forgotten about or learn some new dinosaur names while creating your lists of choices. Prerequisite: WordNet and .NET 2.0 runtime.
- Article posted - Created and tested on Microsoft's IronPython 2.0A3 (2.0.10724.00) on .NET 2.0.50727.832, Windows XP, MSVS 2005
- Changed section to C# Programming from Cross Platform
- Added random insertion
- Added configuration saving
- Tested with IronPython 2 Alpha4
- Uploaded new version 0.3.5 to address IronPython not handling Python25 and/or no Python24 residing on user's computer
- Uploaded new version 0.4.0
- Added dropdown combobox for custom Word file integration handling (Words must be in front of each line in the custom word file)
- Uploaded new version 0.4.1: Fixed two minor GUI bugs