Jump to content
themax90

Password Generator

Recommended Posts

If you need a random password, that has no logical method to it, and is COMPLETELY random. Here you go.

CODE
;============================================================================

; Combine types using BitOr.

Global Const $PasswordLettersUp = 1 ; Uppercase

Global Const $PasswordLettersDown = 2 ; Lower Case

Global Const $PasswordNumbers = 4 ; Numbers

; ============================================================================

; AutoIt Version : 3.1.1.130

; Author : Max Gardner(AutoIt Smith;king.of.all@comcast.net)

; Description :

; This function will create a completely random password based on number of

; characters and the type you want.

;

; $PassworcharLimit = Number of characters in your password

; $PasswordType = Upper-Lower Case and Number mix.

; 1 = Uppercase $PasswordLettersUp

; 2 = Lowercase $PasswordLettersDown

; 3 = Uppercase and Lowercase BitOr($PasswordLettersUp, $PasswordLettersDown)

; 4 = Numbers $PasswordNumbers

; 5 = Uppercase and Numbers BitOr($PasswordLettersUp, $PasswordNumbers)

; 6 = Lowercase and Numbers BitOr($PasswordLettersDown, $PasswordNumbers)

; 7 = Uppercase, Lowercase, and Numbers BitOr($PasswordLettersUp, $PasswordLettersDown, $PasswordNumbers)

; ============================================================================

Func GetPass($PasswordCharLimit = 16, $PasswordType = 7)

Local $Track = 1

Local $Password = ""

For $Track = 1 To $PasswordCharLimit Step 1

$Password = $Password & GetChar($PasswordType)

Next

Return $Password

EndFunc ;==>GetPass

Func GetChar($PwType)

Local $Pw[3]

Select

Case $PwType = 1

Return Chr(Random(65, 90, 1))

Case $PwType = 2

Return Chr(Random(97, 122, 1))

Case $PwType = 3

$Pw[0] = Random(65, 90, 1)

$Pw[1] = Random(97, 122, 1)

Return Chr($Pw[Random(0, 1, 1) ])

Case $PwType = 4

Return Chr(Random(48, 57, 1))

Case $PwType = 5

$Pw[0] = Random(48, 57, 1)

$Pw[1] = Random(65, 90, 1)

Return Chr($Pw[Random(0, 1, 1) ])

Case $PwType = 6

$Pw[0] = Random(48, 57, 1)

$Pw[1] = Random(97, 122, 1)

Return Chr($Pw[Random(0, 1, 1) ])

Case $PwType = 7

$Pw[0] = Random(48, 57, 1)

$Pw[1] = Random(65, 90, 1)

$Pw[2] = Random(97, 122, 1)

Return Chr($Pw[Random(0, 2, 1) ])

EndSelect

EndFunc ;==>GetChar

Here is the demonstration script w/ GUI.

;--------

; Generated Box | Numbers Box | gen button

; Checkbox1 | cbox2 | cbox 3

;--------

See my Fileman:

http://www.autoitscript.com/fileman/users/AutoIt%20Smith/

Edited by AutoIt Smith

Share this post


Link to post
Share on other sites

coulda saved alot of time by smackin' your hands on the keyboard :whistle:

As it turns out, I need a strong password that cannot be found out, and is completely random. I did not want to destroy my keyboard.

This script took 5 minutes, and did exactly what I want. I am happy with it. I am sharing it with the forum. Please make a comment on the script directly, as adversed to saying what I could have done instead. If you do not like it, please say it directly. Otherwise, I will not know what that weird post means.

Share this post


Link to post
Share on other sites

B3TA_SCR1PT3R's method also has a higher frequency of keys in the area being whacked.

Depends on what you need...

#)

edit: Nice app, AutoIt Smith!

Edited by nfwu

Share this post


Link to post
Share on other sites

This function will create a completely random password based on number of characters and the type you want.

Technically, computers are all logic, so it's not possible to be completely random, but "Pseudo-Random" like the number generated by the 'Random()' function.

But nice App!

Imma use it for my new Password folder

Share this post


Link to post
Share on other sites

Here's one i've been using for a long time, think Valik helped me with it when I 1st started on the forum

ConsoleWrite(Random_Password(15) & @LF)

Func Random_Password($MAXLENGTH)
   Local $PASSWORD = '', $LETTER, $I
   For $I = 1 To $MAXLENGTH
      $LETTER = Random(33, 126)
      $PASSWORD = $PASSWORD & Chr($LETTER)
   Next
   Return $PASSWORD
EndFunc   ;==>Random_Password

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Yes I guess I will be adding a symbols option in a bit. It will require a bit more coding because I must beable to combine it will all the styles

I'm just glad to be giving back to the community thats given me so much.

Share this post


Link to post
Share on other sites

I'm seeing how many times it takes to find words with this little script

Make sure you specify length before you run this thoug

Sleep(5000)
$count = 0
While 1
    
    ControlClick("Password Generator", "", "Button1")
    $count = $count+1
    ToolTip($count, 0, 0)
    Sleep(100)
    $text = WinGetText("Password Generator")
    If StringInStr($text, "paulie") Then;Change word here
        While 1
            ToolTip($count, 0, 0)
        Wend
    EndIf
WEnd

Share this post


Link to post
Share on other sites

Yes I guess I will be adding a symbols option in a bit. It will require a bit more coding because I must beable to combine it will all the styles

I'm just glad to be giving back to the community thats given me so much.

To combine it with all the styles you can try something like:

; AutoIt Version : 3.1.1.130
; Author : Max Gardner(AutoIt Smith;king.of.all@comcast.net)
; Description :
; This function will create a completely random password based on number of
; characters and the type you want.
;
; $PassworcharLimit = Number of characters in your password
; $PasswordType = Upper-Lower Case and Number mix.
; 1 = Uppercase $PasswordLettersUp
; 2 = Lowercase $PasswordLettersDown
; 3 = Uppercase and Lowercase BitOr($PasswordLettersUp, $PasswordLettersDown)
; 4 = Numbers $PasswordNumbers
; 5 = Uppercase and Numbers BitOr($PasswordLettersUp, $PasswordNumbers)
; 6 = Lowercase and Numbers BitOr($PasswordLettersDown, $PasswordNumbers)
; 7 = Uppercase, Lowercase, and Numbers BitOr($PasswordLettersUp, $PasswordLettersDown, $PasswordNumbers)
; 8 = Symbols
; 9 = Uppercase and Symbols
; 10 = Lowercase and Symbols
; 11 = Uppercase, Lowercase and Symbols
; 12 = Numbers and Symbols
; 13 = Uppercase, Numbers and Symbols
; 14 = Lowercase, Numbers and Symbols
; 15 = Uppercase, Lowercase, Numbers and Symbols
; ============================================================================
Func GetChar($iPwType)
    Local $aPw = '', $MaxType = 0
    Local $aType = StringSplit('1,2,4,8', ',')
    Local $sSymbols = StringSplit('! @ # $ % ^ & * ( ) \ | { } [ ] / " + - _ = < > : ; ? ' & Chr(96) & ' ' & Chr(39), ' ')
    Local $sRandom1 = Chr(Random(65, 90, 1))  ; Uppercase
    Local $sRandom2 = Chr(Random(97, 122, 1))    ; Lowercase
    Local $sRandom4 = Chr(Random(48, 57, 1)) ; Number
    Local $sRandom8 = $sSymbols[Random(1, $sSymbols[0], 1)]        ; Symbols

    For $x = 1 To $aType[0]
        $MaxType += Int($aType[$x])
    Next
    If Int($iPwType) > $MaxType Then Return('')
        
    For $x = $aType[0] To 1 Step -1
        If Int($aType[$x]) <= Int($iPwType) Then
            $aPw &= Eval('sRandom' & $aType[$x]) & ','
            $iPwType = Int($iPwType) - Int($aType[$x])
        EndIf
    Next        
    $aPw = StringSplit(StringTrimRight($aPw, 1), ',')
    Return $aPw[Random(1, $aPw[0], 1)]
EndFunc

Edit:

Added a safety check if $iPwType > $MaxType return Null.

Remove While statement.

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Why not generate passwords using Up, Left, Down, Right, Left analog stick click, Right analog stick click, Left trigger, Right trigger, Left bumper, Right bumper? XD

If you are lost, those are accepted XBOX 360 controller XBOX Live! password characters.

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

×
×
  • Create New...