Sign in to follow this  
Followers 0
sandman

Password Checker Snippet

18 posts in this topic

#1 ·  Posted (edited)

Here's a little snippet I made from an algorithm. Look in the code for the algorithm, I am aware that it is simple, but I realized earlier that I knew virtually nothing about regular expressions and wanted to get to know them a bit more. After playing around a bit to make it fair (on my first try, the password 'a' was 'You call that a password?', yet 'a1' was 'Good', the best rating.)

The ratings are:

- You call that a password? You shouldn't trust this password for anything.

- Fair Meh, any average computer user would have to spend a long time guessing this.

- Normal It'll keep your parents away, unless they have the tools to bruteforce the password.

- Good Your password is worthy of trust!

- Very Good The best, obviously.

And finally, the code:

#cs
-- Check Password Strength --

All results add or subtract from the final score. The score is then calculated to a level of Fair, Normal, and Good.

Password length: += length * 2
Amount of numbers: += amt * 2
Alphanumeric: += 10
Non-alphanumeric: -= 10

#ce

#include <GUIConstants.au3>

$win = GUICreate("Password Checker", 293, 113, 193, 115)
$prompt = GUICtrlCreateLabel("Enter a password to check:", 75, 10, 134, 17)
$pwd = GUICtrlCreateInput("", 10, 30, 270, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
Global $lbl = GUICtrlCreateLabel("No Password Entered", 90, 70, 293, 17)
GUISetState(@SW_SHOW)

While 1
    Dim $strength = ""
    $read = GUICtrlRead($pwd)
    ; Length
        $strength += StringLen($read) * 2
    ; Amount of numbers
        $numexp = StringRegExp($read, "[123456789]", 3)
        If IsArray($numexp) Then
            $strength += UBound($numexp) * 2
        EndIf
    ; Check alphanumeric
        $abcexp = StringRegExp($read, "[abcdefghijklmnopqrstuvwxyz]", 3)
        If IsArray($numexp) And IsArray($abcexp) Then
            $strength += 10
        Else
            $strength -= 10
        EndIf
    ; Check special characters
        $specexp = StringRegExp($read, "[`~!@#$%^&*_+=;':""]", 3)
        If IsArray($specexp) Then
            $strength += 10
        EndIf
    If $strength > 0 And $strength < 15 Then
        GUICtrlSetData($lbl, "Fair")
    ElseIf $strength >= 15 And $strength < 30 Then
        GUICtrlSetData($lbl, "Normal")
    ElseIf $strength >= 30 And $strength < 45 Then
        GUICtrlSetData($lbl, "Good")
    ElseIf $strength >= 45 Then
        GUICtrlSetData($lbl, "Very Good")
    ElseIf $strength < 0 Then
        GUICtrlSetData($lbl, "You call that a password?")
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    Sleep(100)
WEnd

Update: I added the little meter pictures. 4 GIFs to go with the ratings now. This EXE is decompilable, if anyone doesn't trust me :)

P.S. There's no password for decompilation, just leave it blank.

PasswordStrength.exe (434.1K) Number of downloads: Posted Image

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites



Funny, it rates Good even though there are no $%# signs in it.. I always thought that was required to make an exceptionally strong password.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Funny, it rates Good even though there are no $%# signs in it.. I always thought that was required to make an exceptionally strong password.

Well many sites and applications don't allow special characters so I didn't include that. I'll add it, though, hold on.

Okay, now there's also a 'Very Good' option.

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

Anyone else?


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

This can be used in web-based scripts on registration forms, stuff like that. Feel free to use it as long as you give me some kind of credit, whether it's in the code, or in the About section, I don't care. :)


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

No, I didn't mean it to, but according to Manadar it does. Hold on, I'll test it out.


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Oops, here's a bug with the new EXE: Enter a password that gets a very good rating, then delete it.

Some glitch with GUICtrlSetImage, I think, because after the bug presents itself if you minimize, then maximize the window, it'll go back to normal.

:):guitar::P

Also, does anyone know who hosts trashbin.nfshost.com? If so, I'd like to request to take the hoster's IP address off the download page.. that's kind of confidential.

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

A 24 character Alpha-numeric password shows 'Very Good' lol... :)

Well it should, shouldn't it?

I think that's a fair rating for that type of password.


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

Feel free to use it as long as you give me some kind of credit, whether it's in the code, or in the About section, I don't care. :)

I meant that I could use it for password creation, when I signup for something new :P

Share this post


Link to post
Share on other sites

hmmm, I have some very weak passwords. Nice script :)


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

Nice Job. Just tried it on some of my passwords. :)

A little suggestion though. If you replace the following code the gui will not flicker anymore. :P

If $strength > 0 And $strength < 15 Then
        GUICtrlSetData($lbl, "Fair")
    ElseIf $strength >= 15 And $strength < 30 Then
        GUICtrlSetData($lbl, "Normal")
    ElseIf $strength >= 30 And $strength < 45 Then
        GUICtrlSetData($lbl, "Good")
    ElseIf $strength >= 45 Then
        GUICtrlSetData($lbl, "Very Good")
    ElseIf $strength < 0 Then
        GUICtrlSetData($lbl, "You call that a password?")
    EndIfoÝ÷ Ù«­¢+Ø%ÀÌØíÍÑÉ¹Ñ ÐìÀ¹ÀÌØíÍÑÉ¹Ñ ±ÐìÄÔQ¡¸(%Õ¥
ÑɱI ÀÌØí±°¤±ÐìÐìÅÕ½Ðí¥ÈÅÕ½ÐìÑ¡¸U%
ÑɱMÑÑ ÀÌØí±°°ÅÕ½Ðí¥ÈÅÕ½Ðì¤(±Í%ÀÌØíÍÑÉ¹Ñ ÐìôÄÔ¹ÀÌØíÍÑÉ¹Ñ ±ÐìÌÀQ¡¸(%Õ¥
ÑɱI ÀÌØí±°¤±ÐìÐìÅÕ½Ðí9½Éµ°ÅÕ½ÐìÑ¡¸U%
ÑɱMÑÑ ÀÌØí±°°ÅÕ½Ðí9½Éµ°ÅÕ½Ðì¤(±Í%ÀÌØíÍÑÉ¹Ñ ÐìôÌÀ¹ÀÌØíÍÑÉ¹Ñ ±ÐìÐÔQ¡¸(%Õ¥
ÑɱI ÀÌØí±°¤±ÐìÐìÅÕ½Ðí½½ÅÕ½ÐìÑ¡¸U%
ÑɱMÑÑ ÀÌØí±°°ÅÕ½Ðí½½ÅÕ½Ðì¤(±Í%ÀÌØíÍÑÉ¹Ñ ÐìôÐÔQ¡¸(%Õ¥
ÑɱI ÀÌØí±°¤±ÐìÐìÅÕ½ÐíYÉä½½ÅÕ½ÐìÑ¡¸U%
ÑɱMÑÑ ÀÌØí±°°ÅÕ½ÐíYÉä½½ÅÕ½Ðì¤(±Í%ÀÌØíÍÑÉ¹Ñ ±ÐìÀQ¡¸(%Õ¥
ÑɱI ÀÌØí±°¤±ÐìÐìÅÕ½Ðíe½Ô±°Ñ¡ÐÁÍÍݽÉüÅÕ½ÐìÑ¡¸U%
ÑɱMÑÑ ÀÌØí±°°ÅÕ½Ðíe½Ô±°Ñ¡ÐÁÍÍݽÉüÅÕ½Ðì¤(¹%

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Here's a little snippet I made from an algorithm. Look in the code for the algorithm, I am aware that it is simple, but I realized earlier that I knew virtually nothing about regular expressions and wanted to get to know them a bit more. After playing around a bit to make it fair (on my first try, the password 'a' was 'You call that a password?', yet 'a1' was 'Good', the best rating.)

The test is too weak, i have already created a real strong password maker/tester here. You should make your's like this one :)

Share this post


Link to post
Share on other sites

Eehh...It's okay. But it rated 125793256482 as good. I think that's a Very good.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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