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/modules/post/linux/gather/checkcontainer.rb
Views: 11704
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Post
7
include Msf::Post::Linux::System
8
9
def initialize(info = {})
10
super(
11
update_info(
12
info,
13
'Name' => 'Linux Gather Container Detection',
14
'Description' => %q{
15
This module attempts to determine whether the system is running
16
inside of a container and if so, which one. This module supports
17
detection of Docker, WSL, LXC, Podman and systemd nspawn.
18
},
19
'License' => MSF_LICENSE,
20
'Author' => [ 'James Otten <jamesotten1[at]gmail.com>'],
21
'Platform' => %w[linux unix],
22
'SessionTypes' => %w[shell meterpreter],
23
'Notes' => {
24
'Stability' => [ CRASH_SAFE ],
25
'Reliability' => [ REPEATABLE_SESSION ],
26
'SideEffects' => []
27
}
28
)
29
)
30
end
31
32
# Run Method for when run command is issued
33
def run
34
container = get_container_type
35
36
if container == 'Unknown'
37
print_status('This does not appear to be a container')
38
else
39
print_good("This appears to be a '#{container}' container")
40
end
41
end
42
end
43
44