Uses an enumerator to read wordlist during pwd attack. Fixes #1518
This commit is contained in:
@@ -41,7 +41,7 @@ module WPScan
|
|||||||
msg: "Performing password attack on #{attacker.titleize} against #{users.size} user/s")
|
msg: "Performing password attack on #{attacker.titleize} against #{users.size} user/s")
|
||||||
end
|
end
|
||||||
|
|
||||||
attacker.attack(users, passwords(ParsedCli.passwords), attack_opts) do |user|
|
attacker.attack(users, ParsedCli.passwords, attack_opts) do |user|
|
||||||
found << user
|
found << user
|
||||||
|
|
||||||
attacker.progress_bar.log("[SUCCESS] - #{user.username} / #{user.password}")
|
attacker.progress_bar.log("[SUCCESS] - #{user.username} / #{user.password}")
|
||||||
@@ -122,15 +122,6 @@ module WPScan
|
|||||||
acc << Model::User.new(elem.chomp)
|
acc << Model::User.new(elem.chomp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param [ String ] wordlist_path
|
|
||||||
#
|
|
||||||
# @return [ Array<String> ]
|
|
||||||
def passwords(wordlist_path)
|
|
||||||
@passwords ||= File.open(wordlist_path).reduce([]) do |acc, elem|
|
|
||||||
acc << elem.chomp
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ describe WPScan::Controller::PasswordAttack do
|
|||||||
|
|
||||||
describe '#users' do
|
describe '#users' do
|
||||||
context 'when no --usernames' do
|
context 'when no --usernames' do
|
||||||
it 'calles target.users' do
|
it 'calls target.users' do
|
||||||
expect(controller.target).to receive(:users)
|
expect(controller.target).to receive(:users)
|
||||||
controller.users
|
controller.users
|
||||||
end
|
end
|
||||||
@@ -40,10 +40,6 @@ describe WPScan::Controller::PasswordAttack do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#passwords' do
|
|
||||||
xit
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#run' do
|
describe '#run' do
|
||||||
context 'when no --passwords is supplied' do
|
context 'when no --passwords is supplied' do
|
||||||
it 'does not run the attacker' do
|
it 'does not run the attacker' do
|
||||||
|
|||||||
@@ -24,11 +24,13 @@ describe WPScan::Finders::Passwords::XMLRPC do
|
|||||||
</methodResponse>'
|
</methodResponse>'
|
||||||
|
|
||||||
describe '#attack' do
|
describe '#attack' do
|
||||||
|
let(:wordlist_path) { FINDERS_FIXTURES.join('passwords.txt').to_s }
|
||||||
|
|
||||||
context 'when no valid credentials' do
|
context 'when no valid credentials' do
|
||||||
before do
|
before do
|
||||||
stub_request(:post, url).to_return(status: status, body: RESPONSE_403_BODY)
|
stub_request(:post, url).to_return(status: status, body: RESPONSE_403_BODY)
|
||||||
|
|
||||||
finder.attack(users, %w[pwd])
|
finder.attack(users, wordlist_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:users) { %w[admin].map { |username| WPScan::Model::User.new(username) } }
|
let(:users) { %w[admin].map { |username| WPScan::Model::User.new(username) } }
|
||||||
|
|||||||
1
spec/fixtures/finders/passwords.txt
vendored
Normal file
1
spec/fixtures/finders/passwords.txt
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pwd
|
||||||
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|||||||
s.executables = ['wpscan']
|
s.executables = ['wpscan']
|
||||||
s.require_paths = ['lib']
|
s.require_paths = ['lib']
|
||||||
|
|
||||||
s.add_dependency 'cms_scanner', '~> 0.11.0'
|
s.add_dependency 'cms_scanner', '~> 0.12.0'
|
||||||
|
|
||||||
s.add_development_dependency 'bundler', '>= 1.6'
|
s.add_development_dependency 'bundler', '>= 1.6'
|
||||||
s.add_development_dependency 'memory_profiler', '~> 0.9.13'
|
s.add_development_dependency 'memory_profiler', '~> 0.9.13'
|
||||||
|
|||||||
Reference in New Issue
Block a user