1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00

cleanup sunrpc_call error handling

git-svn-id: file:///home/svn/framework3/trunk@8388 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Joshua Drake 2010-02-06 21:50:11 +00:00
parent c48fe399f7
commit 80bdf77b39

View File

@ -23,6 +23,7 @@ module Exploit::Remote::SunRPC
PROG_MISMATCH = 2 # Remote can't support version #
PROC_UNAVAIL = 3 # Program can't support procedure
GARBAGE_ARGS = 4 # Procedure can't decode params'
SYSTEM_ERR = 5 # System encountered some error
def initialize(info = {})
super
@ -67,6 +68,8 @@ module Exploit::Remote::SunRPC
end
rpcobj.pport = arr[5]
#progname = progresolv(rpcobj.program)
#print_status("#{rhost} - SunRPC Found #{progname} on #{protocol} port #{rpcobj.pport}")
end
def sunrpc_call(proc, buf, timeout=60)
@ -77,12 +80,17 @@ module Exploit::Remote::SunRPC
if arr[1] != MSG_ACCEPTED || arr[4] != SUCCESS
progname = progresolv(rpcobj.program)
err = "SunRPC call for program #{rpcobj.program} [#{progname}], procedure #{proc}, failed: "
case arr[4]
when PROG_UMAVAIL then err << "Program Unavailable"
when PROG_MISMATCH then err << "Program Version Mismatch"
when PROC_UNAVAIL then err << "Procedure Unavailable"
when GARBAGE_ARGS then err << "Garbage Arguments"
else err << "Unknown Error"
if (arr[1] != MSG_ACCEPTED)
err << 'Message not accepted'
elsif (arr[4] and arr[4] != SUCCESS)
case arr[4]
when PROG_UMAVAIL then err << "Program Unavailable"
when PROG_MISMATCH then err << "Program Version Mismatch"
when PROC_UNAVAIL then err << "Procedure Unavailable"
when GARBAGE_ARGS then err << "Garbage Arguments"
when SYSTEM_ERR then err << "System Error"
else err << "Unknown Error"
end
end
print_error("#{rhost} - #{err}")
end