Question: Hello I have a python programming homework could you help me? In your third assignment, you are asked to make some additions to this program
Hello I have a python programming homework could you help me?
In your third assignment, you are asked to make some additions to this program in order for a python program to break salted and summarized passwords with a dictionary attack to have a brute-force attack feature.
import crypt
def testPass(cryptPass):
salt = cryptPass[0:2]
dictFile = open('dictionary.txt', 'r')
for word in dictFile.readlines():
word = word.strip(' ')
cryptWord = crypt.crypt(word,salt)
if cryptWord == cryptPass:
print('Found Password: '+word)
return
print ("Password not Found")
return
def main():
passFile = open('passwords.txt')
for line in passFile.readlines():
if ":" in line:
user = line.split(':')[0]
cryptPass = line.split(':')[1].strip(' ')
print("Cracking Password for: "+user)
testPass(cryptPass)
main()
Run the above code after creating the dictionary.txt and passwords.txt files. The sample contents of these files are as follows:
dictionary.txt:
123456
a12345
galatasaray
pass
password
password1
passwords.txt:
alice:HX.AqSXLEzDJw
bob:n3R9SinssLlTA
root:zBfgPnQII3muQ
The sample output is as follows:
Cracking Password for: alice
Found Password: a12345
Cracking Password for: bob
Password not Found
Cracking Password for:root
Password not Found
Modify the code above so that you can try and find all passwords that use the lengths of one to three lengths, uppercase and lower case combinations, and combinations of 1-6 digits (without using a dictionary), as well as to test words in the dictionary.
After the change you made, the following output will be obtained:
Cracking Password for: alice
Found Password: a12345
Cracking Password for: bob
Found Password: 943201
Cracking Password for: root
Found Password: A4A
The desired additional function must be provided by adding a feature that automatically tries all the possibilities in the program, not by adding new words to the dictionary. For example, without the word A4A in the dictionary to be used, your program should be able to find this password (because it is too short).



Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
