Path: blob/master/modules/encoders/cmd/ifs.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Encoder67# This may produce incorrect code, such as in quoted strings8Rank = LowRanking910def initialize11super(12'Name' => 'Bourne ${IFS} Substitution Command Encoder',13'Description' => %q{14This encoder uses Bourne ${IFS} substitution to avoid whitespace15without being overly fancy.16},17'Author' => ['egypt', 'wvu'],18'Platform' => %w[linux unix],19'Arch' => ARCH_CMD,20'EncoderType' => Msf::Encoder::Type::CmdPosixIFS21)22end2324def encode_block(state, buf)25# Skip encoding if there are no badchars26return buf if state.badchars !~ /\s/2728# Perform ${IFS} encoding29buf.gsub(/\s+/, '${IFS}')30end3132end333435