parent
b0498d0991
commit
f3a820b475
|
@ -1,4 +1,3 @@
|
|||
require 'msf/core/exploit/tcp'
|
||||
require 'rex/proto/nuuo'
|
||||
|
||||
###
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# -*- coding: binary -*-
|
||||
|
||||
# NUUO implementation
|
||||
|
||||
#require 'rex/socket'
|
||||
require 'rex/proto/nuuo/client'
|
||||
require 'rex/proto/nuuo/client_request'
|
||||
require 'rex/proto/nuuo/constants'
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require 'rex/proto/nuuo/client_request'
|
||||
require 'rex/proto/nuuo/response'
|
||||
require 'rex/socket'
|
||||
|
||||
module Rex
|
||||
module Proto
|
||||
|
@ -17,9 +18,6 @@ class Client
|
|||
# @!attribute timeout
|
||||
# @return [Integer] The connect/read timeout
|
||||
attr_accessor :timeout
|
||||
# @!attribute protocol
|
||||
# @return [String] The transport protocol used (tcp/udp)
|
||||
attr_accessor :protocol
|
||||
# @!attribute connection
|
||||
# @return [IO] The connection established through Rex sockets
|
||||
attr_accessor :connection
|
||||
|
@ -46,7 +44,6 @@ class Client
|
|||
self.host = opts[:host]
|
||||
self.port = opts[:port] || 5180
|
||||
self.timeout = opts[:timeout] || 10
|
||||
self.protocol = opts[:protocol] || 'tcp'
|
||||
self.context = opts[:context] || {}
|
||||
self.username = opts[:username]
|
||||
self.password = opts[:password]
|
||||
|
@ -58,11 +55,9 @@ class Client
|
|||
# Creates a connection through a Rex socket
|
||||
#
|
||||
# @return [Rex::Socket::Tcp]
|
||||
# @raise [RuntimeError] if 'tcp' is not requested
|
||||
def connect(temp: false)
|
||||
return connection if connection && !temp
|
||||
return create_tcp_connection(temp: temp) if protocol == 'tcp'
|
||||
raise ::RuntimeError, 'Nuuo Client: Unknown transport protocol'
|
||||
return create_tcp_connection(temp: temp)
|
||||
end
|
||||
|
||||
# Closes the connection
|
||||
|
|
|
@ -16,14 +16,6 @@ RSpec.describe Rex::Proto::Nuuo::Client do
|
|||
let(:client_password) {nil}
|
||||
|
||||
describe '#connect' do
|
||||
context 'given udp option when created' do
|
||||
let(:protocol) {'udp'}
|
||||
|
||||
it 'raises an error' do
|
||||
expect{client.connect}.to raise_error(::RuntimeError)
|
||||
end
|
||||
end
|
||||
|
||||
context 'given temp is false' do
|
||||
context 'when there is no connection' do
|
||||
it 'returns a tcp connection' do
|
||||
|
|
Loading…
Reference in New Issue