CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/scanner/oracle/spy_sid.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Auxiliary::Report
8
include Msf::Exploit::Remote::HttpClient
9
include Msf::Auxiliary::Scanner
10
11
def initialize
12
super(
13
'Name' => 'Oracle Application Server Spy Servlet SID Enumeration',
14
'Description' => %q{
15
This module makes a request to the Oracle Application Server
16
in an attempt to discover the SID.
17
},
18
'References' =>
19
[
20
[ 'URL', 'http://dsecrg.com/files/pub/pdf/Different_ways_to_guess_Oracle_database_SID_(eng).pdf' ],
21
],
22
'Author' => [ 'MC' ],
23
'License' => MSF_LICENSE
24
)
25
26
register_options(
27
[
28
Opt::RPORT(1158)
29
])
30
end
31
32
def run_host(ip)
33
begin
34
res = send_request_raw({
35
'uri' => '/servlet/Spy?format=raw&loginfo=true',
36
'method' => 'GET',
37
'version' => '1.1',
38
}, 5)
39
40
if res and res.body =~ /SERVICE_NAME=/
41
select(nil,nil,nil,2)
42
sid = res.body.scan(/SERVICE_NAME=([^\)]+)/)
43
report_note(
44
:host => ip,
45
:port => datastore['RPORT'],
46
:proto => 'tcp',
47
:type => 'oracle_sid',
48
:data => "#{sid.uniq}",
49
:update => :unique_data
50
)
51
print_good("#{rhost}:#{rport} Discovered SID: '#{sid.uniq}'")
52
else
53
print_error("Unable to retrieve SID for #{ip}...")
54
end
55
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
56
rescue ::Timeout::Error, ::Errno::EPIPE
57
end
58
end
59
end
60
61