0% found this document useful (0 votes)
10 views1 page

Program 6

Uploaded by

pajam64327
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Program 6

Uploaded by

pajam64327
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Prog.

#Program 6
#Anubhav Bharti (16122)

import itertools

def brute_force_attack(target_password, characters='abcdefghijklmnopqrstuvwxyz'):


# T
for password_length in range(1, len(target_password) + 1):

for attempt in itertools.product(characters, repeat=password_length):

attempt_password = ''.join(attempt)
print(f"Trying: {attempt_password}")

if attempt_password == target_password:
return attempt_password

# Example target password


target_password = 'abc'
# target_password = input("Enter password string :")

# brute-force attack
found_password = brute_force_attack(target_password)

if found_password:
print(f"Password found: {found_password}")
else:
print("Password not found.")

output:

You might also like