Class: Msf::Exploit::Remote::SMB::Relay::Target
- Inherits:
-
Object
- Object
- Msf::Exploit::Remote::SMB::Relay::Target
- Defined in:
- lib/msf/core/exploit/remote/smb/relay/target_list.rb
Instance Attribute Summary collapse
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Instance Method Summary collapse
- #eligible_relay_target?(identity) ⇒ Boolean
-
#initialize(ip:, port:, protocol:) ⇒ Target
constructor
A new instance of Target.
- #on_relay_end(identity:, is_success:) ⇒ Object
- #on_relay_start(identity) ⇒ Object
- #relay_attempts_for(identity) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(ip:, port:, protocol:) ⇒ Target
Returns a new instance of Target.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 60 def initialize(ip:, port:, protocol:) @ip = ip @port = port @protocol = protocol @relay_state = Hash.new do |hash, identity| hash[identity] = { relay_status: nil, relay_attempted_at: nil, relayed_at: nil, relay_attempts: 0 } end end |
Instance Attribute Details
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
74 75 76 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 74 def ip @ip end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
74 75 76 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 74 def port @port end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
74 75 76 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 74 def protocol @protocol end |
Instance Method Details
#eligible_relay_target?(identity) ⇒ Boolean
76 77 78 79 80 81 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 76 def eligible_relay_target?(identity) return true if identity.nil? relay_data = relay_data_for(identity) relay_data[:relay_status].nil? || relay_data[:relay_status] == :failed end |
#on_relay_end(identity:, is_success:) ⇒ Object
95 96 97 98 99 100 101 102 103 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 95 def on_relay_end(identity:, is_success:) relay_data = relay_data_for(identity) if is_success relay_data[:relay_status] = :success relay_data[:relayed_at] = Time.now else relay_data[:relay_status] = :failed end end |
#on_relay_start(identity) ⇒ Object
88 89 90 91 92 93 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 88 def on_relay_start(identity) relay_data = relay_data_for(identity) relay_data[:relay_attempts] += 1 relay_data[:relay_attempted_at] = Time.now relay_data[:relay_status] = :attempting end |
#relay_attempts_for(identity) ⇒ Object
83 84 85 86 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 83 def relay_attempts_for(identity) relay_data = relay_data_for(identity) relay_data[:relay_attempts] end |
#to_h ⇒ Object
105 106 107 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 105 def to_h { ip: ip, port: port, protocol: protocol, relay_state: @relay_state } end |