Class: Metasploit::Aggregator::GrpcServer
- Inherits:
-
Object
- Object
- Metasploit::Aggregator::GrpcServer
- Defined in:
- lib/metasploit/aggregator.rb
Instance Method Summary collapse
-
#initialize(host, port) ⇒ GrpcServer
constructor
A new instance of GrpcServer.
- #stop(force = false) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ GrpcServer
Returns a new instance of GrpcServer.
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/metasploit/aggregator.rb', line 394 def initialize(host, port) @host = host @port = port # TODO: investigate using Core::Channel to secure this communication # server = TCPServer.new(@host, @port) # sslContext = OpenSSL::SSL::SSLContext.new # sslContext.key, sslContext.cert = Metasploit::Aggregator::ConnectionManager.ssl_generate_certificate # sslServer = OpenSSL::SSL::SSLServer.new(server, sslContext) @svr = GRPC::RpcServer.new @svr.add_http2_port("#{@host}:#{@port}", :this_port_is_insecure) @svr.handle(ServerImpl) @exec = Thread.new do GrpcServer.register_for_cleanup(self) @svr.run_till_terminated end end |
Instance Method Details
#stop(force = false) ⇒ Object
414 415 416 417 |
# File 'lib/metasploit/aggregator.rb', line 414 def stop(force = false) GrpcServer.unregister_for_cleanup(self) unless force @svr.stop if @svr.running? end |