Vbscript  Password Complexity Checker - or stand alone utility

Posted on 2007-10-17
Last Modified: 2011-10-03

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 :)

Question by:fertigj
    LVL 65

    Expert Comment

    Hi, have a look at this article:
    Walkthrough: Validate That Passwords Are Complex (Visual Basic)

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


    LVL 4

    Accepted Solution


    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
         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
         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
         If HasNumber = False Then
            IsComplex = False
         End If

       End Function

       Response.Write IsComplex("Qwerty12")
    LVL 1

    Author Comment

    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)
           CheckValue = False
           For iLoopVar= x To y
            If Instr(1,ThePassword,chr(iLoopVar)) > 0 Then
            End If
     End Function

    'Snip Here------------------------------------

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Have you considered what group policies are backwards and forwards compatible? Windows Active Directory servers and clients use group policy templates to deploy sets of policies within your domain. But, there is a catch to deploying policies. The…
    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now