From de69a2b9bfe74832a5d15c26bbe53ff482c67e2f Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Tue, 14 Dec 2010 19:28:44 +0000 Subject: [PATCH] fix error where commands was nil git-svn-id: file:///home/svn/framework3/trunk@11335 4d416f70-5f16-0410-b530-b9f4589650da --- scripts/meterpreter/multicommand.rb | 37 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/meterpreter/multicommand.rb b/scripts/meterpreter/multicommand.rb index 7ff4361a8a..fb245d8e35 100644 --- a/scripts/meterpreter/multicommand.rb +++ b/scripts/meterpreter/multicommand.rb @@ -63,27 +63,28 @@ def usage raise Rex::Script::Completed end + ################## Main ################## @@exec_opts.parse(args) { |opt, idx, val| - case opt - - when "-cl" - commands = val.split(",") - when "-rc" - script = val - if not ::File.exists?(script) - raise "Command List File does not exists!" - else - ::File.open(script, "r").each_line do |line| - commands << line.chomp - end - end - when "-f" - outfile = val - when "-h" - help = 1 - end + case opt + when "-cl" + commands = val.split(",") + when "-rc" + script = val + if not ::File.exists?(script) + raise "Command List File does not exists!" + else + commands ||= '' + ::File.open(script, "r").each_line do |line| + commands << line.chomp + end + end + when "-f" + outfile = val + when "-h" + help = 1 + end } if args.length == 0 or help == 1