-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Expand file tree
/
Copy pathstats.rb
More file actions
37 lines (31 loc) · 955 Bytes
/
stats.rb
File metadata and controls
37 lines (31 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
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
# frozen_string_literal: true
module Msf
module Modules
module Metadata
module Stats
attr_reader :module_counts
def update_stats
@metadata = get_metadata
map_types_to_metadata!
@module_counts = {
exploit: @stats_by_type['exploit'].size,
auxiliary: @stats_by_type['auxiliary'].size,
post: @stats_by_type['post'].size,
payload: @stats_by_type['payload'].size,
encoder: @stats_by_type['encoder'].size,
nop: @stats_by_type['nop'].size,
evasion: @stats_by_type['evasion'].size,
total: @metadata.size
}
end
private
def map_types_to_metadata!
@stats_by_type = Hash.new { |h, k| h[k] = [] }
@metadata.each do |module_metadata|
@stats_by_type[module_metadata.type] << module_metadata
end
end
end
end
end
end