Statistics
| Branch: | Tag: | Revision:

root / modules / auxiliary / scanner / lotus / lotus_domino_version.rb @ master

History | View | Annotate | Download (5 kB)

1
##
2
# $Id$
3
##
4

    
5
##
6
# This file is part of the Metasploit Framework and may be subject to
7
# redistribution and commercial restrictions. Please see the Metasploit
8
# Framework web site for more information on licensing and terms of use.
9
# http://metasploit.com/framework/
10
##
11

    
12
require 'msf/core'
13

    
14
class Metasploit3 < Msf::Auxiliary
15

    
16
        include Msf::Exploit::Remote::HttpClient
17
        include Msf::Auxiliary::Scanner
18
        include Msf::Auxiliary::Report
19

    
20
        def initialize
21
                super(
22
                        'Name'        => 'Lotus Domino Version',
23
                        'Version'     => '$Revision$',
24
                        'Description' => 'Several checks to determine Lotus Domino Server Version.',
25
                        'Author'       => ['CG'],
26
                        'License'     => MSF_LICENSE
27
                        )
28
                register_options(
29
                                                [
30
                                                        OptString.new('PATH', [ true,  "path", '/']),
31
                                                ] )
32
        end
33

    
34
        def run_host(ip)
35

    
36
                path = datastore['PATH']
37
                check1 = [
38
                        'iNotes/Forms5.nsf',
39
                        'iNotes/Forms6.nsf',
40
                        'iNotes/Forms7.nsf',
41
                        ]
42

    
43
                check2 = [
44
                        'help/readme.nsf?OpenAbout'
45
                        ]
46
                check3 = [
47
                        'download/filesets/l_LOTUS_SCRIPT.inf',
48
                        'download/filesets/n_LOTUS_SCRIPT.inf',
49
                        'download/filesets/l_SEARCH.inf',
50
                        'download/filesets/n_SEARCH.inf',
51
                        ]
52

    
53
                currentversion = []
54
                baseversion = []
55

    
56
                begin
57

    
58
                        check1.each do | check |
59

    
60
                                res = send_request_raw({
61
                                        'uri'          =>  path+check,
62
                                        'method'       => 'GET',
63
                                        }, 10)
64

    
65
                                if (res.nil?)
66
                                        print_error("no response for #{ip}:#{rport} #{check}")
67
                                elsif (res.code == 200 and res.body)
68
                                        #string we are regexing: <!-- Domino Release 7.0.3FP1 (Windows NT/Intel) -->
69
                                        if match = res.body.match(/\<!-- Domino Release(.*) --\>/);
70
                                                server1 = $1
71
                                                report_note(
72
                                                        :host        => ip,
73
                                                        :proto => 'tcp',
74
                                                        :sname => 'HTTP',
75
                                                        :port        => rport,
76
                                                        :type => 'lotusdomino.version.current',
77
                                                        :data => server1.strip
78
                                                                )
79
                                                if currentversion.empty? then
80
                                                        currentversion << server1.strip
81
                                                elsif server1.strip == currentversion.last then
82
                                                        ''
83
                                                else server1.strip != currentversion.last
84
                                                        print_error("Different current version values") #this shouldnt happen,but just in case
85
                                                        currentversion << ' : ' + server1.strip
86
                                                end
87
                                        else
88
                                                ''
89
                                        end
90
                                elsif
91
                                        if (res.code and res.headers['Location'])
92
                                                print_error("#{ip}:#{rport} #{res.code} Redirect to #{res.headers['Location']}")
93
                                        else
94
                                                ''
95
                                        end
96
                                else
97
                                        ''
98
                                end
99
                        end
100
                        if currentversion.length == 0 then
101
                                ''
102
                        else
103
                                print_status("#{ip}:#{rport} Lotus Domino Current Version: #{currentversion}")
104
                        end
105

    
106
                        check2.each do | check |
107

    
108
                                res = send_request_raw({
109
                                        'uri'          =>  path+check,
110
                                        'method'       => 'GET',
111
                                        }, 10)
112

    
113
                                if (res.nil?)
114
                                        print_error("no response for #{ip}:#{rport} #{check}")
115
                                elsif (res.code == 200 and res.body)
116
                                        #string we are regexing: <title>IBM Lotus Notes/Domino 6.5.6 Release Notes</title>
117
                                        if match = res.body.match(/\<title\>(.*)Lotus Notes\/Domino (.*) Release Notes\<\/title\>/);
118
                                                server2 = $2
119
                                                print_status("#{ip}:#{rport} Lotus Domino Release Notes Version: " + $2)
120
                                                report_note(
121
                                                        :host        => ip,
122
                                                        :proto => 'tcp',
123
                                                        :sname => 'HTTP',
124
                                                        :port        => rport,
125
                                                        :type => 'lotusdomino.version.releasenotes',
126
                                                        :data => server2.strip
127
                                                                )
128
                                        else
129
                                                ''
130
                                        end
131
                                elsif
132
                                        if (res.code and res.headers['Location'])
133
                                                print_error("#{ip}:#{rport} #{res.code} Redirect to #{res.headers['Location']}")
134
                                        else
135
                                                ''
136
                                        end
137
                                else
138
                                        ''
139
                                end
140
                        end
141

    
142
                        check3.each do | check |
143

    
144
                                res = send_request_raw({
145
                                        'uri'          =>  path+check,
146
                                        'method'       => 'GET',
147
                                        }, 10)
148

    
149
                                if (res.nil?)
150
                                        print_error("no response for #{ip}:#{rport} #{check}")
151
                                elsif (res.code == 200 and res.body and res.body.index('TotalFileSize') and res.body.index('FileCount'))
152
                                        #string we are regexing: # Regex Version=8.5.1.0
153
                                        if match = res.body.match(/Version=(.*)/);
154
                                                server3 = $1
155
                                                report_note(
156
                                                        :host        => ip,
157
                                                        :proto => 'tcp',
158
                                                        :sname => 'HTTP',
159
                                                        :port        => rport,
160
                                                        :type => 'lotusdomino.version.base',
161
                                                        :data => server3.strip
162
                                                                )
163
                                                if baseversion.empty? then
164
                                                        baseversion << server3.strip
165
                                                elsif server3.strip == baseversion.last then
166
                                                        ''
167
                                                else server3.strip != baseversion.last #this shouldnt happen,but just in case
168
                                                        print_error("Different base version values")
169
                                                        baseversion << ' : ' + server3.strip
170
                                                end
171
                                        else
172
                                                ''
173
                                        end
174
                                elsif
175
                                        if (res.code and res.headers['Location'])
176
                                                print_error("#{ip}:#{rport} #{res.code} Redirect to #{res.headers['Location']}")
177
                                        else
178
                                                ''
179
                                        end
180
                                else
181
                                        ''
182
                                end
183
                        end
184
                        if baseversion.length == 0 then
185
                                ''
186
                        else
187
                                print_status("#{ip}:#{rport} Lotus Domino Base Install Version: #{baseversion}")
188
                        end
189
                end
190
                rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
191
                rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Resolv::ResolvError, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH =>e
192
                        print_error(e.message)
193
        end
194
end