From fe540a3001776869b857a94f9b8ab70ccd198d8f Mon Sep 17 00:00:00 2001 From: HD Moore Date: Wed, 21 Feb 2007 03:58:44 +0000 Subject: [PATCH] Cleanly handle EOFError's from DCERPC services. This fixes #27 git-svn-id: file:///home/svn/framework3/trunk@4453 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/proto/dcerpc/client.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/rex/proto/dcerpc/client.rb b/lib/rex/proto/dcerpc/client.rb index 3597c44d7b..d25a15d00e 100644 --- a/lib/rex/proto/dcerpc/client.rb +++ b/lib/rex/proto/dcerpc/client.rb @@ -227,10 +227,19 @@ require 'rex/proto/smb/exceptions' self.write(packet) } - raw_response = self.read() - if (raw_response == nil or raw_response.length == 0) + raw_response = '' + + begin + raw_response = self.read() + rescue ::EOFError raise Rex::Proto::DCERPC::Exceptions::NoResponse end + + if (raw_response == nil or raw_response.length == 0) + raise Rex::Proto::DCERPC::Exceptions::NoResponse + end + + self.last_response = Rex::Proto::DCERPC::Response.new(raw_response) if self.last_response.type == 3