![]() |
Languages »
C# »
Utilities
Intermediate
License: The Code Project Open License (CPOL)
Semantic Password Generator that Uses WordNetBy JoeSoxC#+IronPython 2+WordNet+Python+.NET = w00t! |
C#, Windows, .NET, Visual Studio, CEO, DBA, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
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.. 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.
CurrentManager.Host.DefaultModule.SetVariable
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 (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.
If you just wish to run the application, make sure you have downloaded 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 Microsoft.Scripting.
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.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 5 Oct 2007 Editor: Deeksha Shenoy |
Copyright 2007 by JoeSox Everything else Copyright © CodeProject, 1999-2009 Web16 | Advertise on the Code Project |