Skip to content

Commit

Permalink
Adapt user check and login to the new request method. Usernames enume…
Browse files Browse the repository at this point in the history
…rated by title will be added to the wordlist in lowercase.
  • Loading branch information
atarantini committed Aug 7, 2011
1 parent 08cbbf0 commit fdbe67a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions wplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,25 @@ def login(self, username, password):
username -- Wordpress username
password -- Password for the supplied username
"""
data = self.request(self._login_url, [('log', username), ('pwd', password)])
if "ERROR" in data or "Error" in data or "login_error" in data:
return False
else:
data = self.request(self._login_url, [('log', username), ('pwd', password)], cache=False, data=True)
if data:
if "ERROR" in data or "Error" in data or "login_error" in data or "incorrect" in data.lower():
return False
return True
return False

def check_username(self, username):
"""Try to login into WordPress and check in the returned data contains username errors
username -- Wordpress username
"""
data = self.request(self._login_url, [('log', username), ('pwd', str(randint(1, 9999999)))])
if "ERROR" in data or "Error" in data or "login_error" in data:
if "usuario es incorrecto" in data or 'usuario no' in data or "Invalid username" in data:
return False
else:
data = self.request(self._login_url, [('log', username), ('pwd', str(randint(1, 9999999)))], cache=False, data=True)
if data:
if "ERROR" in data or "Error" in data or "login_error" in data:
if "usuario es incorrecto" in data or 'usuario no' in data or "Invalid username" in data:
return False
return True
else:
return True
return False

def find_username(self, url=False):
"""Try to find a suitable username searching for common strings used in templates that refers to authors of blog posts
Expand Down Expand Up @@ -260,6 +260,8 @@ def enumerate_usernames(self, gap_tolerance=0):
username_title = self.get_user_from_title(data)
if username_title and username_title not in usernames:
usernames.append(username_title)
if username_title.lower() not in usernames:
usernames.append(username_title.lower())
gaps = 0

# Check for author in content
Expand Down

0 comments on commit fdbe67a

Please sign in to comment.