Skip to content

Commit e9c9c85

Browse files
committed
check_commands -> filter_commands
1 parent 7625d36 commit e9c9c85

File tree

7 files changed

+8
-16
lines changed

7 files changed

+8
-16
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,10 @@ def client
5252
#
5353
# Returns the commands that meet the requirements
5454
#
55-
def check_commands(all, reqs=nil)
55+
def filter_commands(all, reqs)
5656
all.delete_if do |cmd, _desc|
57-
del = false
58-
reqs[cmd].each do |req|
59-
next if client.commands.include? req
60-
del = true
61-
break
62-
end
63-
del
57+
reqs[cmd].any? { |req| !client.commands.include?(req) }
6458
end
65-
66-
all
6759
end
6860

6961
#

lib/rex/post/meterpreter/ui/console/command_dispatcher/android.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def commands
5252
'set_audio_mode' => ['android_set_audio_mode'],
5353
'wakelock' => ['android_wakelock'],
5454
}
55-
check_commands(all, reqs)
55+
filter_commands(all, reqs)
5656
end
5757

5858
def interval_collect_usage

lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def commands
4141
"adsi_dc_enum" => [ "extapi_adsi_domain_query" ],
4242
"adsi_domain_query" => [ "extapi_adsi_domain_query" ],
4343
}
44-
check_commands(all, reqs)
44+
filter_commands(all, reqs)
4545
end
4646

4747
#

lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/clipboard.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def commands
4040
"clipboard_monitor_purge" => [ "extapi_clipboard_monitor_purge" ],
4141
"clipboard_monitor_stop" => [ "extapi_clipboard_monitor_stop" ],
4242
}
43-
check_commands(all, reqs)
43+
filter_commands(all, reqs)
4444
end
4545

4646
#

lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def commands
3131
"service_query" => [ "extapi_service_query" ],
3232
"service_control" => [ "extapi_service_control" ],
3333
}
34-
check_commands(all, reqs)
34+
filter_commands(all, reqs)
3535
end
3636

3737
#

lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/window.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def commands
2727
reqs = {
2828
"window_enum" => [ "extapi_window_enum" ],
2929
}
30-
check_commands(all, reqs)
30+
filter_commands(all, reqs)
3131
end
3232

3333
#

lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/wmi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def commands
3131
reqs = {
3232
"wmi_query" => [ "extapi_wmi_query" ],
3333
}
34-
check_commands(all, reqs)
34+
filter_commands(all, reqs)
3535
end
3636

3737
#

0 commit comments

Comments
 (0)