Class: Msf::Auxiliary::Web::Target

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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
:ssl_server_name_indication


72
73
74
# File 'lib/msf/core/auxiliary/web/target.rb', line 72

def initialize( options = {} )
  update( options )
end

Instance Attribute Details

#formsObject

Array of Web::Form objects.



55
56
57
# File 'lib/msf/core/auxiliary/web/target.rb', line 55

def forms
  @forms
end

#hostObject

IP address as a String.



31
32
33
# File 'lib/msf/core/auxiliary/web/target.rb', line 31

def host
  @host
end

#originalObject

Original URL as a String.



19
20
21
# File 'lib/msf/core/auxiliary/web/target.rb', line 19

def original
  @original
end

#passwordObject

Port Number.



52
53
54
# File 'lib/msf/core/auxiliary/web/target.rb', line 52

def password
  @password
end

#pathObject

String URI path.



40
41
42
# File 'lib/msf/core/auxiliary/web/target.rb', line 40

def path
  @path
end

#pathsObject

Array of Web::Path objects.



58
59
60
# File 'lib/msf/core/auxiliary/web/target.rb', line 58

def paths
  @paths
end

#portObject

Port Number.



46
47
48
# File 'lib/msf/core/auxiliary/web/target.rb', line 46

def port
  @port
end

#queryObject

String URI query.



43
44
45
# File 'lib/msf/core/auxiliary/web/target.rb', line 43

def query
  @query
end

#serviceObject

Service information as an Mdm::Service object.



22
23
24
# File 'lib/msf/core/auxiliary/web/target.rb', line 22

def service
  @service
end

#siteObject

Mdm::WebSite object.



25
26
27
# File 'lib/msf/core/auxiliary/web/target.rb', line 25

def site
  @site
end

#sslObject

True if HTTPS, False otherwise.



28
29
30
# File 'lib/msf/core/auxiliary/web/target.rb', line 28

def ssl
  @ssl
end

#ssl_server_name_indicationObject

Returns String SSL/TLS Server Name Indication (SNI).

Returns:

  • String SSL/TLS Server Name Indication (SNI)



37
38
39
# File 'lib/msf/core/auxiliary/web/target.rb', line 37

def ssl_server_name_indication
  @ssl_server_name_indication
end

#usernameObject

Port Number.



49
50
51
# File 'lib/msf/core/auxiliary/web/target.rb', line 49

def username
  @username
end

#vhostObject

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



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/msf/core/auxiliary/web/target.rb', line 102

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

#auditableObject

Array of accumulated auditable elements.



119
120
121
# File 'lib/msf/core/auxiliary/web/target.rb', line 119

def auditable
  self.forms | self.paths
end

#dupObject



143
144
145
# File 'lib/msf/core/auxiliary/web/target.rb', line 143

def dup
  Marshal.load( Marshal.dump( self ) )
end

#protoObject

String protocol representation (http or https).



129
130
131
# File 'lib/msf/core/auxiliary/web/target.rb', line 129

def proto
  ssl? ? 'https' : 'http'
end

#ssl?Boolean

True if HTTPS, False otherwise.

Returns:

  • (Boolean)


134
135
136
# File 'lib/msf/core/auxiliary/web/target.rb', line 134

def ssl?
  !!@ssl
end

#to_urlObject

String URL to the webapp.



139
140
141
# File 'lib/msf/core/auxiliary/web/target.rb', line 139

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
:ssl_server_name_indication


88
89
90
91
92
93
94
95
# File 'lib/msf/core/auxiliary/web/target.rb', line 88

def update( options = {} )
  options.each { |k, v| send( "#{k}=", v ) }

  @forms ||= []
  @paths ||= []

  self
end