Module: Arachni::Element::Capabilities::Submittable
- Included in:
 - Arachni::Element::Cookie, DOM::Capabilities::Submittable, Form, Form::Capabilities::Submittable, Header, JSON, Link, Link::Capabilities::Submittable, Link::DOM, LinkTemplate, LinkTemplate::DOM, NestedCookie, NestedCookie::Capabilities::Submittable, XML
 
- Defined in:
 - lib/arachni/element/capabilities/submittable.rb
 
Overview
Instance Method Summary collapse
- 
  
    
      #action  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
URI to which the element points and should be audited against.
 - #action=(url) ⇒ Object
 - #dup ⇒ Object
 - #http ⇒ Arachni::HTTP
 - 
  
    
      #http_request(opts, &block)  ⇒ HTTP::Request 
    
    
  
  
  
  
  
  abstract
  
  
  
    
Must be implemented by the including class and perform the appropriate HTTP request (get/post/whatever) for the current element.
 - 
  
    
      #id  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
String uniquely identifying self.
 - #initialize(options) ⇒ Object
 - 
  
    
      #method(*args)  ⇒ Symbol 
    
    
      (also: #http_method)
    
  
  
  
  
  
  
  
  
  
    
Should represent a method in Check::HTTP.
 - #method=(method) ⇒ Object (also: #http_method=)
 - 
  
    
      #platforms  ⇒ Platform 
    
    
  
  
  
  
  
  
  
  
  
    
Applicable platforms for the #action resource.
 - 
  
    
      #submit(options = {}, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Submits `self` to the #action URL with the appropriate parameters.
 - #to_h ⇒ Object
 
Instance Method Details
#action ⇒ String
Ex. 'href' for links, 'action' for forms, etc.
Returns URI to which the element points and should be audited against.
      51 52 53  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 51 def action @action.freeze end  | 
  
#action=(url) ⇒ Object
      56 57 58  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 56 def action=( url ) @action = self.url ? to_absolute( url, self.url ) : normalize_url( url ) end  | 
  
#dup ⇒ Object
      114 115 116 117 118 119  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 114 def dup new = super new.method = self.method new.action = self.action new end  | 
  
#http ⇒ Arachni::HTTP
      102 103 104  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 102 def http HTTP::Client end  | 
  
#http_request(opts, &block) ⇒ HTTP::Request
Must be implemented by the including class and perform the appropriate HTTP request (get/post/whatever) for the current element.
Invoked by #submit to submit the object.
      97 98 99  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 97 def http_request( opts, &block ) fail NotImplementedError end  | 
  
#id ⇒ String
Differences in input values will be taken into consideration.
Returns String uniquely identifying self.
      110 111 112  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 110 def id "#{type}:#{method}:#{action}:#{inputtable_id}" end  | 
  
#initialize(options) ⇒ Object
      15 16 17 18 19  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 15 def initialize( ) super self.method ||= [:method] || :get self.action ||= [:action] || self.url end  | 
  
#method(*args) ⇒ Symbol Also known as: http_method
Should represent a method in Check::HTTP.
Ex. get, post, cookie, header
      35 36 37 38  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 35 def method( *args ) return super( *args ) if args.any? @method.freeze end  | 
  
#method=(method) ⇒ Object Also known as: http_method=
      42 43 44  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 42 def method=( method ) @method = method.to_s.downcase.to_sym end  | 
  
#platforms ⇒ Platform
Returns Applicable platforms for the #action resource.
      23 24 25  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 23 def platforms Platform::Manager[@action] end  | 
  
#submit(options = {}, &block) ⇒ Object
Sets `self` as the HTTP::Request#performer.
Submits `self` to the #action URL with the appropriate parameters.
      70 71 72 73 74 75 76 77 78 79 80 81 82  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 70 def submit( = {}, &block ) = .dup [:parameters] = @inputs.dup [:follow_location] = true if !.include?( :follow_location ) @auditor ||= .delete( :auditor ) [:performer] ||= self [:raw_parameters] ||= raw_inputs http_request( , &block ) end  | 
  
#to_h ⇒ Object
      121 122 123 124 125 126 127  | 
    
      # File 'lib/arachni/element/capabilities/submittable.rb', line 121 def to_h (defined?( super ) ? super : {}).merge( url: url, action: action, method: method ) end  |