more reg stuff
git-svn-id: file:///home/svn/incoming/trunk@3048 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
011f4411f2
commit
4e9ef19975
|
@ -69,6 +69,15 @@ class RegistryValue
|
|||
return self.client.sys.registry.delete_value(self.hkey, self.name)
|
||||
end
|
||||
|
||||
def type_to_s
|
||||
return "REG_SZ" if (type == REG_SZ)
|
||||
return "REG_DWORD" if (type == REG_DWORD)
|
||||
return "REG_BINARY" if (type == REG_BINARY)
|
||||
return "REG_EXPAND_SZ" if (type == REG_EXPAND_SZ)
|
||||
return "REG_NONE" if (type == REG_NONE)
|
||||
return nil
|
||||
end
|
||||
|
||||
#
|
||||
# The remote server key handle.
|
||||
#
|
||||
|
|
|
@ -222,12 +222,13 @@ class Console::CommandDispatcher::Stdapi::Sys
|
|||
"Usage: reg [command] [options]\n\n" +
|
||||
"Interact with the target machine's registry.\n" +
|
||||
@@reg_opts.usage +
|
||||
"Commands:\n\n" +
|
||||
"\tenumkey Enumerate the supplied registry key [-k <key>]\n" +
|
||||
"\tcreatekey Create the supplied registry key [-k <key>]\n" +
|
||||
"\tdeletekey Delete the supplied registry key [-k <key>]\n" +
|
||||
"\tsetval Set a registry value [-k <key> -v <val> -d <data>]\n" +
|
||||
"\tdeleteval Delete the supplied registry value [-k <key> -v <val>]\n\n")
|
||||
"COMMANDS:\n\n" +
|
||||
" enumkey Enumerate the supplied registry key [-k <key>]\n" +
|
||||
" createkey Create the supplied registry key [-k <key>]\n" +
|
||||
" deletekey Delete the supplied registry key [-k <key>]\n" +
|
||||
" setval Set a registry value [-k <key> -v <val> -d <data>]\n" +
|
||||
" deleteval Delete the supplied registry value [-k <key> -v <val>]\n" +
|
||||
" queryval Queries the data contents of a value [-k <key> -v <val>]\n\n")
|
||||
return false
|
||||
when "-k"
|
||||
key = val
|
||||
|
@ -319,6 +320,22 @@ class Console::CommandDispatcher::Stdapi::Sys
|
|||
|
||||
print_line("Successfully deleted #{value}.")
|
||||
|
||||
when "queryval"
|
||||
if (value == nil)
|
||||
print_error("You must specify a value name (-v).")
|
||||
return false
|
||||
end
|
||||
|
||||
open_key = client.sys.registry.open_key(root_key, base_key, KEY_READ)
|
||||
|
||||
v = open_key.query_value(value)
|
||||
|
||||
print(
|
||||
"Key: #{key}\n" +
|
||||
"Name: #{v.name}\n" +
|
||||
"Type: #{v.type_to_s}\n" +
|
||||
"Data: #{v.data}\n")
|
||||
|
||||
else
|
||||
print_error("Invalid command supplied: #{cmd}")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue