Class: Bugcrowd::Auth
- Inherits:
-
Object
- Object
- Bugcrowd::Auth
- Defined in:
- lib/scopes_extractor/platforms/bugcrowd/cookie.rb
Overview
Bugcrowd Auth Class
Class Method Summary collapse
Class Method Details
.cookie ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/scopes_extractor/platforms/bugcrowd/cookie.rb', line 8 def self. # Use Mechanize otherwise the login flow is a hell with Typhoeus mechanize = Mechanize.new submit_credentials(mechanize) = (mechanize) return unless end |
.dump_cookie(mechanize) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/scopes_extractor/platforms/bugcrowd/cookie.rb', line 28 def self.(mechanize) begin page = mechanize.get('https://bugcrowd.com/dashboard') rescue Mechanize::ResponseCodeError return end return unless page = page.header['Set-Cookie'] match = /_crowdcontrol_session=[\w-]+/.match() match[0] end |
.submit_credentials(mechanize) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/scopes_extractor/platforms/bugcrowd/cookie.rb', line 19 def self.submit_credentials(mechanize) login_page = mechanize.get('https://bugcrowd.com/user/sign_in') form = login_page.forms.first form.field_with(id: 'user_email').value = ENV.fetch('BUGCROWD_EMAIL', nil) form.field_with(id: 'user_password').value = ENV.fetch('BUGCROWD_PASSWORD', nil) form.submit end |