Module: Msf::Auxiliary::WmapModule

Included in:
WmapCrawler, WmapScanDir, WmapScanFile, WmapScanGeneric, WmapScanQuery, WmapScanSSL, WmapScanServer, WmapScanUniqueQuery
Defined in:
lib/msf/core/auxiliary/wmap_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#orderidObject

Returns the value of attribute orderid.



11
12
13
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 11

def orderid
  @orderid
end

#requiredidsObject

Returns the value of attribute requiredids.



12
13
14
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 12

def requiredids
  @requiredids
end

Instance Method Details

#distance(a, b) ⇒ Object

Levenshtein distance algorithm (slow, huge mem consuption)



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 112

def distance(a, b)
  case
  when a.empty?
    b.length
  when b.empty?
    a.length
  else
    [(a[0] == b[0] ? 0 : 1) + distance(a[1..-1], b[1..-1]),
    1 + distance(a[1..-1], b),
    2 + distance(a, b[1..-1])].min
  end
end

#headersparse(qheaders) ⇒ Object

Modified from CGI.rb as we dont use arrays



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 82

def headersparse(qheaders)
  params = Hash.new()

  qheaders.split(/[&;]/n).each do |pairs|
    key, value = pairs.split(':',2)
    if params.has_key?(key)
      #Error
    else
      params[key] = value
    end
  end
  params
end

#initialize(info = {}) ⇒ Object

Initializes an instance of a WMAP module



17
18
19
20
21
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 17

def initialize(info = {})
  super
  self.orderid = 0xFFFFFF
  self.requiredids = {}
end

#queryparse(query) ⇒ Object

modified from CGI.rb as we dont use arrays



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

def queryparse(query)
  params = Hash.new()

  query.split(/[&;]/n).each do |pairs|
    key, value = pairs.split('=',2)
    if params.has_key?(key)
      #Error
    else
      params[key] = value
    end
  end
  params
end

#register_wmap_options(options) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 23

def register_wmap_options(options)
  if options.has_key?('OrderID')
    self.orderid = options['OrderID']
  end

  if 	options.has_key?('Require')
    self.requiredids = options['Require']
  end
end

#wmap_base_urlObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 67

def wmap_base_url
  res = (ssl ? "https://" : "http://")
  if datastore['VHOST'].nil?
    res << wmap_target_host
  else
    res << datastore['VHOST']
  end
  res << ":" + wmap_target_port.to_s
  res
end

#wmap_enabledObject



33
34
35
36
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 33

def wmap_enabled
  #enabled by default
  true
end

#wmap_getoidObject



38
39
40
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 38

def wmap_getoid
  self.orderid
end

#wmap_setoid(oid) ⇒ Object



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

def wmap_setoid(oid)
  self.orderid = oid
end

#wmap_target_hostObject



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

def wmap_target_host
  datastore['RHOST']
end

#wmap_target_portObject



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

def wmap_target_port
  datastore['RPORT']
end

#wmap_target_sslObject



59
60
61
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 59

def wmap_target_ssl
  datastore['SSL']
end

#wmap_target_vhostObject



63
64
65
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 63

def wmap_target_vhost
  datastore['VHOST']
end

#wmap_typeObject



46
47
48
49
# File 'lib/msf/core/auxiliary/wmap_module.rb', line 46

def wmap_type
  #default type
  nil
end