Vbscript Password Complexity Checker - or stand alone utility

Hello..

I am looking to find some vbscript code to check for password complexity.  I would like to provide the script a password and have it rate the complexity of the password.  I intend to pass several thousand passwords to a  script and have it generate a csv file with the password data {ie rated passwords /strong/med/weak}  I then want to put the data into excel and generate some data...  I am open to some stand alone util...but it needs to be something that I can shell out to.

A second thing that I am looking for is an ASP Password Complexity checker that I can put up for users...  ie they enter a password and it will tell them how complex their password is.  
Any help or direction would be appreciated.    Thanks :)

LVL 1
fertigjAsked:
Who is Participating?
 
swinslowConnect With a Mentor Commented:

First of all, what are your password rules for being complex enough?
Here is an example of the following rules:
   Minimum length 8 characters
   One or more lowercase letters
   One or more Uppercase letters
   One or more numbers
   
   Function IsComplex(ThePassword)
     IsComplex = True

     'Check Length
     If Len(IsComplex) < 8 Then
        IsComplex = False
     End If

     'Check for lowercase letters
     HasLowerCase = False
     For x = 97 to 122
        If Instr(1,ThePassword,chr(x)) > 0 Then
           HasLowerCase = True
        End If
     Next
     If HasLowerCase = False Then
        IsComplex = False
     End If

     'Check for uppercase letters
     HasUpperCase = False
     For x = 65 to 90
        If Instr(1,ThePassword,chr(x)) > 0 Then
           HasUpperCase = True
        End If
     Next
     If HasUpperCase = False Then
        IsComplex = False
     End If

     'Check for numbers
     HasNumber = False
     For x = 48 to 57
        If Instr(1,ThePassword,chr(x)) > 0 Then
           HasNumber = True
        End If
     Next
     If HasNumber = False Then
        IsComplex = False
     End If

   End Function

   Response.Write IsComplex("Qwerty12")
0
 
RobSampsonCommented:
Hi, have a look at this article:
Walkthrough: Validate That Passwords Are Complex (Visual Basic)
http://msdn2.microsoft.com/en-us/library/b05h65z0(VS.80).aspx

It's written in VB.Net, but you should be able to convert the Regular Expressions commands to VBS.

Regards,

Rob.
0
 
fertigjAuthor Commented:
Exactly what I was looking for..  Thanks :)

The version that I am using...  


'Snip here
'-------------------------------------------------

WScript.echo IsComplex("SomePasswordHere")

 
   Function IsComplex(ThePassword)
      iStrength = 0    
     
      'Check Length
      If Len(ThePassword) >= 8 Then iStrength = iStrength + 1
         
      'Check for lowercase letters
      IF CheckValue(97,122,ThePassword) Then iStrength = iStrength + 1
     
     'Check for uppercase letters
      If CheckValue(65,90,ThePassword)  Then iStrength = iStrength + 1
     
     'Check for numbers
      If CheckValue(48,57,ThePassword)  Then iStrength = iStrength + 1
     
      'Check for Special Characters
      If CheckValue(33,47,ThePassword)  Then iStrength = iStrength + 1
      If CheckValue(58,64,ThePassword)  Then iStrength = iStrength + 1
      If CheckValue(91,96,ThePassword)  Then iStrength = iStrength + 1
      If CheckValue(123,255,ThePassword)  Then iStrength = iStrength + 1
     
     
      Select Case iStrength
        Case 0,1,2            IsComplex = "Weak"  
        Case 3                  IsComplex = "Moderate"
        Case 4                 IsComplex = "Strong"
        Case 5,6,7,8      IsComplex = "Very Strong"
      End Select
     
      'Clear out Password Var
      ThePassword = ""
   End Function


Function CheckValue(x,y,ThePassword)
       iLoopVar=0
       CheckValue = False
       For iLoopVar= x To y
        If Instr(1,ThePassword,chr(iLoopVar)) > 0 Then
         CheckValue=True
        End If
       Next
 End Function


'Snip Here------------------------------------
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.