metasploit-framework/modules/encoders/cmd/ifs.rb

34 lines
865 B
Ruby
Raw Normal View History

##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Encoder
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/
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
end