Skip to content

Commit f12b97e

Browse files
committed
List all (listable) modules from a rsync daemon
1 parent 6747ba9 commit f12b97e

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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::Tcp
11+
include Msf::Auxiliary::Scanner
12+
include Msf::Auxiliary::Report
13+
14+
def initialize
15+
super(
16+
'Name' => 'Rsync Unauthenticated List Command',
17+
'Description' => 'List rsync available modules',
18+
'Author' => 'avuko',
19+
'License' => MSF_LICENSE
20+
)
21+
register_options(
22+
[
23+
Opt::RPORT(873),
24+
OptInt.new('TIMEOUT', [true, 'Timeout for the Rsync probe', 30])
25+
], self.class)
26+
end
27+
28+
def to
29+
return 30 if datastore['TIMEOUT'].to_i.zero?
30+
datastore['TIMEOUT'].to_i
31+
end
32+
33+
def run_host(ip)
34+
begin
35+
::Timeout.timeout(to) do
36+
connect()
37+
version = sock.recv(1024)
38+
# making sure we match the version of the server
39+
sock.puts("#{version}" )
40+
sock.puts("\n")
41+
listing = sock.get()
42+
# not interested in EXIT message
43+
listing = listing.to_s.gsub('@RSYNCD: EXIT', '')
44+
disconnect()
45+
46+
listing_santized = Rex::Text.to_hex_ascii(listing.to_s.strip)
47+
print_status("#{ip}:#{rport} #{version.rstrip.to_s} #{listing_santized}")
48+
report_service(:host => rhost, :port => rport, :name => "rsync", :info => listing_santized)
49+
end
50+
rescue ::Rex::ConnectionError
51+
rescue Timeout::Error
52+
print_error("#{target_host}:#{rport}, Server timed out after #{to} seconds. Skipping.")
53+
rescue ::Exception => e
54+
print_error("#{e} #{e.backtrace}")
55+
end
56+
end
57+
end
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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::Tcp
11+
include Msf::Auxiliary::Scanner
12+
include Msf::Auxiliary::Report
13+
14+
def initialize
15+
super(
16+
'Name' => 'Rsync Unauthenticated List Command',
17+
'Description' => 'List rsync available modules',
18+
'Author' => 'avuko',
19+
'License' => MSF_LICENSE
20+
)
21+
register_options(
22+
[
23+
Opt::RPORT(873),
24+
OptInt.new('TIMEOUT', [true, 'Timeout for the Rsync probe', 30])
25+
], self.class)
26+
end
27+
28+
def to
29+
return 30 if datastore['TIMEOUT'].to_i.zero?
30+
datastore['TIMEOUT'].to_i
31+
end
32+
33+
def run_host(ip)
34+
begin
35+
::Timeout.timeout(to) do
36+
connect()
37+
version = sock.recv(1024)
38+
# making sure we match the version of the server
39+
sock.puts("#{version}" )
40+
sock.puts("\n")
41+
listing = sock.get()
42+
# not interested in EXIT message
43+
listing = listing.to_s.gsub('@RSYNCD: EXIT', '')
44+
disconnect()
45+
46+
listing_santized = Rex::Text.to_hex_ascii(listing.to_s.strip)
47+
print_status("#{ip}:#{rport} #{version.rstrip.to_s} #{listing_santized}")
48+
report_service(:host => rhost, :port => rport, :name => "rsync", :info => listing_santized)
49+
end
50+
rescue ::Rex::ConnectionError
51+
rescue Timeout::Error
52+
print_error("#{target_host}:#{rport}, Server timed out after #{to} seconds. Skipping.")
53+
rescue ::Exception => e
54+
print_error("#{e} #{e.backtrace}")
55+
end
56+
end
57+
end

0 commit comments

Comments
 (0)