Module: Msf::Post::Windows::Registry

Includes:
CliParse
Included in:
Priv, Services, UserProfiles, Scripts::Meterpreter::Common
Defined in:
lib/msf/core/post/windows/registry.rb

Instance Method Summary collapse

Methods included from CliParse

#win_parse_error, #win_parse_results

Instance Method Details

#registry_createkey(key) ⇒ Object

Create the given registry key


40
41
42
43
44
45
46
# File 'lib/msf/core/post/windows/registry.rb', line 40

def registry_createkey(key)
  if session_has_registry_ext
    meterpreter_registry_createkey(key)
  else
    shell_registry_createkey(key)
  end
end

#registry_deletekey(key) ⇒ Object

Delete a given registry key

returns true if succesful


66
67
68
69
70
71
72
# File 'lib/msf/core/post/windows/registry.rb', line 66

def registry_deletekey(key)
  if session_has_registry_ext
    meterpreter_registry_deletekey(key)
  else
    shell_registry_deletekey(key)
  end
end

#registry_deleteval(key, valname) ⇒ Object

Deletes a registry value given the key and value name

returns true if succesful


53
54
55
56
57
58
59
# File 'lib/msf/core/post/windows/registry.rb', line 53

def registry_deleteval(key, valname)
  if session_has_registry_ext
    meterpreter_registry_deleteval(key, valname)
  else
    shell_registry_deleteval(key, valname)
  end
end

#registry_enumkeys(key) ⇒ Object

Return an array of subkeys for the given registry key


77
78
79
80
81
82
83
# File 'lib/msf/core/post/windows/registry.rb', line 77

def registry_enumkeys(key)
  if session_has_registry_ext
    meterpreter_registry_enumkeys(key)
  else
    shell_registry_enumkeys(key)
  end
end

#registry_enumvals(key) ⇒ Object

Return an array of value names for the given registry key


88
89
90
91
92
93
94
# File 'lib/msf/core/post/windows/registry.rb', line 88

def registry_enumvals(key)
  if session_has_registry_ext
    meterpreter_registry_enumvals(key)
  else
    shell_registry_enumvals(key)
  end
end

#registry_getvaldata(key, valname) ⇒ Object

Return the data of a given registry key and value


99
100
101
102
103
104
105
# File 'lib/msf/core/post/windows/registry.rb', line 99

def registry_getvaldata(key, valname)
  if session_has_registry_ext
    meterpreter_registry_getvaldata(key, valname)
  else
    shell_registry_getvaldata(key, valname)
  end
end

#registry_getvalinfo(key, valname) ⇒ Object

Return the data and type of a given registry key and value


110
111
112
113
114
115
116
# File 'lib/msf/core/post/windows/registry.rb', line 110

def registry_getvalinfo(key,valname)
  if session_has_registry_ext
    meterpreter_registry_getvalinfo(key, valname)
  else
    shell_registry_getvalinfo(key, valname)
  end
end

#registry_loadkey(key, file) ⇒ Object

Load a hive file


16
17
18
19
20
21
22
23
# File 'lib/msf/core/post/windows/registry.rb', line 16

def registry_loadkey(key,file)
  if session_has_registry_ext
    retval=meterpreter_registry_loadkey(key,file)
  else
    retval=shell_registry_loadkey(key,file)
  end
  return retval
end

#registry_setvaldata(key, valname, data, type) ⇒ Object

Sets the data for a given value and type of data on the target registry

returns true if succesful


123
124
125
126
127
128
129
# File 'lib/msf/core/post/windows/registry.rb', line 123

def registry_setvaldata(key, valname, data, type)
  if session_has_registry_ext
    meterpreter_registry_setvaldata(key, valname, data, type)
  else
    shell_registry_setvaldata(key, valname, data, type)
  end
end

#registry_unloadkey(key) ⇒ Object

Unload a hive file


28
29
30
31
32
33
34
35
# File 'lib/msf/core/post/windows/registry.rb', line 28

def registry_unloadkey(key)
  if session_has_registry_ext
    retval=meterpreter_registry_unloadkey(key)
  else
    retval=shell_registry_unloadkey(key)
  end
  return retval
end