Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON LANGUAJE A cyber-security company called UltraHackz is interested in finding talented computer science students. To do so, they post a challenge you find very

PYTHON LANGUAJE

A cyber-security company called UltraHackz is interested in finding talented computer science students. To do so, they post a challenge you find very interesting. They upload a txt file that contains 100 records containing information about 100 system accounts. Each record has a username, a salt value, and a hashed password.

Each record is stored as follows: ,, That is, there is one line per record in the file, where the three values are separated by commas. Your job is to find the real password associated with each of the accounts. They tell you that all passwords contain only numbers (0-9), and that each password is at least 3 characters long, and at most 7 characters long. Your task is to implement a recursive method to generate all possible passwords (brute force). To make it interesting, UltraHackz posted the following rules: The method MUST be recursive Numbers 3 and 7 are not be hard-coded inside the method that generates the passwords; they should be parameters of the method You can have at most two nested loops inside this method (less than two is perfectly fine as well). Every time you generate a string s, you need to check if s is the password of any of the usernames in the file. To do so, concatenate s with a users salt value, and apply the hashlib.sha256 method to the resulting string. If the output generated by sha256 matches the hashed string for that account, string s is the real accounts password!

----------------------------------------------------------------------------------------------

CODE GIVEN

import hashlib

def hash_with_sha256(str):

hash_object = hashlib.sha256(str.encode('utf-8'))

hex_dig = hash_object.hexdigest()

return hex_dig

def main():

hex_dig = hash_with_sha256('this is how you hash a string with sha 256')

print(hex_dig)

main()

---------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions