2009-11-17 00:00:08 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-11-17 00:00:08 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Encoder
|
2009-11-17 00:00:08 +00:00
|
|
|
|
2018-08-23 20:20:38 +00:00
|
|
|
# This may produce incorrect code, such as in quoted strings
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = LowRanking
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
2018-08-23 20:20:38 +00:00
|
|
|
'Name' => 'Bourne ${IFS} Substitution Command Encoder',
|
|
|
|
'Description' => %q{
|
|
|
|
This encoder uses Bourne ${IFS} substitution to avoid whitespace
|
|
|
|
without being overly fancy.
|
2013-08-30 21:28:54 +00:00
|
|
|
},
|
2018-08-23 20:20:38 +00:00
|
|
|
'Author' => ['egypt', 'wvu'],
|
|
|
|
'Platform' => 'unix',
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'EncoderType' => Msf::Encoder::Type::CmdUnixIFS
|
|
|
|
)
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def encode_block(state, buf)
|
2018-08-23 20:20:38 +00:00
|
|
|
# Skip encoding if there are no badchars
|
|
|
|
return buf if state.badchars !~ /\s/
|
2014-07-22 15:27:45 +00:00
|
|
|
|
2018-08-23 20:20:38 +00:00
|
|
|
# Perform ${IFS} encoding
|
|
|
|
buf.gsub(/\s+/, '${IFS}')
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2018-08-23 20:20:38 +00:00
|
|
|
|
2009-11-17 00:00:08 +00:00
|
|
|
end
|