Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
brute_campbell/test/test_brutus.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (18 sloc)
821 Bytes
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
import pytest | |
import sys | |
sys.path.append("./src/") | |
#Here the tests are all around the "brutus" module that assists in brute-forcing | |
#You will need to write tests for your own functions | |
import brutus | |
def test_incorrect(): | |
bad_guesses=["","NO","123","aejfhskdjfhkjsdfh","-1","Swordfish", " swordfish", "swordfish "] | |
for guess in bad_guesses: | |
b=brutus.Binary("./test/testbin") | |
b.run() | |
result=b.attempt("password:",guess,"Password Incorrect") | |
assert result==False, f"'{guess}' worked as a guess, but shouldn't have" | |
def test_correct(): | |
b=brutus.Binary("./test/testbin") | |
b.run() | |
result=b.attempt("password:","swordfish","Password Incorrect") | |
assert result==True, "The correct password was used, but brutus reported it incorrect" |