From 0150e7a4dec38468ab3ff66eb3e205ee1529b20d Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 17 Nov 2009 00:00:08 +0000 Subject: [PATCH] add a simple encoder for sh payloads that only replaces spaces. fixes #525 git-svn-id: file:///home/svn/framework3/trunk@7549 4d416f70-5f16-0410-b530-b9f4589650da --- modules/encoders/cmd/ifs.rb | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 modules/encoders/cmd/ifs.rb diff --git a/modules/encoders/cmd/ifs.rb b/modules/encoders/cmd/ifs.rb new file mode 100644 index 0000000000..9d13500760 --- /dev/null +++ b/modules/encoders/cmd/ifs.rb @@ -0,0 +1,39 @@ +## +# $Id: generic_sh.rb 6957 2009-08-17 17:42:39Z hdm $ +## + +## +# This file is part of the Metasploit Framework and may be subject to +# redistribution and commercial restrictions. Please see the Metasploit +# Framework web site for more information on licensing and terms of use. +# http://metasploit.com/framework/ +## + + +require 'msf/core' + + +class Metasploit3 < Msf::Encoder + + def initialize + super( + 'Name' => 'Generic ${IFS} Substitution Command Encoder', + 'Version' => '$Revision: 6957 $', + 'Description' => %q{ + This encoder uses standard Bourne shell variable substitution + to avoid spaces without being overly fancy. + }, + 'Author' => 'egypt', + 'Arch' => ARCH_CMD) + end + + + # + # Encodes the payload + # + def encode_block(state, buf) + buf.gsub!(/\s/, '${IFS}') + return buf + end + +end