• LOGIN
  • No products in the cart.

DevOps on AWS – Python Scripts 12 : Password Security Policy

pwdSecurityPolicy.py


import pwd

#initialize counters
erroruser = []
errorpass = []

#get password database
passwd_db = pwd.getpwall()

try:
    #check each user and password for validity
    for entry in passwd_db:
        username = entry[0]
        password = entry [1]
        if len(username) < 6:
            erroruser.append(username)
        if len(password) < 8:
            errorpass.append(username)

    #print results to screen
    print “The following users have an invalid userid (less than six characters):”
    for item in erroruser:
        print item
    print “nThe following users have invalid password(less than eight characters):”
    for item in errorpass:
        print item
except:
    print “There was a problem running the script.”

February 22, 2021

Contact Address

Rise ‘n’ Shine Technologies:
Third Floor, Plot No1(Part), near KPHB Metro Station, KPHB Bagyanagar Colony, Kukatpally Main road, Balanagar Mandal, Rangareddy Dist-500072

Landmarks : Above VIOLET & PURPLE, near PJR statue, kphb metro station

  8686 98 8042
rnstech.fmw@gmail.com

Location

All rights reserved.
error: Alert: Content is protected !!
X