From bdf073516bb97d688c5a9cc4f4fd1108b7dc6af0 Mon Sep 17 00:00:00 2001 From: Pearce Barry Date: Tue, 26 Jul 2016 16:59:13 -0500 Subject: [PATCH] Switch errors over to windows_error gem... --- Gemfile.lock | 2 ++ lib/msf/core/exploit/smb/client/psexec.rb | 4 ++++ lib/rex/constants/windows.rb | 12 ------------ lib/rex/proto/dcerpc/svcctl/packet.rb | 3 +++ metasploit-framework.gemspec | 2 ++ 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9ea972c9d2..dc4d692ed9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -46,6 +46,7 @@ PATH sshkey tzinfo tzinfo-data + windows_error GEM remote: https://rubygems.org/ @@ -277,6 +278,7 @@ GEM thread_safe (~> 0.1) tzinfo-data (1.2016.6) tzinfo (>= 1.0.0) + windows_error (0.0.2) xpath (2.0.0) nokogiri (~> 1.3) yard (0.9.0) diff --git a/lib/msf/core/exploit/smb/client/psexec.rb b/lib/msf/core/exploit/smb/client/psexec.rb index d64defeff0..7bae99e984 100644 --- a/lib/msf/core/exploit/smb/client/psexec.rb +++ b/lib/msf/core/exploit/smb/client/psexec.rb @@ -1,5 +1,9 @@ # -*- coding: binary -*- require 'rex/proto/dcerpc/svcctl' +require 'windows_error' +require 'windows_error/win32' + +include WindowsError::Win32 module Msf diff --git a/lib/rex/constants/windows.rb b/lib/rex/constants/windows.rb index 6921414a77..fc77d6d5f7 100644 --- a/lib/rex/constants/windows.rb +++ b/lib/rex/constants/windows.rb @@ -10,18 +10,6 @@ module Windows STANDARD_RIGHTS_REQUIRED = 0x000F0000 - ## - # - # Errors - # - ## - - ERROR_SUCCESS = 0x0 - ERROR_FILE_NOT_FOUND = 0x2 - ERROR_ACCESS_DENIED = 0x5 - ERROR_SERVICE_REQUEST_TIMEOUT = 0x41D - ERROR_SERVICE_EXISTS = 0x431 - ## # # SVCCTL Protocol Functions diff --git a/lib/rex/proto/dcerpc/svcctl/packet.rb b/lib/rex/proto/dcerpc/svcctl/packet.rb index 7e65cb86cd..c1a1cc1fd6 100644 --- a/lib/rex/proto/dcerpc/svcctl/packet.rb +++ b/lib/rex/proto/dcerpc/svcctl/packet.rb @@ -7,12 +7,15 @@ module Rex ### module Proto::DCERPC::SVCCTL + require 'windows_error' + require 'windows_error/win32' require 'rex/constants/windows' NDR = Rex::Encoder::NDR class Client + include WindowsError::Win32 include Rex::Constants::Windows attr_accessor :dcerpc_client diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec index 05e76a9370..52abbba707 100644 --- a/metasploit-framework.gemspec +++ b/metasploit-framework.gemspec @@ -102,6 +102,8 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'sshkey' # BitStruct Library used for handling certain Protocol Header/Packet construction spec.add_runtime_dependency 'bit-struct' + # Library for interpreting Windows error codes and strings + spec.add_runtime_dependency 'windows_error' # # Protocol Libraries