Class: Nexpose::HTMLForms

Inherits:
Object
  • Object
show all
Includes:
XMLUtils
Defined in:
lib/nexpose/creds.rb

Overview

When using htmlform, this represents the login form information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XMLUtils

#make_xml, #parse_xml

Constructor Details

#initialize(parentpage, soft403, webapproot) ⇒ HTMLForms

Returns a new instance of HTMLForms.



343
344
345
346
347
348
# File 'lib/nexpose/creds.rb', line 343

def initialize(parentpage, soft403, webapproot)
  @parentpage = parentpage
  @soft403 = soft403
  @webapproot = webapproot
  @html_forms = []
end

Instance Attribute Details

#html_formsObject (readonly)

The forms to authenticate with



341
342
343
# File 'lib/nexpose/creds.rb', line 341

def html_forms
  @html_forms
end

#parentpageObject (readonly)

The URL of the login page containing the login form.



334
335
336
# File 'lib/nexpose/creds.rb', line 334

def parentpage
  @parentpage
end

#soft403Object (readonly)

A regular expression used to match against the response to identify authentication failures.



337
338
339
# File 'lib/nexpose/creds.rb', line 337

def soft403
  @soft403
end

#webapprootObject (readonly)

Base URL of the application for which the form authentication applies.



339
340
341
# File 'lib/nexpose/creds.rb', line 339

def webapproot
  @webapproot
end

Instance Method Details

#add_html_form(html_form) ⇒ Object



350
351
352
# File 'lib/nexpose/creds.rb', line 350

def add_html_form(html_form)
  @html_forms << html_form
end

#as_xmlObject Also known as: to_xml_elem



354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/nexpose/creds.rb', line 354

def as_xml
  attributes = {}
  attributes['parentpage'] = @parentpage
  attributes['soft403'] = @soft403
  attributes['webapproot'] = @webapproot

  xml = make_xml('HTMLForms', attributes)

  html_forms.each() do |html_form|
    xml.add_element(html_form.to_xml_elem)
  end
  xml
end