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
-
#drop_mic_and_sign_key_exch_flags ⇒ Object
readonly
Returns the value of attribute drop_mic_and_sign_key_exch_flags.
-
#drop_mic_only ⇒ Object
readonly
Returns the value of attribute drop_mic_only.
-
#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.
-
#protocol_options ⇒ Object
readonly
Returns the value of attribute protocol_options.
Instance Method Summary collapse
- #eligible_relay_target?(identity) ⇒ Boolean
-
#initialize(ip:, port:, protocol:, path: nil, drop_mic_only: false, drop_mic_and_sign_key_exch_flags: false, protocol_options: 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, drop_mic_only: false, drop_mic_and_sign_key_exch_flags: false, protocol_options: nil) ⇒ Target
Returns a new instance of Target.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 68 def initialize(ip:, port:, protocol:, path: nil, drop_mic_only: false, drop_mic_and_sign_key_exch_flags: false, protocol_options: nil) @ip = ip @port = port @protocol = protocol @path = path @protocol_options = @relay_state = Hash.new do |hash, identity| hash[identity] = { relay_status: nil, relay_attempted_at: nil, relayed_at: nil, relay_attempts: 0 } end @drop_mic_only= drop_mic_only @drop_mic_and_sign_key_exch_flags = drop_mic_and_sign_key_exch_flags end |
Instance Attribute Details
#drop_mic_and_sign_key_exch_flags ⇒ Object (readonly)
Returns the value of attribute drop_mic_and_sign_key_exch_flags.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def drop_mic_and_sign_key_exch_flags @drop_mic_and_sign_key_exch_flags end |
#drop_mic_only ⇒ Object (readonly)
Returns the value of attribute drop_mic_only.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def drop_mic_only @drop_mic_only end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def ip @ip end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def port @port end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def protocol @protocol end |
#protocol_options ⇒ Object (readonly)
Returns the value of attribute protocol_options.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 86 def @protocol_options end |
Instance Method Details
#eligible_relay_target?(identity) ⇒ Boolean
88 89 90 91 92 93 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 88 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
107 108 109 110 111 112 113 114 115 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 107 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
100 101 102 103 104 105 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 100 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
95 96 97 98 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 95 def relay_attempts_for(identity) relay_data = relay_data_for(identity) relay_data[:relay_attempts] end |
#to_h ⇒ Object
117 118 119 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 117 def to_h { ip: ip, port: port, protocol: protocol, path: path, relay_state: @relay_state } end |
#to_s ⇒ Object
121 122 123 124 125 |
# File 'lib/msf/core/exploit/remote/smb/relay/target_list.rb', line 121 def to_s s = "#{protocol}://#{Rex::Socket.(ip, port)}" s << ('/' + path.delete_prefix('/')) unless path.blank? s end |