Class: Msf::Aggregator::Server
Overview
ServerProxy
Instance Method Summary collapse
- #add_cable(type, host, port, certificate = nil) ⇒ Object
- #available? ⇒ Boolean
- #available_addresses ⇒ Object
- #cables ⇒ Object
-
#initialize ⇒ Server
constructor
include Metasploit::Aggregator::ConnectionManager.
- #obtain_session(payload, rhost, rport) ⇒ Object
- #register_default(lhost, lport, payload_list) ⇒ Object
- #release_session(host) ⇒ Object
- #remove_cable(host, port) ⇒ Object
- #sessions ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ Server
include Metasploit::Aggregator::ConnectionManager
138 139 140 |
# File 'lib/msf/aggregator.rb', line 138 def initialize @manager = nil end |
Instance Method Details
#add_cable(type, host, port, certificate = nil) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/msf/aggregator.rb', line 172 def add_cable(type, host, port, certificate = nil) unless @manager.nil? case type when Cable::HTTPS # TODO: check if already listening on that port @manager.add_cable_https(host, port, certificate) when Cable::HTTP @manager.add_cable_http(host, port) else Logger.log("#{type} cables are not supported.") end end true end |
#available? ⇒ Boolean
147 148 149 |
# File 'lib/msf/aggregator.rb', line 147 def available? !@manager.nil? end |
#available_addresses ⇒ Object
200 201 202 203 204 205 206 207 |
# File 'lib/msf/aggregator.rb', line 200 def available_addresses addr_list = Socket.ip_address_list addresses = [] addr_list.each do |addr| addresses << addr.ip_address end addresses end |
#cables ⇒ Object
155 156 157 |
# File 'lib/msf/aggregator.rb', line 155 def cables @manager.cables end |
#obtain_session(payload, rhost, rport) ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/msf/aggregator.rb', line 159 def obtain_session(payload, rhost, rport) # return session object details or UUID/uri # forwarding will cause new session creation on the console # TODO: check and set lock on payload requested see note below in register_default @manager.register_forward(rhost, rport, [ payload ]) true # update later to return if lock obtained end |
#register_default(lhost, lport, payload_list) ⇒ Object
193 194 195 196 197 198 |
# File 'lib/msf/aggregator.rb', line 193 def register_default(lhost, lport, payload_list) # add this payload list to each forwarder for this remote console # TODO: consider adding boolean param to ConnectionManager.register_forward to 'lock' @manager.register_forward(lhost, lport, payload_list) true end |
#release_session(host) ⇒ Object
167 168 169 170 |
# File 'lib/msf/aggregator.rb', line 167 def release_session(payload) @manager.park(payload) true # return always return success for now end |
#remove_cable(host, port) ⇒ Object
187 188 189 190 191 |
# File 'lib/msf/aggregator.rb', line 187 def remove_cable(host, port) unless @manager.nil? @manager.remove_cable(host, port) end end |
#sessions ⇒ Object
151 152 153 |
# File 'lib/msf/aggregator.rb', line 151 def sessions @manager.connections end |
#start ⇒ Object
142 143 144 145 |
# File 'lib/msf/aggregator.rb', line 142 def start @manager = Msf::Aggregator::ConnectionManager.new true end |
#stop ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/msf/aggregator.rb', line 209 def stop unless @manager.nil? @manager.stop end @manager = nil true end |