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.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#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:, path: nil) ⇒ 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
- #to_s ⇒ Object
Constructor Details
#initialize(ip:, port:, protocol:, path: nil) ⇒ Target
Returns a new instance of Target.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 65 def initialize(ip:, port:, protocol:, path: nil) @ip = ip @port = port @protocol = protocol @path = path @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.
80 81 82 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 80 def ip @ip end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
80 81 82 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 80 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
80 81 82 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 80 def port @port end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
80 81 82 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 80 def protocol @protocol end |
Instance Method Details
#eligible_relay_target?(identity) ⇒ Boolean
82 83 84 85 86 87 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 82 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
101 102 103 104 105 106 107 108 109 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 101 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
94 95 96 97 98 99 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 94 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
89 90 91 92 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 89 def relay_attempts_for(identity) relay_data = relay_data_for(identity) relay_data[:relay_attempts] end |
#to_h ⇒ Object
111 112 113 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 111 def to_h { ip: ip, port: port, protocol: protocol, path: path, relay_state: @relay_state } end |
#to_s ⇒ Object
115 116 117 118 119 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 115 def to_s s = "#{protocol}://#{Rex::Socket.(ip, port)}" s << ('/' + path.delete_prefix('/')) unless path.blank? s end |