Skip to content

Commit 89aa00c

Browse files
committed
Check job workspace
1 parent 086de2c commit 89aa00c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

lib/msf/core/exploit/browser_autopwnv2.rb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ def set_exploit_options(xploit)
140140
xploit.datastore['DisablePayloadHandler'] = true
141141
xploit.datastore['BrowserProfilePrefix'] = browser_profile_prefix
142142
xploit.datastore['URIPATH'] = "/#{assign_module_resource}"
143+
xploit.datastore['WORKSPACE'] = self.workspace
143144

144-
# TODO: Pass additional parameters
145-
# TODO: Pass WORKSPACE and other options down to the sub module
146-
# TODO: Add BAPv2 tracking information (?)
147-
# TODO: Change exploit output options?
145+
# TODO: Add BAPv2 tracking information (?) - HD
146+
# TODO: Change exploit output options? - HD
148147
end
149148

150149

@@ -153,7 +152,7 @@ def set_exploit_options(xploit)
153152
# @param resource [String] The resource to check.
154153
# @return [TrueClass] Resource is taken.
155154
# @return [FalseClass] Resource is not taken.
156-
# TODO: Prevent partial prefix match
155+
# TODO: Prevent partial prefix match - HD
157156
def is_resource_taken?(resource)
158157
taken = false
159158

@@ -207,7 +206,7 @@ def sort_bap_exploits
207206
# @return [Hash] A hash with each module list sorted by disclosure date.
208207
def sort_date_in_group(bap_groups)
209208
bap_groups.each_pair do |ranking, module_list|
210-
# TODO: Handle wonky dates in local modules better
209+
# TODO: Handle wonky dates in local modules better - HD
211210
bap_groups[ranking] = module_list.sort_by {|m| Date.parse(m.disclosure_date.to_s)}.reverse
212211
end
213212
end
@@ -335,14 +334,11 @@ def start_payload_listeners
335334
multi_handler.datastore['SessionExpirationTimeout'] = datastore['SessionExpirationTimeout'] if datastore['SessionExpirationTimeout']
336335
multi_handler.datastore['SessionCommunicationTimeout'] = datastore['SessionCommunicationTimeout'] if datastore['SessionCommunicationTimeout']
337336

338-
339-
# TODO: Pass WORKSPACE and other options down to the sub module
340-
341337
# Configurable only by BAP
342338
multi_handler.datastore['ExitOnSession'] = false
343339
multi_handler.datastore['EXITFUNC'] = 'thread'
340+
multi_handler.datastore['WORKSPACE'] = self.workspace
344341

345-
# TODO: BAPv2 specific options / tracking would go here
346342

347343
# Now we're ready to start the handler
348344
multi_handler.exploit_simple(
@@ -697,11 +693,13 @@ def is_ip_targeted?(cli_ip)
697693
#
698694
# @return [Fixnum] A session count.
699695
def session_count
700-
# TODO: Restrict these to the active workspace
701696
total = 0
702697

703698
payload_job_ids.each do |id|
704-
total += framework.jobs[id.to_s].ctx.first.session_count
699+
job_workspace = framework.jobs[id.to_s].ctx.first.datastore['WORKSPACE']
700+
if job_workspace == self.workspace
701+
total += framework.jobs[id.to_s].ctx.first.session_count
702+
end
705703
end
706704

707705
total

0 commit comments

Comments
 (0)