From 0643195ec9119319122863b4240ed115f96278d8 Mon Sep 17 00:00:00 2001 From: James Shuttleworth Date: Thu, 30 Sep 2021 14:43:58 +0100 Subject: [PATCH] Added report outline doc --- .gitignore | 1 + requirements.txt | 2 + src/rainbow_generator.py | 2 +- submission/coursework.md | 84 ++++++++++++++++++++++++++++++++++++++++ submission/makeReport.py | 19 +++++++++ 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 submission/coursework.md create mode 100644 submission/makeReport.py diff --git a/.gitignore b/.gitignore index 4353a53..714dd72 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /rt-venv/ /src/answer.py /html/ +/submission/5062CEM_2021_22_SepJan_CW1_main_sit_0123456789.html diff --git a/requirements.txt b/requirements.txt index 838c4cf..7678359 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ simple-term-menu pdoc3 +markdown + diff --git a/src/rainbow_generator.py b/src/rainbow_generator.py index 05ef529..2b9d66a 100644 --- a/src/rainbow_generator.py +++ b/src/rainbow_generator.py @@ -87,7 +87,7 @@ def queryTable(hashValue,table, chainLength, hashFunc=targetHashFunction, guessF if debug: print(out) if h in table: if debug: print(f"Found hash in chain at position {i}, beginning with {table[h]}") - attempt= rebuildChain(table[h],hashValue, hashFunc, guessFunc, chainLength,minLen, maxLen, charset) + attempt= rebuildChain(table[h],hashValue, hashFunc, guessFunc, chainLength,minLen, maxLen, charset, debug=False) if attempt!=None: return attempt if debug: print("No matches found") diff --git a/submission/coursework.md b/submission/coursework.md new file mode 100644 index 0000000..a497980 --- /dev/null +++ b/submission/coursework.md @@ -0,0 +1,84 @@ +# 5062CEM Coursework 1 + + - Student ID: (INSERT YOUR STUDENT ID) + + +## Task 1: Passwords and Hashes (10%) + + If the hashes produced are all 2 bytes, how many possible hash values are there? Explain how you calculate this value. + + +(Insert your answer here) + + + With minimum password length of 3 and maximum of 6, and possible characters being all upper and lowecase letters and digits (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789) how many possible passwords are in our "search space"? Explain how you calculate this value. + + +(insert your answer here) + + + One of these numbers is larger than the other. What implications does this have for security if this hash function is used in storing passwords? What implications does this have for our rainbow table? + +## Task 2: Implementing the table (30%) + +Include your `generateTable` function below. The three back-ticks before and after the code tell Markdown that the text between should be marked-up as code. + + +``` python + +def generateTable(chainStarts, hashFunc, guessFunc, chainLength, minLen=3,maxLen=6,charset=defaultCharset): + """ Create a rainbow table for the given hash function + + Arguments: + chainStarts -- a list of starting values. The length of this list determines how many chains will be constructed. + hashFunc -- a hash function to be used in the hashing step. + guessFunc -- a function that can produce valid inputs to the hash function. The function should accept a value and the keyword arguments `minLen` (minimum guess length) `maxLen` (maximum guess length) and `charset` (a string containing all valid characters to be used in the table). These will be passed directly from the arguments of the same names given to this funciton. + chainLength -- length of each chain + minLen -- minimum length of values to be hashed + maxLen -- maximum length of values to be hashed + charset -- string containing all valid characters for values being hashed + +""" + + # Your code goes here + +``` + +## Task 3: Parameters (10%) + + Discuss how to select the best parameters for generating a rainbow table. + +(Write your answer here) + +Some hints: + + - You can change the number of chains and the length of each chain + - What effect does changing each of these have on: + - How well the table works, as in how many hashes it can break? + - How long it takes to create? + - How much space it takes up? + - How long it takes to search the chains for hashes? + + +## Task 4: Reversing Hashes (10%) + + What are possible passwords that produce the following hashes? + + - (Will add later) + - + +(Write your answers next to the hashes above. HINT: you can check your answers by putting them into the pearson hashN function and seeing if they give you the right hash) + + +## Task 5: Improving Guess Generation Efficiency (20%) + + The function that currently produces guesses is not as efficient as it could be. + + Discuss how the time it takes is related to the index argument and propose a solution that makes it independant of this value. + + +(Write your answer here) + +## Challenge: Web service compromise (20%) + +Details to follow diff --git a/submission/makeReport.py b/submission/makeReport.py new file mode 100644 index 0000000..ca94e84 --- /dev/null +++ b/submission/makeReport.py @@ -0,0 +1,19 @@ +import markdown + + +#Insert your student ID here +student_id="0123456789" + + + + +md = markdown.Markdown(extensions=['fenced_code']) + +input_filename = 'coursework.md' +output_filename = f'5062CEM_2021_22_SepJan_CW1_main_sit_{student_id}.html' + +with open(input_filename, 'r') as f: + html_text = md.convert(f.read())#, output_format='html4') + +with open(output_filename, "w") as f: + f.write(html_text)