Skip to content

Commit 5fd5310

Browse files
David MaloneyBrent Cook
authored andcommitted
ome minor guards and spec fixes
some minor conditional guards and spec fixes
1 parent 5b51281 commit 5fd5310

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

lib/msf/core/exploit.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,13 @@ def passive?
688688
# default target, that one will be automatically used.
689689
#
690690
def target
691-
auto_idx = auto_targeted_index
692-
unless auto_idx.nil?
693-
datastore['TARGET'] = auto_idx
691+
if self.respond_to?(:auto_targeted_index)
692+
auto_idx = auto_targeted_index
693+
if auto_idx.present?
694+
datastore['TARGET'] = auto_idx
695+
end
694696
end
697+
695698
target_idx = target_index
696699
return (target_idx) ? targets[target_idx.to_i] : nil
697700
end

lib/msf/core/exploit/auto_target.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module Exploit::AutoTarget
1010
# @return [Boolean] whether or not to use our automatic targeting routine
1111
def auto_target?
1212
selected_target = targets[target_index]
13+
return false if selected_target.nil?
1314
if selected_target.name =~ /Automatic/ && selected_target['AutoGenerated'] == true
1415
true
1516
else

lib/msf/core/exploit/remote/firefox_privilege_escalation.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ def run_payload
151151

152152
# @return [Boolean] the user has selected a javascript (non-native) target
153153
def js_target?
154-
target.arch[0] == ARCH_FIREFOX
154+
if target.arch
155+
target.arch[0] == ARCH_FIREFOX
156+
else
157+
false
158+
end
155159
end
156160

157161
end

spec/lib/msf/ui/console/command_dispatcher/db_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
" -n,--name Change the name of a host",
395395
" -m,--comment Change the comment of a host",
396396
" -t,--tag Add or specify a tag to a range of hosts",
397-
"Available columns: address, arch, comm, comments, created_at, cred_count, detected_arch, exploit_attempt_count, host_detail_count, info, mac, name, note_count, os_flavor, os_lang, os_name, os_sp, purpose, scope, service_count, state, updated_at, virtual_host, vuln_count, tags"
397+
"Available columns: address, arch, comm, comments, created_at, cred_count, detected_arch, exploit_attempt_count, host_detail_count, info, mac, name, note_count, os_family, os_flavor, os_lang, os_name, os_sp, purpose, scope, service_count, state, updated_at, virtual_host, vuln_count, tags"
398398
]
399399
end
400400
end

0 commit comments

Comments
 (0)