#validator.py
import hw4_util
def ruleOne(passwd):
if(len(passwd) <=25 and len(passwd)):
return True
else:
return False
def ruleTwo(passwd):
passwd = passwd.lower()
for common in passwds:
if(common == passwd):
return
False
return True
def ruleThree(passwd):
if((passwd.find('@') == -1 and passwd.find('$') == -1)
or passwd.find('%')!=-1):
return False
else:
return True
def ruleFour(passwd):
upper = False
lower = False
numRange = False
valid = True
for char in passwd:
if(char.isupper()):
upper =
True
elif(char.islower()):
lower =
True
elif(char.isnumeric()):
if(char >='1'
and char <= '4'):
numRange = True
else:
numRange = False
valid = False
break
if(valid == False):
return False
elif(upper and lower):
return True
elif(numRange == True):
return True
else:
return False
def ruleFive(passwd):
pre = ''
for char in passwd:
if(pre !=''):
if(char !=
'_'):
return False
else:
pre = ''
if(char.isupper()):
pre = char
if(pre.isupper()):
return False
return True
def ruleSix(passwd):
for char in passwd:
if(char.isnumeric()):
if(char < '1'
or char >'4'):
return False
return True
total_lists = hw4_util.get_number_of_password_lists() - 1
pos = int(input("Select the number of common passwords by entering
a number between 0 and "+str(total_lists)+" => "))
if(pos > total_lists):
print("Invalid input given")
exit()
passwds = hw4_util.get_password_list(pos)
choice = ''
while(choice !='q'):
passwd = input("Enter a password => ")
print(passwd)
one = ruleOne(passwd)
two = ruleTwo(passwd)
three = ruleThree(passwd)
four = ruleFour(passwd)
five = ruleFive(passwd)
six = ruleSix(passwd)
valid = one and two and three and four and six
if(one):
print("Rule 1 is satisifed")
else:
print("Rule 1 is not
satisifed")
if(two):
print("Rule 2 is satisifed")
else:
print("Rule 2 is not
satisifed")
if(three):
print("Rule 3 is satisifed")
else:
print("Rule 3 is not
satisifed")
if(four):
print("Rule 4 is satisifed")
else:
print("Rule 4 is not
satisifed")
if(five):
print("Rule 5 is satisifed")
else:
print("Rule 5 is not
satisifed")
if(six):
print("Rule 6 is satisifed")
else:
print("Rule 6 is not
satisifed")
if(valid):
print("password is valid")
else:
print("A suggested password is :
"+passwd[:3] + "42" + passwd[-3:])
choice = input("Enter q to quit, Any key to
continue")
#hw4_util.py
pass_lists = ["top25.txt","top100.txt"]
def get_number_of_password_lists():
return len(pass_lists)
def get_password_list(index):
f = open(pass_lists[index],"r")
line = f.readline()
passwds = []
while(line):
line = line.strip().lower()
passwds.append(line)
line = f.readline()
f.close()
return passwds





Part 1: Is this Crazy Password Valid? A good password (in this strange system) should have...
I have a python project that requires me to make a password saver. The major part of the code is already giving. I am having trouble executing option 2 and 3. Some guidance will be appreciated. Below is the code giving to me. import csv import sys #The password list - We start with it populated for testing purposes passwords = [["yahoo","XqffoZeo"],["google","CoIushujSetu"]] #The password file name to store the passwords to passwordFileName = "samplePasswordFile" #The encryption key for the caesar...
Password Validation Write a program called PasswordValidationYourLastName that validates a new password, following these guidelines: Must be at least 8 characters Must have at least 1 uppercase letter Must have at least 1 lowercase letter Must have at least 1 digit Write a program that asks for a password, and then asks again to confirm it (you can use the scanner or JOptionPane). Pass those two Strings to a method called validatePassword( ). Your validatePassword( ) should return a boolean...
Convert this code written in Python to Java: username=input("please enter a username") password=input("please enter a password:") def is_a password(password): count_uppercase, count_lowercase= 0, 0 for characters1 in password: if characters1.isupper(): count_uppercase += 1 if characters1.islower(): count_lowercase += 1 is_password is good = True if len(password) <= 7: print "Passwords must be at least 8 characters long" is_password is good = False if count_uppercase < 1: print "Your password must...
Write a program that asks the user to enter a password, and then checks it for a few different requirements before approving it as secure and repeating the final password to the user. The program must re-prompt the user until they provide a password that satisfies all of the conditions. It must also tell the user each of the conditions they failed, and how to fix it. If there is more than one thing wrong (e.g., no lowercase, and longer...
please help me out and input values please .. main cpp..
please follow intructions exactly witj clarity please
CSE 110-Intro to Computer Programming Project #3 Requirements-String Class Functions and Test Case Documentation Using the String Class, design and develop a multi-file password validation program and Test case Document (10% of grade) that requests a password, and validates it based on the following criteria. The password must be at least 8 characters long, contain at least one number, and at least...
A hacker has programmed their computer to generate, uniformly at random, an eight-character password, with each character being either one of 26 lower-case letters (a-z), one of 26 upper-case letters (A-Z) or one of 10 integers (0-9). The hacker wants to infiltrate a website that has 2 million users. Assume, for simplicity, that each user is required to use a unique password. i. What is the expected number of attempts before the hacker successfully generates a user password? ii. What...
Write the Code in C program. Create a random password generator that contains a user-specified number of characters. Your program should prompt the user for the desired length of the password. Length of password: To create your password, use the random number generator in the stdlib.h C library. To generate random numbers, you will need the srand() and rand() functions. srand(seed) is used to "seed" the random number generator with the given integer, seed. Prompt the user for the seed...
8.4 in python
function that checks whether a string is a valid password. Suppose the pas rules are as follows: . A password must have at least eight characters - A password must consist of only letters and digits. ■ A password must contain at least two digits. Write a program that prompts the user to enter a password and displays valid password if the rules are followed or invalid password otherwise (Occurrences of a specified character) Write a function...
Please make this Python code execute properly. User needs to create a password with at least one digit, one uppercase, one lowercase, one symbol (see code), and the password has to be atleast 8 characters long. try1me is the example I used, but I couldn't get the program to execute properly. PLEASE INDENT PROPERLY. def policy(password): digit = 0 upper = 0 lower = 0 symbol = 0 length = 0 for i in range(0, len(password)): if password[i].isdigit(): # checks...