Skip to content

Commit 6f330ea

Browse files
committed
Add deprecation information
1 parent aea0379 commit 6f330ea

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

modules/auxiliary/scanner/elasticsearch/indeces_enum.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
##
55

66
require 'msf/core'
7+
require 'msf/core/module/deprecated'
78

89
class Metasploit3 < Msf::Auxiliary
910

1011
include Msf::Exploit::Remote::HttpClient
1112
include Msf::Auxiliary::Scanner
1213
include Msf::Auxiliary::Report
1314

15+
include Msf::Module::Deprecated
16+
17+
DEPRECATION_DATE = Date.new(2014, 07, 29)
18+
DEPRECATION_REPLACEMENT = 'auxiliary/scanner/elasticsearch/indices_enum'
19+
1420
def initialize(info = {})
1521
super(update_info(info,
1622
'Name' => 'ElasticSearch Indices Enumeration Utility',
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Scanner
12+
include Msf::Auxiliary::Report
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'ElasticSearch Indices Enumeration Utility',
17+
'Description' => %q{
18+
This module enumerates ElasticSearch Indices. It uses the REST API
19+
in order to make it.
20+
},
21+
'Author' =>
22+
[
23+
'Silas Cutler <Silas.Cutler[at]BlackListThisDomain.com>'
24+
],
25+
'License' => MSF_LICENSE
26+
))
27+
28+
register_options(
29+
[
30+
Opt::RPORT(9200)
31+
], self.class)
32+
end
33+
34+
def peer
35+
"#{rhost}:#{rport}"
36+
end
37+
38+
def run_host(ip)
39+
vprint_status("#{peer} - Querying indices...")
40+
begin
41+
res = send_request_raw({
42+
'uri' => '/_aliases',
43+
'method' => 'GET',
44+
})
45+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable
46+
vprint_error("#{peer} - Unable to establish connection")
47+
return
48+
end
49+
50+
if res && res.code == 200 && res.body.length > 0
51+
begin
52+
json_body = JSON.parse(res.body)
53+
rescue JSON::ParserError
54+
vprint_error("#{peer} - Unable to parse JSON")
55+
return
56+
end
57+
else
58+
vprint_error("#{peer} - Timeout or unexpected response...")
59+
return
60+
end
61+
62+
report_service(
63+
:host => rhost,
64+
:port => rport,
65+
:proto => 'tcp',
66+
:name => 'elasticsearch'
67+
)
68+
69+
indices = []
70+
71+
json_body.each do |index|
72+
indices.push(index[0])
73+
report_note(
74+
:host => rhost,
75+
:port => rport,
76+
:proto => 'tcp',
77+
:type => "elasticsearch.index",
78+
:data => index[0],
79+
:update => :unique_data
80+
)
81+
end
82+
83+
if indices.length > 0
84+
print_good("#{peer} - ElasticSearch Indices found: #{indices.join(", ")}")
85+
end
86+
87+
end
88+
89+
end

0 commit comments

Comments
 (0)