Skip to content

Commit b027176

Browse files
committed
Land rapid7#7156, use windows_error gem for constants
2 parents 280216d + 1f5fbd4 commit b027176

File tree

12 files changed

+82
-148
lines changed

12 files changed

+82
-148
lines changed

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ PATH
4646
sshkey
4747
tzinfo
4848
tzinfo-data
49+
windows_error
4950

5051
GEM
5152
remote: https://rubygems.org/
@@ -278,6 +279,7 @@ GEM
278279
thread_safe (~> 0.1)
279280
tzinfo-data (1.2016.6)
280281
tzinfo (>= 1.0.0)
282+
windows_error (0.0.2)
281283
xpath (2.0.0)
282284
nokogiri (~> 1.3)
283285
yard (0.9.0)

lib/msf/core.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# The framework-core depends on Rex
1717
require 'rex'
1818
require 'rex/ui'
19+
require 'rex/arch'
20+
include Rex::Arch
1921

2022
module Msf
2123
autoload :Author, 'msf/core/author'

lib/msf/core/exploit/mixins.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,6 @@
120120

121121
# Fortinet
122122
require 'msf/core/exploit/fortinet'
123+
124+
# Other
125+
require 'msf/core/exploit/windows_constants'

lib/msf/core/exploit/smb/client/psexec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# -*- coding: binary -*-
22
require 'rex/proto/dcerpc/svcctl'
3+
require 'windows_error'
4+
require 'windows_error/win32'
5+
6+
include WindowsError::Win32
37

48
module Msf
59

@@ -13,7 +17,7 @@ module Msf
1317

1418
module Exploit::Remote::SMB::Client::Psexec
1519

16-
include Rex::Constants::Windows
20+
include Msf::Exploit::Windows_Constants
1721
include Msf::Exploit::Remote::DCERPC
1822
include Msf::Exploit::Remote::SMB::Client::Authenticated
1923

lib/rex/constants/windows.rb renamed to lib/msf/core/exploit/windows_constants.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module Rex::Constants
2-
module Windows
1+
module Msf
2+
module Exploit::Windows_Constants
33

44
##
55
#
@@ -10,18 +10,6 @@ module Windows
1010

1111
STANDARD_RIGHTS_REQUIRED = 0x000F0000
1212

13-
##
14-
#
15-
# Errors
16-
#
17-
##
18-
19-
ERROR_SUCCESS = 0x0
20-
ERROR_FILE_NOT_FOUND = 0x2
21-
ERROR_ACCESS_DENIED = 0x5
22-
ERROR_SERVICE_REQUEST_TIMEOUT = 0x41D
23-
ERROR_SERVICE_EXISTS = 0x431
24-
2513
##
2614
#
2715
# SVCCTL Protocol Functions

lib/msf/core/payload/uuid.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
require 'msf/core'
44
require 'msf/core/module/platform'
5-
require 'rex/constants'
65
require 'rex/text'
76

87
#

lib/rex.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module Rex
5959
require 'rex/ole'
6060

6161
# Generic classes
62-
require 'rex/constants'
6362
require 'rex/exceptions'
6463
require 'rex/transformer'
6564
require 'rex/random_identifier'

lib/rex/constants.rb

Lines changed: 0 additions & 127 deletions
This file was deleted.

lib/rex/logging.rb

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,64 @@
11
# -*- coding: binary -*-
22

3-
require 'rex/constants' # for LEV_'s
3+
#
4+
# Log severities
5+
#
6+
LOG_ERROR = 'error'
7+
LOG_DEBUG = 'debug'
8+
LOG_INFO = 'info'
9+
LOG_WARN = 'warn'
10+
LOG_RAW = 'raw'
11+
12+
##
13+
#
14+
# Log levels
15+
#
16+
##
17+
18+
#
19+
# LEV_0 - Default
20+
#
21+
# This log level is the default log level if none is specified. It should be
22+
# used when a log message should always be displayed when logging is enabled.
23+
# Very few log messages should occur at this level aside from necessary
24+
# information logging and error/warning logging. Debug logging at level zero
25+
# is not advised.
26+
#
27+
LEV_0 = 0
28+
29+
#
30+
# LEV_1 - Extra
31+
#
32+
# This log level should be used when extra information may be needed to
33+
# understand the cause of an error or warning message or to get debugging
34+
# information that might give clues as to why something is happening. This
35+
# log level should be used only when information may be useful to understanding
36+
# the behavior of something at a basic level. This log level should not be
37+
# used in an exhaustively verbose fashion.
38+
#
39+
LEV_1 = 1
40+
41+
#
42+
# LEV_2 - Verbose
43+
#
44+
# This log level should be used when verbose information may be needed to
45+
# analyze the behavior of the framework. This should be the default log
46+
# level for all detailed information not falling into LEV_0 or LEV_1.
47+
# It is recommended that this log level be used by default if you are
48+
# unsure.
49+
#
50+
LEV_2 = 2
51+
52+
#
53+
# LEV_3 - Insanity
54+
#
55+
# This log level should contain very verbose information about the
56+
# behavior of the framework, such as detailed information about variable
57+
# states at certain phases including, but not limited to, loop iterations,
58+
# function calls, and so on. This log level will rarely be displayed,
59+
# but when it is the information provided should make it easy to analyze
60+
# any problem.
61+
#
62+
LEV_3 = 3
63+
464
require 'rex/logging/log_dispatcher'

lib/rex/logging/log_sink.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: binary -*-
2-
require 'rex/constants'
32

43
module Rex
54
module Logging

0 commit comments

Comments
 (0)