Module: Msf::Modules::Metadata::Maps

Included in:
Cache
Defined in:
lib/msf/core/modules/metadata/maps.rb

Overview

Core service class that provides storage of module metadata as well as operations on the metadata. Note that operations on this metadata are included as separate modules.

Instance Method Summary collapse

Instance Method Details

#all_exploit_mapsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/msf/core/modules/metadata/maps.rb', line 12

def all_exploit_maps

  return @mrefs, @mports, @mservs if @mrefs && !@mrefs.empty?

  mrefs  = {}
  mports = {}
  mservs = {}

  .each do |exploit|
    # expand this in future to be more specific about remote exploits.
    next unless exploit.type == "exploit"
    exploit.references.each do |reference|
      next if reference =~ /^URL/
      ref = reference
      ref.upcase!

      mrefs[ref] ||= Set.new
      mrefs[ref] << exploit
    end

    if exploit.rport
      rport                        = exploit.rport
      mports[rport.to_i]           ||= []
      mports[rport.to_i] << exploit
    end

    unless exploit.autofilter_ports.nil? || exploit.autofilter_ports.empty?
      exploit.autofilter_ports.each do |rport|
        mports[rport.to_i] ||= Set.new
        mports[rport.to_i] << exploit
      end
    end

    unless exploit.autofilter_services.nil? || exploit.autofilter_services.empty?
      exploit.autofilter_services.each do |serv|
        mservs[serv] ||= Set.new
        mservs[serv] << exploit
      end
    end

  end
  @mrefs  = mrefs
  @mports = mports
  @mservs = mservs

  return @mrefs, @mports, @mservs
end