Path: blob/master/modules/auxiliary/scanner/lotus/lotus_domino_version.rb
19852 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Scanner8include Msf::Auxiliary::Report910def initialize11super(12'Name' => 'Lotus Domino Version',13'Description' => 'Several checks to determine Lotus Domino Server Version.',14'Author' => ['CG'],15'License' => MSF_LICENSE16)17register_options(18[19OptString.new('PATH', [ true, "path", '/']),20]21)22end2324def run_host(ip)25path = datastore['PATH']26check1 = [27'iNotes/Forms5.nsf',28'iNotes/Forms6.nsf',29'iNotes/Forms7.nsf',30]3132check2 = [33'help/readme.nsf?OpenAbout'34]35check3 = [36'download/filesets/l_LOTUS_SCRIPT.inf',37'download/filesets/n_LOTUS_SCRIPT.inf',38'download/filesets/l_SEARCH.inf',39'download/filesets/n_SEARCH.inf',40]4142currentversion = []43baseversion = []4445begin46check1.each do |check|47res = send_request_raw({48'uri' => normalize_uri(path, check),49'method' => 'GET'50}, 10)5152if (res.nil?)53print_error("no response for #{ip}:#{rport} #{check}")54elsif (res.code == 200 and res.body)55# string we are regexing: <!-- Domino Release 7.0.3FP1 (Windows NT/Intel) -->56if match = res.body.match(/\<!-- Domino Release(.*) --\>/);57server1 = $158report_note(59:host => ip,60:proto => 'tcp',61:sname => (ssl ? "https" : "http"),62:port => rport,63:type => 'lotusdomino.version.current',64:data => { :version => server1.strip }65)66if currentversion.empty? then67currentversion << server1.strip68elsif server1.strip == currentversion.last then69''70else server1.strip != currentversion.last71print_error("Different current version values") # this shouldnt happen,but just in case72currentversion << ' : ' + server1.strip73end74else75''76end77elsif (res.code and res.headers['Location'])78print_error("#{ip}:#{rport} #{res.code} Redirect to #{res.headers['Location']}")79else80''81end82end83if currentversion.length == 0 then84''85else86print_good("#{ip}:#{rport} Lotus Domino Current Version: #{currentversion}")87end8889check2.each do |check|90res = send_request_raw({91'uri' => normalize_uri(path, check),92'method' => 'GET'93}, 10)9495if (res.nil?)96print_error("no response for #{ip}:#{rport} #{check}")97elsif (res.code == 200 and res.body)98# string we are regexing: <title>IBM Lotus Notes/Domino 6.5.6 Release Notes</title>99if match = res.body.match(/\<title\>(.*)Lotus Notes\/Domino (.*) Release Notes\<\/title\>/);100server2 = $2101print_good("#{ip}:#{rport} Lotus Domino Release Notes Version: " + $2)102report_note(103:host => ip,104:proto => 'tcp',105:sname => (ssl ? "https" : "http"),106:port => rport,107:type => 'lotusdomino.version.releasenotes',108:data => { :version_release_notes => server2.strip }109)110else111''112end113elsif if (res.code and res.headers['Location'])114print_error("#{ip}:#{rport} #{res.code} Redirect to #{res.headers['Location']}")115else116''117end118else119''120end121end122123check3.each do |check|124res = send_request_raw({125'uri' => normalize_uri(path, check),126'method' => 'GET'127}, 10)128129if (res.nil?)130print_error("no response for #{ip}:#{rport} #{check}")131elsif (res.code == 200 and res.body and res.body.index('TotalFileSize') and res.body.index('FileCount'))132# string we are regexing: # Regex Version=8.5.1.0133if match = res.body.match(/Version=(.*)/);134server3 = $1135report_note(136:host => ip,137:proto => 'tcp',138:sname => (ssl ? "https" : "http"),139:port => rport,140:type => 'lotusdomino.version.base',141:data => { :version_base => server3.strip }142)143if baseversion.empty? then144baseversion << server3.strip145elsif server3.strip == baseversion.last then146''147else server3.strip != baseversion.last # this shouldnt happen,but just in case148print_error("Different base version values")149baseversion << ' : ' + server3.strip150end151else152''153end154elsif if (res.code and res.headers['Location'])155print_error("#{ip}:#{rport} #{res.code} Redirect to #{res.headers['Location']}")156else157''158end159else160''161end162end163if baseversion.length == 0 then164''165else166print_good("#{ip}:#{rport} Lotus Domino Base Install Version: #{baseversion}")167end168end169rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout170rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Resolv::ResolvError, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e171print_error(e.message)172end173end174175176