Skip to content

Commit

Permalink
Doctests. Re-arrange of parser elements/arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
atarantini committed Jul 31, 2011
1 parent c4c87cb commit 39fa86a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Usage:
-eu, --enumerateusers Only enumerate users
-eut, --enumeratetolerance ENUMERATETOLERANCE User ID gap tolerance to use in username enumeration
-nf, --nofingerprint Don't fingerprint WordPress
--test Run python doctests (you can use a dummy URL here)


Examples:
Expand Down
9 changes: 7 additions & 2 deletions wpbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,21 @@ def run(self):
parser = argparse.ArgumentParser(description='Bruteforce WordPress login form to test password strenght. Currently supports threads, wordlist and basic username detection.')
parser.add_argument('url', type=str, help='base URL where WordPress is installed')
parser.add_argument('-w', '--wordlist', default=config.wordlist, help="worldlist file (default: "+config.wordlist+")")
parser.add_argument('-nk', '--nokeywords', action="store_false", help="Don't search keywords in content and add them to the wordlist")
parser.add_argument('-u', '--username', default=config.username, help="username (default: "+config.username+")")
parser.add_argument('-s', '--scriptpath', default=config.script_path, help="path to the login form (default: "+config.script_path+")")
parser.add_argument('-t', '--threads', type=int, default=config.threads, help="how many threads the script will spawn (default: "+str(config.threads)+")")
parser.add_argument('-p', '--proxy', default=None, help="http proxy (ex: http://localhost:8008/)")
parser.add_argument('-nk', '--nokeywords', action="store_false", help="Don't search keywords in content and add them to the wordlist")
parser.add_argument('-nf', '--nofingerprint', action="store_false", help="Don't fingerprint WordPress")
parser.add_argument('-eu', '--enumerateusers', action="store_true", help="Only enumerate users (withouth bruteforcing)")
parser.add_argument('-eut', '--enumeratetolerance', type=int, default=config.eu_gap_tolerance, help="User ID gap tolerance to use in username enumeration (default: "+str(config.eu_gap_tolerance)+")")
parser.add_argument('-nf', '--nofingerprint', action="store_false", help="Don't fingerprint WordPress")
parser.add_argument('--test', action="store_true", help="Run python doctests (you can use a dummy URL here)")
args = parser.parse_args()
config.wp_base_url = args.url
if args.test:
import doctest
doctest.testmod(wplib)
exit(0)
if args.wordlist:
config.wordlist = args.wordlist
if args.username:
Expand Down
9 changes: 8 additions & 1 deletion wplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ def rm_duplicates(seq):
"""Remove duplicates from a list
This Function have been made by Dave Kirby and taken from site http://www.peterbe.com/plog/uniqifiers-benchmark
>>> rm_duplicates([1, 2, 3, 3, 4])
[1, 2, 3, 4]
"""
seen = set()
return [x for x in seq if x not in seen and not seen.add(x)]

def filter_domain(domain):
""" Strips TLD and ccTLD (ex: .com, .ar, etc) from a domain name """
""" Strips TLD and ccTLD (ex: .com, .ar, etc) from a domain name
>>> filter_domain("www.dominio.com.ar")
'dominio'
"""
words = [".com", "www.", ".ar", ".cl", ".py", ".org", ".net", ".mx", ".bo", ".gob", ".gov", ".edu"]
for word in words:
domain = domain.replace(word, "")
Expand Down

0 comments on commit 39fa86a

Please sign in to comment.