@@ -10,8 +10,23 @@ module Registry
10
10
11
11
include Msf ::Post ::Windows ::CliParse
12
12
13
+ #
14
+ # This is the default view. It reflects what the remote process would see
15
+ # natively. So, if you are using a remote 32-bit meterpreter session, you
16
+ # will see 32-bit registry keys and values.
17
+ #
13
18
REGISTRY_VIEW_NATIVE = 0
19
+
20
+ #
21
+ # Access 32-bit registry keys and values regardless of whether the session is
22
+ # 32 or 64-bit.
23
+ #
14
24
REGISTRY_VIEW_32_BIT = 1
25
+
26
+ #
27
+ # Access 64-bit registry keys and values regardless of whether the session is
28
+ # 32 or 64-bit.
29
+ #
15
30
REGISTRY_VIEW_64_BIT = 2
16
31
17
32
#
@@ -160,7 +175,7 @@ def shell_registry_cmd(suffix, view = REGISTRY_VIEW_NATIVE)
160
175
161
176
def shell_registry_cmd_result ( suffix , view = REGISTRY_VIEW_NATIVE )
162
177
results = shell_registry_cmd ( suffix , view ) ;
163
- results =~ / The operation completed successfully/
178
+ results . include? ( ' The operation completed successfully' )
164
179
end
165
180
166
181
#
@@ -216,7 +231,7 @@ def shell_registry_enumkeys(key, view)
216
231
reg_data_types << 'REG_DWORD_LITTLE_ENDIAN|REG_NONE|REG_EXPAND_SZ|REG_LINK|REG_FULL_RESOURCE_DESCRIPTOR'
217
232
bslashes = key . count ( '\\' )
218
233
results = shell_registry_cmd ( "query \" #{ key } \" " , view )
219
- if results !=~ /^ Error:/
234
+ unless results . include? ( ' Error' )
220
235
results . each_line do |line |
221
236
# now let's keep the ones that have a count = bslashes+1
222
237
# feels like there's a smarter way to do this but...
@@ -239,7 +254,7 @@ def shell_registry_enumvals(key, view)
239
254
reg_data_types << 'REG_DWORD_LITTLE_ENDIAN|REG_NONE|REG_EXPAND_SZ|REG_LINK|REG_FULL_RESOURCE_DESCRIPTOR'
240
255
# REG QUERY KeyName [/v ValueName | /ve] [/s]
241
256
results = shell_registry_cmd ( "query \" #{ key } \" " , view )
242
- if results !=~ /^ Error:/
257
+ unless results . include? ( ' Error' )
243
258
if values = results . scan ( /^ +.*[#{ reg_data_types } ].*/ )
244
259
# yanked the lines with legit REG value types like REG_SZ
245
260
# now let's parse out the names (first field basically)
0 commit comments