-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of workers that manage tasks
- Loading branch information
1 parent
3b5b535
commit 03c21f3
Showing
3 changed files
with
90 additions
and
38 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
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,54 @@ | ||
""" | ||
wpbf is a WordPress BruteForce script to remotely test password strength of the WordPress blogging software | ||
Copyright 2011 Andres Tarantini (atarantini@gmail.com) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
from wplib import Wp | ||
|
||
class WpTask(): | ||
"""Base task class""" | ||
def run(self): | ||
pass | ||
|
||
class WpTaskStop(Exception): | ||
"""Stop all tasks""" | ||
def __str__(self): | ||
return 'Stop all tasks!' | ||
|
||
class WpTaskFingerprint(Wp, WpTask): | ||
"""Perform WordPress fingerprint and, is positive, log the results""" | ||
def run(self): | ||
self.logger.info("WordPress version: %s", self.fingerprint()) | ||
|
||
class WpTaskLogin(Wp, WpTask): | ||
"""Perform WordPress login. If login is positive, will return true or false otherwise. | ||
Note that username and password must be set invoking setUsername and setPassword methods. | ||
""" | ||
_username = '' | ||
_password = '' | ||
|
||
def setUsername(self, username): | ||
self._username = username | ||
|
||
def setPassword(self, password): | ||
self._password = password | ||
|
||
def run(self): | ||
if self.login(self._username, self._password): | ||
# username and password found: log data and stop all tasks | ||
self.logger.info("Password '%s' found for username '%s' on %s", self._password, self._username, self.get_login_url()) | ||
raise WpTaskStop |