Class: Arachni::Parser::Element::Link

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

Instance Attribute Summary

Attributes inherited from Base

#action, #auditable, #method, #orig, #raw, #url

Attributes inherited from Element::Auditable

#altered, #opts

Instance Method Summary collapse

Methods inherited from Base

#dup, #id

Methods inherited from Element::Auditable

#audit, #auditor, #debug?, #get_auditor, #get_status_str, #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 = {}) ⇒ Link

Returns a new instance of Link.



115
116
117
118
119
120
121
122
123
124
# File 'lib/arachni/parser/elements.rb', line 115

def initialize( url, raw = {} )
    super( url, raw )

    @action = @raw['href'] || @raw[:href] || @raw['action'] || @raw[:action]
    @method = 'get'

    @auditable = @raw['vars'] || @raw[:vars] || @raw['inputs'] || @raw[:inputs]
    @orig      = @auditable.deep_clone
    @orig.freeze
end

Instance Method Details

#audit_id(injection_str = '', opts = {}) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/arachni/parser/elements.rb', line 138

def audit_id( injection_str = '', opts = {} )
    vars = auditable.keys.sort.to_s
    url = @action.gsub( /\?.*/, '' )

    str = ''
    str += !opts[:no_auditor] ? "#{@auditor.class.info[:name]}:" : ''

    str += "#{url}:" + "#{self.type}:#{vars}"
    str += "=#{injection_str.to_s}" if !opts[:no_injection_str]
    str += ":timeout=#{opts[:timeout]}" if !opts[:no_timeout]

    return str
end

#http_request(url, opts) ⇒ Object



126
127
128
# File 'lib/arachni/parser/elements.rb', line 126

def http_request( url, opts )
    return @auditor.http.get( url, opts )
end

#simpleObject



130
131
132
# File 'lib/arachni/parser/elements.rb', line 130

def simple
    return { @action => @auditable }
end

#typeObject



134
135
136
# File 'lib/arachni/parser/elements.rb', line 134

def type
    Arachni::Module::Auditor::Element::LINK
end