Sign in to follow this  
Followers 0
unixu

Autoit Pass Generator

9 posts in this topic

#1 ·  Posted (edited)

Here is a small Password Generator

It can generate Nummeric , Alpha Nummeric in lower and UPPERcase letters,

special charackters, aswell as a mix of all presets.

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_icon=E:\test.ico
#AutoIt3Wrapper_outfile=Pass-Gen.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Fileversion=1.0
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Clipboard.au3>
Local $length, $letters, $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Pass Generator", 340, 311, 247, 141)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Checkbox1 = GUICtrlCreateCheckbox(" Nummeric", 16, 48, 97, 17)
GUICtrlSetOnEvent($Checkbox1, "Checkbox1Click")
$Checkbox2 = GUICtrlCreateCheckbox("Alpha Nummeric small letters", 16, 72, 169, 17)
GUICtrlSetOnEvent($Checkbox2, "Checkbox2Click")
$Checkbox3 = GUICtrlCreateCheckbox("Alpha Nummeric BIG letters", 16, 96, 153, 17)
GUICtrlSetOnEvent($Checkbox3, "Checkbox3Click")
$Checkbox4 = GUICtrlCreateCheckbox("Alpha  Nummeric BIG and small letters", 16, 120, 209, 17)
GUICtrlSetOnEvent($Checkbox4, "Checkbox4Click")
$Checkbox5 = GUICtrlCreateCheckbox("Nummeric , Alpha Nummeric BIG/small , special character", 16, 144, 305, 17)
GUICtrlSetOnEvent($Checkbox5, "Checkbox5Click")
$Group1 = GUICtrlCreateGroup("Password Presets", 8, 24, 321, 153)
$length = GUICtrlCreateInput("8", 248, 64, 41, 21)
$Label1 = GUICtrlCreateLabel("Password Length", 224, 40, 86, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Your Generated Password", 8, 184, 321, 73)
$genpw = GUICtrlCreateInput("", 24, 216, 289, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Generate", 8, 264, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent($Button1, "Button1Click")
$Button2 = GUICtrlCreateButton("Reset", 128, 264, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent($Button2, "Button2Click")
$Button3 = GUICtrlCreateButton("Close", 248, 264, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent($Button3, "Button3Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
Sleep(100)
WEnd

Func Button1Click()
    $pw = _PWgen(GUICtrlRead($length),$letters)
    GUICtrlSetData($genpw,$pw)
EndFunc
Func Button2Click()
    GUICtrlSetData($genpw,"")
    GUICtrlSetData($length,"8")
    $letters = ""
    GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
EndFunc
Func Button3Click()
    Form1Close()
EndFunc
Func Checkbox1Click()
    $letters = "num"
    GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
EndFunc
Func Checkbox2Click()
    $letters = "alpha"
    GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
EndFunc
Func Checkbox3Click()
    $letters = "alphabig"
    GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
EndFunc
Func Checkbox4Click()
    $letters = "allnum"
    GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
EndFunc
Func Checkbox5Click()
    $letters = "all"
    GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
    GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
EndFunc
Func Form1Close()
 exit
EndFunc
Func Form1Maximize()
    GUISetState(@SW_MAXIMIZE)
EndFunc
Func Form1Minimize()
    GUISetState(@SW_MINIMIZE)
EndFunc
Func Form1Restore()
    GUISetState(@SW_SHOW)
EndFunc

Func _PWgen($I_Lenght,$I_letter)
    Local $pass
If $I_Lenght <= 7 Or $I_Lenght >= 16 Then
    Return "Sorry password must be between 8 and 15 Characters"
Else
If $I_letter = "num" Then
    If GuiCtrlRead($Checkbox1) = $GUI_CHECKED Then
For $i = 0 to $I_Lenght -1
    $pass &= Random(0,9,1)
Next
Return $pass
Else
    Return "No Lettertable Selected please select a Preset"
EndIf
ElseIf $I_letter = "alpha" Then
    If GuiCtrlRead($Checkbox2) = $GUI_CHECKED Then
For $i = 0 to $I_Lenght -1
    $pass &= Chr(Random(97,122,1))
Next
Return $pass
Else
    Return "No Lettertable Selected please select a Preset"
EndIf
ElseIf $I_letter = "alphabig" Then
    If GuiCtrlRead($Checkbox3) = $GUI_CHECKED Then
For $i = 0 to $I_Lenght -1
    $pass &= Chr(Random(65,90,1))
Next
Return $pass
Else
    Return "No Lettertable Selected please select a Preset"
EndIf
ElseIf $I_letter = "allnum" Then
    If GuiCtrlRead($Checkbox4) = $GUI_CHECKED Then
For $i = 0 to $I_Lenght -5
    $pass &= Chr(Random(65,90,1))
    $pass &= Chr(Random(97,122,1))
Next
Return $pass
Else
    Return "No Lettertable Selected please select a Preset"
EndIf
ElseIf $I_letter = "all" Then
    If GuiCtrlRead($Checkbox5) = $GUI_CHECKED Then
For $i = 0 to $I_Lenght -7
    $pass &= Chr(Random(65,90,1))
    $pass &= Chr(Random(97,122,1))
    $pass &= Chr(Random(33,47,1))
    $pass &= Random(0,9,1)
Next
Return $pass
Else
    Return "No Lettertable Selected please select a Preset"
EndIf
Else
    Return "No Lettertable Selected please select a Preset"
EndIf
EndIf
EndFunc
Edited by unixu

Share this post


Link to post
Share on other sites



Nice little program, doesn't like that it copies the pass to clipboard directly, the user might have something else there.

Also if you use a length that is not accepted it still says "Coped to clipboard" (and does it)


[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

Share this post


Link to post
Share on other sites

fixed the clipboard stuff itz not copied anymore

Share this post


Link to post
Share on other sites

Very Nice!!

Share this post


Link to post
Share on other sites

Very Good But Not Save text Enble And Generator 2000-1000 In One Clcik.

Share this post


Link to post
Share on other sites

Following a 5-year old post?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

DatMCEyeBall,

Not a pleasant comment and definitely not a pleasant image. Please re-read this post - particularly the third paragraph. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0