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

67
68
69
# File 'lib/msf/core/auxiliary/web/target.rb', line 67

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

Instance Attribute Details

#formsObject

Array of Web::Form objects.


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

def forms
  @forms
end

#hostObject

IP address as a String.


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

def host
  @host
end

#originalObject

Original URL as a String.


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

def original
  @original
end

#passwordObject

Port Number.


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

def password
  @password
end

#pathObject

String URI path.


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

def path
  @path
end

#pathsObject

Array of Web::Path objects.


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

def paths
  @paths
end

#portObject

Port Number.


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

def port
  @port
end

#queryObject

String URI query.


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

def query
  @query
end

#serviceObject

Service information as an Mdm::Service object.


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

def service
  @service
end

#siteObject

Mdm::WebSite object.


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

def site
  @site
end

#sslObject

True if HTTPS, False otherwise.


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

def ssl
  @ssl
end

#usernameObject

Port Number.


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

def username
  @username
end

#vhostObject

Virtual host as a String.


33
34
35
# File 'lib/msf/core/auxiliary/web/target.rb', line 33

def vhost
  @vhost
end

Instance Method Details

#<<(element) ⇒ Object

Pushes an auditable element.

element - Web::Form or Web::Path or Mdm::WebForm


96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/msf/core/auxiliary/web/target.rb', line 96

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.


113
114
115
# File 'lib/msf/core/auxiliary/web/target.rb', line 113

def auditable
  self.forms | self.paths
end

#dupObject


137
138
139
# File 'lib/msf/core/auxiliary/web/target.rb', line 137

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

#protoObject

String protocol representation (http or https).


123
124
125
# File 'lib/msf/core/auxiliary/web/target.rb', line 123

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

#ssl?Boolean

True if HTTPS, False otherwise.

Returns:

  • (Boolean)

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

def ssl?
  !!@ssl
end

#to_urlObject

String URL to the webapp.


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

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

82
83
84
85
86
87
88
89
# File 'lib/msf/core/auxiliary/web/target.rb', line 82

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

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

  self
end