add the ability to read an environment variable in an rc file. resolves #5334

git-svn-id: file:///home/svn/framework3/trunk@13820 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Jonathan Cran 2011-10-06 00:02:51 +00:00
parent 190d438319
commit 1b4559199d
1 changed files with 14 additions and 0 deletions

View File

@ -299,6 +299,20 @@ class Driver < Msf::Ui::Driver
print_error("resource (#{path})> Ruby Error: #{e.class} #{e} #{e.backtrace}")
end
end
elsif line =~ /\$.*\$/
# this is a variable we need to subs line
var_with_delimiters = $&
var = var_with_delimiters.gsub("$","")
replacement = ENV["#{var}"]
if replacement
print_line("Replacing... #{var} with #{replacement} in ")
line = line.gsub!(var_with_delimiters,replacement)
print_line("resource (#{path})> #{line}")
run_single(line)
else
print_error "No environment variable: #{variable} defined."
end
else
print_line("resource (#{path})> #{line}")
run_single(line)