Path: blob/master/modules/post/linux/gather/checkcontainer.rb
19516 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Linux::System78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Linux Gather Container Detection',13'Description' => %q{14This module attempts to determine whether the system is running15inside of a container and if so, which one. This module supports16detection of Docker, WSL, LXC, Podman and systemd nspawn.17},18'License' => MSF_LICENSE,19'Author' => [ 'James Otten <jamesotten1[at]gmail.com>'],20'Platform' => %w[linux unix],21'SessionTypes' => %w[shell meterpreter],22'Notes' => {23'Stability' => [ CRASH_SAFE ],24'Reliability' => [ REPEATABLE_SESSION ],25'SideEffects' => []26}27)28)29end3031# Run Method for when run command is issued32def run33container = get_container_type3435if container == 'Unknown'36print_status('This does not appear to be a container')37else38print_good("This appears to be a '#{container}' container")39end40end41end424344