Class: Msf::Exploit::Remote::SMB::Relay::TargetList
- Inherits:
-
Object
- Object
- Msf::Exploit::Remote::SMB::Relay::TargetList
- Includes:
- MonitorMixin
- Defined in:
- lib/msf/core/exploit/remote/smb/relay/target_list.rb
Overview
A thread safe target list. The provided targets will be iterated over via the #next method.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(protocol, port, targets, path = nil, randomize_targets: true) ⇒ TargetList
constructor
A new instance of TargetList.
-
#next(identity) ⇒ Target?
Return the next available target, or nil if the identity has been relayed against all targets.
-
#on_relay_end(target, identity:, is_success:) ⇒ Object
Updates tracking to mark a host as being successfully relayed or not.
Constructor Details
#initialize(protocol, port, targets, path = nil, randomize_targets: true) ⇒ TargetList
Returns a new instance of TargetList.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 9 def initialize(protocol, port, targets, path=nil, randomize_targets: true) super() targets = Rex::Socket::RangeWalker.new(targets).to_enum(:each_ip).map do |target_ip| Target.new( ip: target_ip, port: port, protocol: protocol, path: path ) end @targets = randomize_targets ? targets.shuffle : targets end |
Instance Method Details
#each(&block) ⇒ Object
23 24 25 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 23 def each(&block) @targets.each(&block) end |
#next(identity) ⇒ Target?
Return the next available target, or nil if the identity has been relayed against all targets
30 31 32 33 34 35 36 37 38 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 30 def next(identity) synchronize do next_target = next_target_for(identity) return nil if next_target.nil? next_target.on_relay_start(identity) next_target end end |
#on_relay_end(target, identity:, is_success:) ⇒ Object
Updates tracking to mark a host as being successfully relayed or not
44 45 46 47 48 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 44 def on_relay_end(target, identity:, is_success:) synchronize do target.on_relay_end(identity: identity, is_success: is_success) end end |