Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Built better structure for project, added script to place targets
- Loading branch information
Showing
7 changed files
with
120 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -3,3 +3,6 @@ | ||
/brute_venv/ | ||
/html/ | ||
/src/__pycache__/ | ||
/test/__pycache__/ | ||
#*# | ||
/targets/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
bins=(basic1 basic2 basic3 intermediate1) | ||
|
||
rm -f targets/* | ||
|
||
for b in "${bins[@]}" | ||
do | ||
curl -o targets/$b "https://github.coventry.ac.uk/pages/csx239/naturan_demanto/bins/$b" | ||
done | ||
|
||
chmod u+x targets/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!python3 | ||
from brutus import Binary | ||
|
||
# This is a starting-point for your project | ||
# Most of the work is done for the basic task | ||
# Intermediate will require reading from a dictionary file and creating guesses based on the contents | ||
# For the advanced task, see the supporting module "brute_time" | ||
|
||
|
||
def breakBinary(target, promptText, failText): | ||
"""" Break into the given target binary. | ||
Assumes "basic" level binary, with PIN codes of 000-999 | ||
Args: | ||
target: path to the binary. e.g. "./bins/basic1" | ||
promptText: text to look for in the output that signals a password is required. e.g. "Password:" | ||
failText: text that indicates an attempt failed. e.g. "Password Incorrect" | ||
Returns: | ||
None: if no successful attempt was made | ||
string: a successful password""" | ||
|
||
|
||
#Here, the guesses are listed explicitly. We *could* write out | ||
#1000 guesses, but the point is to use the computer to do the | ||
#brute force work, not our fingers | ||
|
||
#For the basic task, the only functionality you need is to replace | ||
#the line below with code that can generate all the potential | ||
#guesses | ||
guesses=["000","001","002","003","004"] | ||
|
||
|
||
|
||
|
||
for g in guesses: | ||
|
||
#The actual attempt | ||
b=Binary(target) | ||
b.run() | ||
success=b.attempt(promptText,g, failText) | ||
|
||
|
||
if success: | ||
print(f"The Guess '{g}' appears to be correct") | ||
return g #Return the answer. No need to "break" because the return exits the function | ||
else: | ||
print(f"guess: {g} - Password incorrect!") | ||
return None #If we get here, it means we didn't return earlier in the loop with a successful guess | ||
|
||
|
||
if __name__=="__main__": | ||
|
||
|
||
# Create a simple menu system to pick the binary we want to force | ||
targets=[] | ||
targets.append(["targets/basic1","Password:", "Password Incorrect"]) | ||
targets.append(["targets/basic2","PW:", "ACCESS DENIED"]) | ||
targets.append(["targets/basic3","Got the PIN?", "NO"]) | ||
|
||
|
||
print("Basic Binary Breaker") | ||
print("Which binary do you want to brute force?") | ||
|
||
for c in range(len(targets)): | ||
print(f"{c}: {targets[c][0]}") | ||
|
||
selection=int(input("Enter the number of the binary to be forced: ")) | ||
|
||
if 0 <= selection < len(targets): | ||
target=targets[selection] | ||
breakBinary(target[0],target[1],target[2]) | ||
else: | ||
print("Invalid selection") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters