fix #8199, check extapi for dependencies
parent
8c35e54934
commit
7625d36c1c
|
@ -49,6 +49,23 @@ module Console::CommandDispatcher
|
|||
shell.client
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the commands that meet the requirements
|
||||
#
|
||||
def check_commands(all, reqs=nil)
|
||||
all.delete_if do |cmd, _desc|
|
||||
del = false
|
||||
reqs[cmd].each do |req|
|
||||
next if client.commands.include? req
|
||||
del = true
|
||||
break
|
||||
end
|
||||
del
|
||||
end
|
||||
|
||||
all
|
||||
end
|
||||
|
||||
#
|
||||
# Returns true if the client has a framework object.
|
||||
#
|
||||
|
|
|
@ -36,7 +36,6 @@ class Console::CommandDispatcher::Android
|
|||
'set_audio_mode' => 'Set Ringer Mode',
|
||||
'wakelock' => 'Enable/Disable Wakelock',
|
||||
}
|
||||
|
||||
reqs = {
|
||||
'dump_sms' => ['android_dump_sms'],
|
||||
'dump_contacts' => ['android_dump_contacts'],
|
||||
|
@ -53,11 +52,7 @@ class Console::CommandDispatcher::Android
|
|||
'set_audio_mode' => ['android_set_audio_mode'],
|
||||
'wakelock' => ['android_wakelock'],
|
||||
}
|
||||
|
||||
# Ensure any requirements of the command are met
|
||||
all.delete_if do |cmd, _desc|
|
||||
reqs[cmd].any? { |req| !client.commands.include?(req) }
|
||||
end
|
||||
check_commands(all, reqs)
|
||||
end
|
||||
|
||||
def interval_collect_usage
|
||||
|
|
|
@ -25,7 +25,7 @@ class Console::CommandDispatcher::Extapi::Adsi
|
|||
# List of supported commands.
|
||||
#
|
||||
def commands
|
||||
{
|
||||
all = {
|
||||
'adsi_user_enum' => 'Enumerate all users on the specified domain.',
|
||||
'adsi_group_enum' => 'Enumerate all groups on the specified domain.',
|
||||
'adsi_nested_group_user_enum' => 'Recursively enumerate users who are effectively members of the group specified.',
|
||||
|
@ -33,6 +33,15 @@ class Console::CommandDispatcher::Extapi::Adsi
|
|||
'adsi_dc_enum' => 'Enumerate all domain controllers on the specified domain.',
|
||||
'adsi_domain_query' => 'Enumerate all objects on the specified domain that match a filter.'
|
||||
}
|
||||
reqs = {
|
||||
"adsi_user_enum" => [ "extapi_adsi_domain_query" ],
|
||||
"adsi_group_enum" => [ "extapi_adsi_domain_query" ],
|
||||
"adsi_nested_group_user_enum" => [ "extapi_adsi_domain_query" ],
|
||||
"adsi_computer_enum" => [ "extapi_adsi_domain_query" ],
|
||||
"adsi_dc_enum" => [ "extapi_adsi_domain_query" ],
|
||||
"adsi_domain_query" => [ "extapi_adsi_domain_query" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -20,7 +20,7 @@ class Console::CommandDispatcher::Extapi::Clipboard
|
|||
# List of supported commands.
|
||||
#
|
||||
def commands
|
||||
{
|
||||
all = {
|
||||
"clipboard_get_data" => "Read the target's current clipboard (text, files, images)",
|
||||
"clipboard_set_text" => "Write text to the target's clipboard",
|
||||
"clipboard_monitor_start" => "Start the clipboard monitor",
|
||||
|
@ -30,6 +30,17 @@ class Console::CommandDispatcher::Extapi::Clipboard
|
|||
"clipboard_monitor_purge" => "Delete all captured cilpboard content without dumping it",
|
||||
"clipboard_monitor_stop" => "Stop the clipboard monitor"
|
||||
}
|
||||
reqs = {
|
||||
"clipboard_get_data" => [ "extapi_clipboard_get_data" ],
|
||||
"clipboard_set_text" => [ "extapi_clipboard_set_data" ],
|
||||
"clipboard_monitor_start" => [ "extapi_clipboard_monitor_start" ],
|
||||
"clipboard_monitor_pause" => [ "extapi_clipboard_monitor_pause" ],
|
||||
"clipboard_monitor_resume" => [ "extapi_clipboard_monitor_resume" ],
|
||||
"clipboard_monitor_dump" => [ "extapi_clipboard_monitor_dump" ],
|
||||
"clipboard_monitor_purge" => [ "extapi_clipboard_monitor_purge" ],
|
||||
"clipboard_monitor_stop" => [ "extapi_clipboard_monitor_stop" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -21,11 +21,17 @@ class Console::CommandDispatcher::Extapi::Service
|
|||
# List of supported commands.
|
||||
#
|
||||
def commands
|
||||
{
|
||||
all = {
|
||||
"service_enum" => "Enumerate all registered Windows services",
|
||||
"service_query" => "Query more detail about a specific Windows service",
|
||||
"service_control" => "Control a single service (start/pause/resume/stop/restart)"
|
||||
}
|
||||
reqs = {
|
||||
"service_enum" => [ "extapi_service_enum" ],
|
||||
"service_query" => [ "extapi_service_query" ],
|
||||
"service_control" => [ "extapi_service_control" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -21,9 +21,13 @@ class Console::CommandDispatcher::Extapi::Window
|
|||
# List of supported commands.
|
||||
#
|
||||
def commands
|
||||
{
|
||||
all = {
|
||||
"window_enum" => "Enumerate all current open windows"
|
||||
}
|
||||
reqs = {
|
||||
"window_enum" => [ "extapi_window_enum" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -25,9 +25,13 @@ class Console::CommandDispatcher::Extapi::Wmi
|
|||
# List of supported commands.
|
||||
#
|
||||
def commands
|
||||
{
|
||||
"wmi_query" => "Perform a generic WMI query and return the results"
|
||||
all = {
|
||||
"wmi_query" => "Perform a generic WMI query and return the results",
|
||||
}
|
||||
reqs = {
|
||||
"wmi_query" => [ "extapi_wmi_query" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue