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


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

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

Instance Attribute Details

#formsObject

Array of Web::Form objects.



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

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.



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

def password
  @password
end

#pathObject

String URI path.



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

def path
  @path
end

#pathsObject

Array of Web::Path objects.



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

def paths
  @paths
end

#portObject

Port Number.



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

def port
  @port
end

#queryObject

String URI query.



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

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

#usernameObject

Port Number.



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

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



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

#auditableObject

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

#dupObject



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

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

#protoObject

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.

Returns:

  • (Boolean)


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

def ssl?
  !!@ssl
end

#to_urlObject

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( options = {} )
  options.each { |k, v| send( "#{k}=", v ) }

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

  self
end