refactor stdapi and lanattacks to use filter_commands

bug/bundler_fix
Tim 2017-06-06 14:05:07 +08:00
parent e9c9c852ab
commit 871c30c0b3
7 changed files with 7 additions and 90 deletions

View File

@ -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
#

View File

@ -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
#

View File

@ -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
#

View File

@ -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
#

View File

@ -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
#

View File

@ -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
#

View File

@ -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
#