CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/post/session_compatible_modules.rb
Views: 11780
1
# -*- coding: binary -*-
2
3
module Rex
4
module Post
5
###
6
#
7
# This module provides a list of modules that are compatible with the current session
8
#
9
###
10
module SessionCompatibleModules
11
12
# @return [Array<String>]
13
def session_compatible_modules
14
# Use the built in search command functionality to get a list of search results
15
search_params = { 'session_type' => [[self.session.type], []] }
16
Msf::Modules::Metadata::Cache.instance.find(search_params)
17
end
18
19
# @return [String]
20
def format_session_compatible_modules
21
<<~EOF
22
This session also works with the following modules:
23
24
#{session_compatible_modules.flat_map(&:fullname).join("\n ")}
25
26
EOF
27
end
28
end
29
end
30
end
31
32