Class: Girbot::BruteForce
- Inherits:
-
Step
- Object
- StepFoundation
- Step
- Girbot::BruteForce
- Defined in:
- lib/girbot/steps/brute_force.rb
Instance Attribute Summary
Attributes inherited from StepFoundation
Instance Method Summary collapse
Methods included from WatirShortcuts
#append_to_textfield, #browser, #click, #close, #exec_js, #fire_event, #goto, #maximize, #screenshot, #select_value, #text_in_textfield
Methods inherited from StepFoundation
#initialize, read, run, #take_whole_action, #validate_auth, #validate_browser_presence, #validate_card, #wait_for_sms
Constructor Details
This class inherits a constructor from Girbot::StepFoundation
Instance Method Details
#action(options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/girbot/steps/brute_force.rb', line 3 def action raise 'missing url option' if [:url].nil? raise 'missing users option' if [:users].nil? raise 'missing passwords option' if [:passwords].nil? raise 'missing username_field option' if [:username_field].nil? raise 'missing password_field option' if [:password_field].nil? raise 'missing login_button option' if [:login_button].nil? raise 'missing break_condition option' if [:break_condition].nil? goto [:url] users = read_file([:users]) passwords = read_file([:passwords]) users.each do |user| passwords.each do |password| puts "trying: #{user}:#{password}" text_in_textfield(user, [:username_field]) text_in_textfield(password, [:password_field]) click('button', [:login_button]) if eval [:break_condition] puts "success: #{user}:#{password}" break end end end end |
#read_file(path) ⇒ Object
31 32 33 |
# File 'lib/girbot/steps/brute_force.rb', line 31 def read_file path File.read(path).lines.map(&:strip) end |