metasploit-framework/lib/msf
Jonathan Cran 78e507fe9b erb processing for RC files. Allows you to do more generic things w/ rc files:
<rc_file>
<%
rhost = "192.168.1.1"
smbuser = "test"
smbpass = "pass"
payload = "windows/meterpreter/reverse_http"
puts "This will happen while i preprocess an erb-enabled rc file" 
%>

use windows/smb/psexec
set RHOST <%= rhost %>
set SMBUser <%= smbuser %>
set SMBPass <%= smbpass %>
set PAYLOAD <%= payload %>
save

<ruby>
 puts "Now, i should print the system path while running the actual resource file! "
 puts ENV["PATH"]
 puts "end"
</ruby>

<%= puts "This will also happen when i preprocess too" %>

</rc_file>

which will give you output like this: 
<output>
[*] Processing /home/jcran/Desktop/test_erb_rc for ERB directives.
This will happen while i preprocess an erb-enabled rc file
This will also happen when i preprocess too
resource (/home/jcran/Desktop/test_erb_rc)> use windows/smb/psexec
resource (/home/jcran/Desktop/test_erb_rc)> set RHOST 192.168.1.1
RHOST => 192.168.1.1
resource (/home/jcran/Desktop/test_erb_rc)> set SMBUser test
SMBUser => test
resource (/home/jcran/Desktop/test_erb_rc)> set SMBPass pass
SMBPass => pass
resource (/home/jcran/Desktop/test_erb_rc)> set PAYLOAD windows/meterpreter/reverse_http
PAYLOAD => windows/meterpreter/reverse_http
resource (/home/jcran/Desktop/test_erb_rc)> save
Saved configuration to: /home/jcran/.msf4/config
[*] resource (/home/jcran/Desktop/test_erb_rc)> Ruby Code (115 bytes)
Now, i should print the system path while running the actual resource file! 
/home/jcran/.rvm/gems/ruby-1.9.4-p1/bin:/home/jcran/.rvm/gems/ruby-1.9.4-p1@global/bin:/home/jcran/.rvm/rubies/ruby-1.9.4-p1/bin:/home/jcran/.rvm/bin
end
msf  exploit(psexec) >
</output>




git-svn-id: file:///home/svn/framework3/trunk@14013 4d416f70-5f16-0410-b530-b9f4589650da
2011-10-20 06:41:07 +00:00
..
base This commit makes the new unicode string encoding optional, it can be disabled by setting EnableUnicodeEncoding to false or through the 'disable_unicode_encoding' console command in the Meterpreter shell. Fixes #4986 2011-07-21 15:44:54 +00:00
core Bump this to 4.1.0-release (incoming!) 2011-10-18 08:09:08 +00:00
scripts Change Post Mixin for Windows platform in its own separate class and minor fixes on modules and scripts 2011-06-21 00:38:04 +00:00
ui erb processing for RC files. Allows you to do more generic things w/ rc files: 2011-10-20 06:41:07 +00:00
util Allow more custom settings for creating a .Net control 2011-08-12 19:03:09 +00:00
LICENSE Updated to reflect the new license of Rex 2006-09-01 15:50:10 +00:00
base.rb Reverting the autoload changes until we can upgrade to a new ActiveSupport library or find a workaround 2011-05-12 20:03:55 +00:00
base.rb.ts.rb Code cleanups 2008-10-19 21:03:39 +00:00
core.rb Reverting the autoload changes until we can upgrade to a new ActiveSupport library or find a workaround 2011-05-12 20:03:55 +00:00
core.rb.ts.rb Code cleanups 2008-10-19 21:03:39 +00:00
events.rb base should not depend on ui 2010-01-15 01:24:45 +00:00
sanity.rb Load rubygems before changing Encoding.default_internal (fixes #1914) 2010-05-24 23:07:56 +00:00
ui.rb Reverting the autoload changes until we can upgrade to a new ActiveSupport library or find a workaround 2011-05-12 20:03:55 +00:00
util.rb Reverting the autoload changes until we can upgrade to a new ActiveSupport library or find a workaround 2011-05-12 20:03:55 +00:00
windows_error.rb fix bug in default case 2010-10-08 19:49:57 +00:00