Class: Arachni::Parser::Element::Base Abstract

Inherits:
Element::Auditable show all
Defined in:
lib/arachni/parser/elements.rb

Overview

This class is abstract.

Base element class.

Should be extended/implemented by all HTML/HTTP modules.

@author: Tasos “Zapotek” Laskos

<[email protected]>
<[email protected]>

@version: 0.1

Direct Known Subclasses

Cookie, Form, Header, Link

Instance Attribute Summary collapse

Attributes inherited from Element::Auditable

#altered, #opts

Instance Method Summary collapse

Methods inherited from Element::Auditable

#audit, #audit_id, #auditor, #debug?, #get_auditor, #get_status_str, #http_request, #info, #injection_sets, #override_instance_scope!, #override_instance_scope?, #print_debug, #print_error, #print_status, reset, restrict_to_elements!, #skip?, #submit

Methods included from Module::Utilities

#exception_jail, #get_path, #hash_keys_to_str, #normalize_url, #read_file, #seed, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize

Constructor Details

#initialize(url, raw = {}) ⇒ Base

Initialize the element.

Parameters:



79
80
81
82
# File 'lib/arachni/parser/elements.rb', line 79

def initialize( url, raw = {} )
    @raw   = raw.dup
    @url   = url.to_s
end

Instance Attribute Details

#actionString

The url to which the element points and should be audited against.

Ex. ‘href’ for links, ‘action’ for forms, etc.

Returns:



47
48
49
# File 'lib/arachni/parser/elements.rb', line 47

def action
  @action
end

#auditableObject

Returns the value of attribute auditable.



49
50
51
# File 'lib/arachni/parser/elements.rb', line 49

def auditable
  @auditable
end

#methodString

Method of the element.

Should represent a method in Module::HTTP.

Ex. get, post, cookie, header

Returns:

See Also:

  • Module::HTTP


71
72
73
# File 'lib/arachni/parser/elements.rb', line 71

def method
  @method
end

#origObject

Returns the value of attribute orig.



51
52
53
# File 'lib/arachni/parser/elements.rb', line 51

def orig
  @orig
end

#rawHash

Relatively ‘raw’ hash holding the element’s attributes, values, etc.

Returns:

  • (Hash)


58
59
60
# File 'lib/arachni/parser/elements.rb', line 58

def raw
  @raw
end

#urlString

The URL of the page that owns the element.

Returns:



38
39
40
# File 'lib/arachni/parser/elements.rb', line 38

def url
  @url
end

Instance Method Details

#dupObject



107
108
109
# File 'lib/arachni/parser/elements.rb', line 107

def dup
    self.class.new( @url.dup, @raw.dup )
end

#idString

Must provide a string uniquely identifying self.

Returns:



89
90
91
# File 'lib/arachni/parser/elements.rb', line 89

def id
    return @raw.to_s
end

#simpleObject

Must provide a simple hash representation of self



96
97
98
# File 'lib/arachni/parser/elements.rb', line 96

def simple

end

#typeObject

Must provide the element type, one of Module::Auditor::Element.



103
104
105
# File 'lib/arachni/parser/elements.rb', line 103

def type

end