Updated script for new methods
git-svn-id: file:///home/svn/framework3/trunk@8736 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
bfe0e013da
commit
b0da8cf6d3
|
@ -22,10 +22,12 @@ def script_exec(session,scrptlst)
|
||||||
print_status("Running script List ...")
|
print_status("Running script List ...")
|
||||||
scrptlst.each_line do |scrpt|
|
scrptlst.each_line do |scrpt|
|
||||||
begin
|
begin
|
||||||
|
script_components = scrpt.split(" ")
|
||||||
|
script = script_components.shift
|
||||||
|
script_args = script_components.join(" ")
|
||||||
|
script_path = Msf::Sessions::Meterpreter.find_script_path(script)
|
||||||
print_status "\trunning script #{scrpt.chomp}"
|
print_status "\trunning script #{scrpt.chomp}"
|
||||||
client = session
|
session.execute_script(script_path, script_args)
|
||||||
args = scrpt.chomp.split
|
|
||||||
session.execute_script(args.shift,binding)
|
|
||||||
rescue ::Exception => e
|
rescue ::Exception => e
|
||||||
print_error("Error: #{e.class} #{e}")
|
print_error("Error: #{e.class} #{e}")
|
||||||
print_error("Error in script: #{scrpt}")
|
print_error("Error in script: #{scrpt}")
|
||||||
|
@ -40,22 +42,22 @@ end
|
||||||
|
|
||||||
################## Main ##################
|
################## Main ##################
|
||||||
@@exec_opts.parse(args) do |opt, idx, val|
|
@@exec_opts.parse(args) do |opt, idx, val|
|
||||||
case opt
|
case opt
|
||||||
|
|
||||||
when "-c"
|
when "-c"
|
||||||
commands = val.gsub(/;/,"\n")
|
commands = val.gsub(/;/,"\n")
|
||||||
when "-s"
|
when "-s"
|
||||||
script = val
|
script = val
|
||||||
if not ::File.exists?(script)
|
if not ::File.exists?(script)
|
||||||
raise "Script List File does not exists!"
|
raise "Script List File does not exists!"
|
||||||
else
|
else
|
||||||
::File.open(script, "r").each_line do |line|
|
::File.open(script, "r").each_line do |line|
|
||||||
commands << line
|
commands << line
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
when "-h"
|
||||||
|
help = 1
|
||||||
end
|
end
|
||||||
when "-h"
|
|
||||||
help = 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.length == 0 or help == 1
|
if args.length == 0 or help == 1
|
||||||
|
|
Loading…
Reference in New Issue