Skip to content
Permalink
61dc47a6ca
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
24 lines (18 sloc) 821 Bytes
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"