Class: WPScan::Finders::Finder::BreadthFirstDictionaryAttack::ProgressTracker
- Inherits:
-
Object
- Object
- WPScan::Finders::Finder::BreadthFirstDictionaryAttack::ProgressTracker
- Defined in:
- lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb
Overview
Tracks progress for password attack
Instance Attribute Summary collapse
-
#progress_bar ⇒ Object
readonly
Returns the value of attribute progress_bar.
Instance Method Summary collapse
- #adjust_total_on_success(username) ⇒ Object
- #increment ⇒ Object
-
#initialize(progress_bar:, total_passwords:) ⇒ ProgressTracker
constructor
A new instance of ProgressTracker.
- #log(message) ⇒ Object
- #record_request(username) ⇒ Object
- #requests_for_user(username) ⇒ Object
- #stop ⇒ Object
- #update_title(username, password, retry_count, max_retries) ⇒ Object
Constructor Details
#initialize(progress_bar:, total_passwords:) ⇒ ProgressTracker
Returns a new instance of ProgressTracker.
12 13 14 15 16 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 12 def initialize(progress_bar:, total_passwords:) @progress_bar = @total_passwords = total_passwords @user_requests_count = Hash.new(0) end |
Instance Attribute Details
#progress_bar ⇒ Object (readonly)
Returns the value of attribute progress_bar.
10 11 12 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 10 def @progress_bar end |
Instance Method Details
#adjust_total_on_success(username) ⇒ Object
35 36 37 38 39 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 35 def adjust_total_on_success(username) @progress_bar.total -= @total_passwords - @user_requests_count[username] rescue ProgressBar::InvalidProgressError # Due to Typhoeus threads, progress bar might be in invalid state end |
#increment ⇒ Object
31 32 33 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 31 def increment @progress_bar.increment unless @progress_bar.progress == @progress_bar.total end |
#log(message) ⇒ Object
41 42 43 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 41 def log() @progress_bar.log() end |
#record_request(username) ⇒ Object
18 19 20 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 18 def record_request(username) @user_requests_count[username] += 1 end |
#requests_for_user(username) ⇒ Object
22 23 24 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 22 def requests_for_user(username) @user_requests_count[username] end |
#stop ⇒ Object
45 46 47 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 45 def stop @progress_bar.stop end |
#update_title(username, password, retry_count, max_retries) ⇒ Object
26 27 28 29 |
# File 'lib/wpscan/finders/finder/breadth_first_dictionary_attack.rb', line 26 def update_title(username, password, retry_count, max_retries) retry_info = retry_count.positive? ? " (retry #{retry_count}/#{max_retries})" : '' @progress_bar.title = "Trying #{username} / #{password}#{retry_info}" end |