Store the nfs service and export information into the db
git-svn-id: file:///home/svn/framework3/trunk@8812 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
40dd65494e
commit
84b7f4bb85
|
@ -15,8 +15,10 @@ require 'msf/core'
|
||||||
class Metasploit3 < Msf::Auxiliary
|
class Metasploit3 < Msf::Auxiliary
|
||||||
|
|
||||||
include Msf::Exploit::Remote::SunRPC
|
include Msf::Exploit::Remote::SunRPC
|
||||||
|
include Msf::Auxiliary::Report
|
||||||
include Msf::Auxiliary::Scanner
|
include Msf::Auxiliary::Scanner
|
||||||
|
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super(
|
super(
|
||||||
'Name' => 'NFS Mount Scanner',
|
'Name' => 'NFS Mount Scanner',
|
||||||
|
@ -43,19 +45,39 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
sunrpc_authnull()
|
sunrpc_authnull()
|
||||||
resp = sunrpc_call(procedure, "")
|
resp = sunrpc_call(procedure, "")
|
||||||
|
|
||||||
|
# XXX: Assume that transport is udp and port is 2049
|
||||||
|
# Technically we are talking to mountd not nfsd
|
||||||
|
|
||||||
|
report_service(
|
||||||
|
:host => ip,
|
||||||
|
:proto => 'udp',
|
||||||
|
:port => 2049,
|
||||||
|
:name => 'nfsd',
|
||||||
|
:info => 'NFS Daemon #{program} v#{progver}'
|
||||||
|
)
|
||||||
|
|
||||||
exports = resp[3,1].unpack('C')[0]
|
exports = resp[3,1].unpack('C')[0]
|
||||||
if (exports == 0x01)
|
if (exports == 0x01)
|
||||||
print_good("#{ip} - Exports found")
|
shares = []
|
||||||
while XDR.decode_int!(resp) == 1 do
|
while XDR.decode_int!(resp) == 1 do
|
||||||
dir = XDR.decode_string!(resp)
|
dir = XDR.decode_string!(resp)
|
||||||
grp = []
|
grp = []
|
||||||
while XDR.decode_int!(resp) == 1 do
|
while XDR.decode_int!(resp) == 1 do
|
||||||
grp << XDR.decode_string!(resp)
|
grp << XDR.decode_string!(resp)
|
||||||
end
|
end
|
||||||
print_line("\t#{dir}\t[#{grp.join(", ")}]")
|
print_line("#{ip}\t#{dir}\t[#{grp.join(", ")}]")
|
||||||
|
shares << [dir, grp]
|
||||||
end
|
end
|
||||||
|
report_note(
|
||||||
|
:host => ip,
|
||||||
|
:proto => 'udp',
|
||||||
|
:port => 2049,
|
||||||
|
:type => 'nfs.exports',
|
||||||
|
:data => { :exports => shares },
|
||||||
|
:update => :unique_data
|
||||||
|
)
|
||||||
elsif(exports == 0x00)
|
elsif(exports == 0x00)
|
||||||
print_status("#{ip} - No exports")
|
print_status("#{ip} - No exported directories")
|
||||||
end
|
end
|
||||||
|
|
||||||
sunrpc_destroy
|
sunrpc_destroy
|
||||||
|
|
Loading…
Reference in New Issue