scripts will now handle # for comments and empty lines in lists and resource files

git-svn-id: file:///home/svn/framework3/trunk@11339 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Carlos Perez 2010-12-15 01:24:27 +00:00
parent e92c073c22
commit 78a62d33c5
6 changed files with 14 additions and 0 deletions

View File

@ -82,6 +82,8 @@ if client.platform =~ /win32|win64/
else else
backuphosts(session,hosts) backuphosts(session,hosts)
::File.open(val, "r").each_line do |line| ::File.open(val, "r").each_line do |line|
next if line.strip.length < 1
next if line[0,1] == "#"
add2hosts(session,line.chomp,hosts) add2hosts(session,line.chomp,hosts)
end end
cleardnscach(session) cleardnscach(session)

View File

@ -26,6 +26,8 @@ def list_con_exec(cmdlst)
print_status("Running Command List ...") print_status("Running Command List ...")
cmdout = "" cmdout = ""
cmdlst.each do |cmd| cmdlst.each do |cmd|
next if cmd.strip.length < 1
next if cmd[0,1] == "#"
begin begin
print_status "\tRunning command #{cmd}" print_status "\tRunning command #{cmd}"
@client.console.run_single(cmd) @client.console.run_single(cmd)

View File

@ -28,6 +28,8 @@ def list_exec(session,cmdlst)
r='' r=''
session.response_timeout=120 session.response_timeout=120
cmdlst.each do |cmd| cmdlst.each do |cmd|
next if cmd.strip.length < 1
next if cmd[0,1] == "#"
begin begin
print_status "\trunning command #{cmd}" print_status "\trunning command #{cmd}"
tmpout = "\n" tmpout = "\n"

View File

@ -158,6 +158,8 @@ end
if client.platform =~ /win32|win64/ if client.platform =~ /win32|win64/
if resource if resource
resource.each do |r| resource.each do |r|
next if r.strip.length < 1
next if r[0,1] == "#"
print_status("Dumping memory for #{r.chomp}") if not query print_status("Dumping memory for #{r.chomp}") if not query
pids = find_pids(r.chomp) pids = find_pids(r.chomp)
if pids.length == 0 if pids.length == 0

View File

@ -39,8 +39,12 @@ end
def abuse(session,targets,commands,username,password,delay) def abuse(session,targets,commands,username,password,delay)
#for each target #for each target
targets.each do |t| targets.each do |t|
next if t.strip.length < 1
next if t[0,1] == "#"
#for eacg command #for eacg command
commands.each do |c| commands.each do |c|
next if c.strip.length < 1
next if c[0,1] == "#"
taskname = "syscheck#{rand(100)}" taskname = "syscheck#{rand(100)}"
success = false success = false
#check if user name and password where given, if not credential of running process used #check if user name and password where given, if not credential of running process used

View File

@ -104,6 +104,8 @@ end
raise "Command List File does not exists!" raise "Command List File does not exists!"
else else
::File.open(script, "r").each_line do |line| ::File.open(script, "r").each_line do |line|
next if line.strip.length < 1
next if line[0,1] == "#"
commands << line.chomp commands << line.chomp
end end
end end