refactor stdapi and lanattacks to use filter_commands
parent
e9c9c852ab
commit
871c30c0b3
|
@ -29,7 +29,6 @@ class Console::CommandDispatcher::Lanattacks::Dhcp
|
|||
"dhcp_load_options" => "Load DHCP optionis from a datastore",
|
||||
"dhcp_log" => "Log DHCP server activity"
|
||||
}
|
||||
|
||||
reqs = {
|
||||
"dhcp_start" => [ "lanattacks_start_dhcp" ],
|
||||
"dhcp_stop" => [ "lanattacks_stop_dhcp" ],
|
||||
|
@ -38,19 +37,7 @@ class Console::CommandDispatcher::Lanattacks::Dhcp
|
|||
"dhcp_load_options" => [ "lanattacks_set_dhcp_option" ],
|
||||
"dhcp_log" => [ "lanattacks_dhcp_log" ]
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -27,26 +27,13 @@ class Console::CommandDispatcher::Lanattacks::Tftp
|
|||
"tftp_reset" => "Reset the TFTP server",
|
||||
"tftp_add_file" => "Add a file to the TFTP server"
|
||||
}
|
||||
|
||||
reqs = {
|
||||
"tftp_start" => [ "lanattacks_start_tftp" ],
|
||||
"tftp_stop" => [ "lanattacks_stop_tftp" ],
|
||||
"tftp_reset" => [ "lanattacks_reset_tftp" ],
|
||||
"tftp_add_file" => [ "lanattacks_add_tftp_file" ],
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -102,18 +102,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|||
'show_mount' => ['stdapi_fs_mount_show'],
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -108,18 +108,7 @@ class Console::CommandDispatcher::Stdapi::Net
|
|||
'resolve' => ['stdapi_net_resolve_host'],
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -143,19 +143,7 @@ class Console::CommandDispatcher::Stdapi::Sys
|
|||
"sysinfo" => [ "stdapi_sys_config_sysinfo" ],
|
||||
"localtime" => [ "stdapi_sys_config_localtime" ],
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -49,19 +49,7 @@ class Console::CommandDispatcher::Stdapi::Ui
|
|||
"stdapi_ui_enable_keyboard"
|
||||
]
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -34,18 +34,7 @@ class Console::CommandDispatcher::Stdapi::Webcam
|
|||
"webcam_stream" => [ "webcam_start", "webcam_get_frame", "webcam_stop" ],
|
||||
"record_mic" => [ "webcam_audio_record" ]
|
||||
}
|
||||
|
||||
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
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue