Skip to content

Commit 8528a10

Browse files
David MaloneyDavid Maloney
authored andcommitted
Merge branch 'feature/hd-wfsdelay'
2 parents 927785c + 6f19e30 commit 8528a10

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

lib/msf/base/simple/exploit.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ def handle_exception e
237237

238238
# Report the failure (and attempt) in the database
239239
self.report_failure
240+
241+
# Interrupt any session waiters in the handler
242+
self.interrupt_handler
240243
end
241244
#
242245
# Calls the class method.

lib/msf/core/exploit.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,9 +1193,19 @@ def handler_enabled?
11931193
# value can be one of the Handler::constants.
11941194
#
11951195
def handler(*args)
1196-
return if not payload_instance
1197-
return if not handler_enabled?
1198-
return payload_instance.handler(*args)
1196+
return unless payload_instance
1197+
return unless handler_enabled?
1198+
payload_instance.handler(*args)
1199+
end
1200+
1201+
#
1202+
# Break out of the session wait loop (WfsDelay)
1203+
#
1204+
def interrupt_handler
1205+
return unless payload_instance
1206+
return unless handler_enabled?
1207+
return unless payload_instance.respond_to?(:interrupt_wait_for_session)
1208+
payload_instance.interrupt_wait_for_session()
11991209
end
12001210

12011211
##

lib/msf/core/handler.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ def wait_for_session(t = wfs_delay)
162162
return session
163163
end
164164

165+
#
166+
# Interrupts a wait_for_session call by notifying with a nil event
167+
#
168+
def interrupt_wait_for_session
169+
return unless session_waiter_event
170+
session_waiter_event.notify(nil)
171+
end
172+
165173
#
166174
# Set by the exploit module to configure handler
167175
#

0 commit comments

Comments
 (0)