user is now a class
This commit is contained in:
@@ -40,7 +40,7 @@ module BruteForce
|
||||
queue_count += 1
|
||||
|
||||
# create local vars for on_complete call back, Issue 51.
|
||||
username = login
|
||||
username = login.name
|
||||
password = password
|
||||
|
||||
# the request object
|
||||
|
||||
@@ -24,7 +24,7 @@ module WpUsernames
|
||||
# Available options :
|
||||
# :range - default : 1..10
|
||||
#
|
||||
# returns an array of usernames (can be empty)
|
||||
# returns an array of WpUser (can be empty)
|
||||
def usernames(options = {})
|
||||
range = options[:range] || (1..10)
|
||||
browser = Browser.instance
|
||||
@@ -46,9 +46,7 @@ module WpUsernames
|
||||
end
|
||||
|
||||
unless username == nil and nickname == nil
|
||||
usernames << { :id => author_id,
|
||||
:name => username ? username : "empty",
|
||||
:nickname => nickname ? nickname : "empty"}
|
||||
usernames << WpUser.new(username, author_id, nickname)
|
||||
end
|
||||
end
|
||||
usernames = remove_junk_from_nickname(usernames)
|
||||
@@ -83,14 +81,14 @@ module WpUsernames
|
||||
def remove_junk_from_nickname(usernames)
|
||||
nicknames = []
|
||||
usernames.each do |u|
|
||||
nickname = u[:nickname]
|
||||
nickname = u.nickname
|
||||
unless nickname == "empty"
|
||||
nicknames << nickname
|
||||
end
|
||||
end
|
||||
junk = get_equal_string_end(nicknames)
|
||||
usernames.each do |u|
|
||||
u[:nickname] = u[:nickname].sub(/#{Regexp.escape(junk)}$/, "")
|
||||
u.nickname = u.nickname.sub(/#{Regexp.escape(junk)}$/, "")
|
||||
end
|
||||
usernames
|
||||
end
|
||||
|
||||
39
lib/wpscan/wp_user.rb
Normal file
39
lib/wpscan/wp_user.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
#--
|
||||
# WPScan - WordPress Security Scanner
|
||||
# Copyright (C) 2012
|
||||
#
|
||||
# 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/>.
|
||||
#++
|
||||
|
||||
class WpUser
|
||||
attr_accessor :name, :id, :nickname
|
||||
|
||||
def initialize(name, id, nickname)
|
||||
@name = name ? name : "empty"
|
||||
@id = id ? id : "empty"
|
||||
@nickname = nickname ? nickname : "empty"
|
||||
end
|
||||
|
||||
def <=>(item)
|
||||
item.name <=> @name and item.id <=> @id and item.nickname <=> @nickname
|
||||
end
|
||||
|
||||
def ===(item)
|
||||
item.name === @name and item.id === @id and item.nickname === @nickname
|
||||
end
|
||||
|
||||
def eql?(item)
|
||||
item.name === @name and item.id === @id and item.nickname === @nickname
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user