Class: Msf::Auxiliary::Web::Target
- Inherits:
-
Object
- Object
- Msf::Auxiliary::Web::Target
- Defined in:
- lib/msf/core/auxiliary/web/target.rb
Overview
Represents a targeted web application and holds service, host, post etc. info.
Instance Attribute Summary collapse
-
#forms ⇒ Object
Array of Web::Form objects.
-
#host ⇒ Object
IP address as a String.
-
#original ⇒ Object
Original URL as a String.
-
#password ⇒ Object
Port Number.
-
#path ⇒ Object
String URI path.
-
#paths ⇒ Object
Array of Web::Path objects.
-
#port ⇒ Object
Port Number.
-
#query ⇒ Object
String URI query.
-
#service ⇒ Object
Service information as an Mdm::Service object.
-
#site ⇒ Object
Mdm::WebSite object.
-
#ssl ⇒ Object
True if HTTPS, False otherwise.
-
#username ⇒ Object
Port Number.
-
#vhost ⇒ Object
Virtual host as a String.
Instance Method Summary collapse
-
#<<(element) ⇒ Object
Pushes an auditable element.
-
#auditable ⇒ Object
Array of accumulated auditable elements.
- #dup ⇒ Object
-
#initialize(options = {}) ⇒ Target
constructor
options - Hash with which to populate self (keys must correspond to attributes): :service :ssl :host :vhost :path :port :forms :auditable.
-
#proto ⇒ Object
String protocol representation (http or https).
-
#ssl? ⇒ Boolean
True if HTTPS, False otherwise.
-
#to_url ⇒ Object
String URL to the webapp.
-
#update(options = {}) ⇒ Object
options - Hash with which to update self (keys must correspond to attributes): :service :ssl :host :vhost :path :port :forms :auditable.
Constructor Details
#initialize(options = {}) ⇒ Target
options - Hash with which to populate self (keys must correspond to attributes):
:service
:ssl
:host
:vhost
:path
:port
:forms
:auditable
68 69 70 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 68 def initialize( = {} ) update( ) end |
Instance Attribute Details
#forms ⇒ Object
Array of Web::Form objects.
52 53 54 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 52 def forms @forms end |
#host ⇒ Object
IP address as a String.
31 32 33 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 31 def host @host end |
#original ⇒ Object
Original URL as a String.
19 20 21 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 19 def original @original end |
#password ⇒ Object
Port Number.
49 50 51 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 49 def password @password end |
#path ⇒ Object
String URI path.
37 38 39 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 37 def path @path end |
#paths ⇒ Object
Array of Web::Path objects.
55 56 57 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 55 def paths @paths end |
#port ⇒ Object
Port Number.
43 44 45 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 43 def port @port end |
#query ⇒ Object
String URI query.
40 41 42 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 40 def query @query end |
#service ⇒ Object
Service information as an Mdm::Service object.
22 23 24 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 22 def service @service end |
#site ⇒ Object
Mdm::WebSite object.
25 26 27 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 25 def site @site end |
#ssl ⇒ Object
True if HTTPS, False otherwise.
28 29 30 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 28 def ssl @ssl end |
#username ⇒ Object
Port Number.
46 47 48 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 46 def username @username end |
#vhost ⇒ Object
Virtual host as a String.
34 35 36 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 34 def vhost @vhost end |
Instance Method Details
#<<(element) ⇒ Object
Pushes an auditable element.
element - Web::Form or Web::Path or Mdm::WebForm
97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 97 def <<( element ) case element when Auxiliary::Web::Path @paths << element when Auxiliary::Web::Form @forms << element when Mdm::WebForm self.<< element.method.to_s.downcase == 'path' ? Auxiliary::Web::Path.from_model( element ) : Auxiliary::Web::Form.from_model( element ) end end |
#auditable ⇒ Object
Array of accumulated auditable elements.
114 115 116 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 114 def auditable self.forms | self.paths end |
#dup ⇒ Object
138 139 140 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 138 def dup Marshal.load( Marshal.dump( self ) ) end |
#proto ⇒ Object
String protocol representation (http or https).
124 125 126 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 124 def proto ssl? ? 'https' : 'http' end |
#ssl? ⇒ Boolean
True if HTTPS, False otherwise.
129 130 131 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 129 def ssl? !!@ssl end |
#to_url ⇒ Object
String URL to the webapp.
134 135 136 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 134 def to_url "#{proto}://#{vhost || host}:#{port}#{path}" end |
#update(options = {}) ⇒ Object
options - Hash with which to update self (keys must correspond to attributes):
:service
:ssl
:host
:vhost
:path
:port
:forms
:auditable
83 84 85 86 87 88 89 90 |
# File 'lib/msf/core/auxiliary/web/target.rb', line 83 def update( = {} ) .each { |k, v| send( "#{k}=", v ) } @forms ||= [] @paths ||= [] self end |