Jump to content

My Password Generator


Marlo
 Share

Recommended Posts

Got a bit bored so i decided to make a GUI for a password generator. Its nothing to scream and shout about but it was func to code.

Features:

Ability to choose what characters are generated

choose any number of characters to generate

Simple GUI

Copy straight to clipboard

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>

Opt("GUIOnEventMode", 1)

Global $sUpper = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
Global $sLower = "a b c d e f g h i j k l m n o p q r s t u v w x y z "
Global $sSymbols = "! £ $ % ^ & * ( ) _ - + = # ~ @ ; : / ? . > , < \ | ¬ ` [ ] { } "
Global $sNumbers = "0 1 2 3 4 5 6 7 8 9 "

Global $bResultSwitch = False
Global $sResult

$winMain = GUICreate("Pass Generator", 325, 175, -1, -1)
$cbxUpper = GUICtrlCreateCheckbox("Uppercase Letters", 8, 16, 113, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$cbxLower = GUICtrlCreateCheckbox("Lowercase Letters", 8, 40, 113, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$cbxNumbers = GUICtrlCreateCheckbox("Numbers", 8, 88, 65, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$cbxSymbols = GUICtrlCreateCheckbox("Symbols", 8, 64, 65, 17)
$txtCount = GUICtrlCreateInput("10", 56, 110, 41, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
GUICtrlCreateLabel("Length:", 8, 112, 40, 17)
$btnGo = GUICtrlCreateButton("Generate", 24, 144, 75, 25, 0)
$txtResult = GUICtrlCreateEdit("", 128, 8, 185, 129, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$btnCopy = GUICtrlCreateButton("Copy to Clipboard", 168, 144, 99, 25, 0)
GUISetState(@SW_SHOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $winMain)
GUICtrlSetOnEvent($btnGo, "_Generate")
GUICtrlSetOnEvent($btnCopy, "_Copy")

While 1

WEnd

Func _Generate()
    Local $sLib
    Local $iCount = GUICtrlRead($txtCount)
    $sResult = ""
    If $iCount < 0 Or Not StringIsInt($iCount) Then Return 0
    If GUICtrlRead($cbxLower) = $GUI_CHECKED Then $sLib &= $sLower
    If GUICtrlRead($cbxUpper) = $GUI_CHECKED Then $sLib &= $sUpper
    If GUICtrlRead($cbxNumbers) = $GUI_CHECKED Then $sLib &= $sNumbers
    If GUICtrlRead($cbxSymbols) = $GUI_CHECKED Then $sLib &= $sSymbols
    If $sLib = "" Then Return 0
    StringStripWS($sLib, 3)
    Local $aLib = StringSplit($sLib, " ")
    For $I = 1 To $iCount
        $sResult &= $aLib[Random(1, $aLib[0])]
    Next
    GUICtrlSetData($txtResult, $sResult)
EndFunc

Func _Copy()
    Local $sText = GUICtrlRead($txtResult)
    If $sText <> "" Then
        ClipPut($sText)
    EndIf
EndFunc

Func _Exit()
    Exit
EndFunc

Any thoughts?

Edited by Marlo
Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...

Hey,

Figured I'd drop by and show some of the changes I made. The biggest change is the entire password generator basically works off modifying a "Passphrase". It takes a string you put in and Inserts random characters/numbers/symbols optional;[except one must be on] as well as a "leetify' option which basically takes your string and replaces Letters with either upper,lowercase,or two sets of leet text. The leet text is quite simple and not very complicated or complete.

Want to keep it simple for the purpose I have for it.

Uses

-Helps quickly generate passwords of decent strength which are still easy to copy by eye ( help desk stuff )

-Makes it easier to explain to superiors and clients what makes a password secure

-Helps prove that "high" security passwords don't have to be impossible to remember; sometimes takes multiple generations to find one that looks friendly

-Converts strings by chance to l33t

-Randomly inserts a Number/Symbol/Uppercase letter/ or Lowercase letter into a string [ At least one must be enabled ]

I'm Definately a novice here so if you have any suggestions feel free. Haven't heavily QA tested but as of right now I haven't been able to crash this build with any kind of string I've tried. I'm sure a user would find one though.

OP: Hope you don't mind I Modified yours instead of starting from scratch.

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.6.1
    Application Version: 1.00
    Author:         Darjeed

    Modified From: http://www.autoitscript.com/forum/topic/85528-my-password-generator/


    Script Function:
    Passphrase based Password Generator

    +Planned functions

    -Ability to control Randomization probability
    -Control of number of runs

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)

Global $sUpper = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
Global $sLower = "a b c d e f g h i j k l m n o p q r s t u v w x y z "
Global $sSymbols = "! $ % ^ & * _ - + = # ~ : / ? . , \ | "
Global $sNumbers = "0 1 2 3 4 5 6 7 8 9 "

Global $bResultSwitch = False
Global $sResult

$winMain = GUICreate("Pass Generator", 326, 182, -1, -1)
$cbxUpper = GUICtrlCreateCheckbox("Uppercase Letters", 8, 16, 113, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$cbxLower = GUICtrlCreateCheckbox("Lowercase Letters", 8, 40, 113, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$cbxNumbers = GUICtrlCreateCheckbox("Numbers", 8, 88, 65, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$cbxSymbols = GUICtrlCreateCheckbox("Symbols", 8, 64, 65, 17)
$cbxLeet = GUICtrlCreateCheckbox("Leetify", 8, 112, 97, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$txtPassphrase = GUICtrlCreateInput("", 160, 24, 129, 21)
$lblPassphrase = GUICtrlCreateLabel("Passphrase", 184, 8, 59, 17)
$btnGo = GUICtrlCreateButton("Generate", 24, 152, 75, 25)
$txtResult = GUICtrlCreateEdit("", 128, 56, 185, 89)
$btnCopy = GUICtrlCreateButton("Copy to Clipboard", 216, 152, 99, 25)

GUISetState(@SW_SHOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $winMain)
GUICtrlSetOnEvent($btnGo, "_Generate")
GUICtrlSetOnEvent($btnCopy, "_Copy")

While 1

WEnd

Func _Generate()
    Local $sPassphrase = GUICtrlRead($txtPassphrase)
    Local $sLib
    Local $optLEET = False
    $sResult = ""
    If GUICtrlRead($cbxLower) = $GUI_CHECKED Then $sLib &= $sLower
    If GUICtrlRead($cbxUpper) = $GUI_CHECKED Then $sLib &= $sUpper
    If GUICtrlRead($cbxNumbers) = $GUI_CHECKED Then $sLib &= $sNumbers
    If GUICtrlRead($cbxSymbols) = $GUI_CHECKED Then $sLib &= $sSymbols
    If GUICtrlRead($cbxLeet) = $GUI_CHECKED Then $optLEET = True
    If $sLib = "" Then Return 0
    StringStripWS($sLib, 3)
    Local $aLib = StringSplit($sLib, " ")
    If $sPassphrase = "" Then Return 0
    $sPassphrase = StringStripWS($sPassphrase,8)
    $sPassphrase = StringReplace($sPassphrase," ","")
    $aPassphrase = StringSplit($sPassphrase,"")
    Local $iCount = StringLen($sPassphrase)



    If $optLEET = True Then
        #Region;Leetify $aPassphrase

        Local $sLetters1 = "a b c d e f g h i j k l m n o p q r s t u v w x y z "
        Local $sLetters2 = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
        Local $sLetters3 = "4 8 ( |) 3 ph 6 # 1 j |< 1 * * 0 * kw R 5 7 * * * * * * "
        Local $sLetters4 = "@ * * * * * * * ! * * * * * * * * * $ + * * * * * * "
        Local $aLetters1 = StringSplit($sLetters1, " ")
        Local $aLetters2 = StringSplit($sLetters2, " ")
        Local $aLetters3 = StringSplit($sLetters3, " ")
        Local $aLetters4 = StringSplit($sLetters4, " ")
        Local $sLetterLoc
        Local $iRandom
        Local $sTemp


        For $i = 1 To $iCount

            $sLetterLoc = _ArraySearch($aLetters1, $aPassphrase[$i])


            If $sLetterLoc = -1 Then

            Else
                $iRandom = Random(1, 4, 1)

                If $iRandom = 1 Then
                    $aPassphrase[$i] = $aLetters1[$sLetterLoc]
                ElseIf $iRandom = 2 Then
                    $aPassphrase[$i] = $aLetters2[$sLetterLoc]
                ElseIf $iRandom = 3 Then
                    If $aLetters3[$sLetterLoc] = "*" Then
                    Else
                        $aPassphrase[$i] = $aLetters3[$sLetterLoc]
                    EndIf
                ElseIf $iRandom = 4 Then
                    If $aLetters4[$sLetterLoc] = "*" Then
                    Else
                        $aPassphrase[$i] = $aLetters4[$sLetterLoc]
                    EndIf
                EndIf
            EndIf

        Next
        #EndRegion;Leetify $aPassphrase
    EndIf








    For $i = 1 To $iCount
        If Random(0, 9) > 2 Then
            If Not $aPassphrase[$i] = "" Then

                $sResult &= $aPassphrase[$i]
            Else
                $sResult &= $aPassphrase[$i]
                $sResult &= $aLib[Random(1, $aLib[0])]
            EndIf
        Else
            $sResult &= $aPassphrase[$i]
            $sResult &= $aLib[Random(1, $aLib[0])]
        EndIf

    Next


    GUICtrlSetData($txtResult, $sResult)
EndFunc   ;==>_Generate


Func _Copy()
    Local $sText = GUICtrlRead($txtResult)
    If $sText <> "" Then
        ClipPut($sText)
    EndIf
EndFunc   ;==>_Copy


Func _Exit()
    Exit
EndFunc   ;==>_Exit
Link to comment
Share on other sites

And here comes my script to create a password string: :)

MsgBox(0,"",StringRegExpReplace('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', '(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)', '$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)&'$'&Random(1,62,1)))

:)

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...