Class: Rex::Proto::DNS::Server::MockDnsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/proto/dns/server.rb

Overview

Cache

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, sock) ⇒ MockDnsClient

Create mock DNS client

Parameters:

  • host (String)

    PeerHost IP address

  • port (Fixnum)

    PeerPort integer


150
151
152
153
154
# File 'lib/rex/proto/dns/server.rb', line 150

def initialize(host, port, sock)
  @peerhost = host
  @peerport = port
  @srvsock = sock
end

Instance Attribute Details

#peerhostObject (readonly)

Returns the value of attribute peerhost


143
144
145
# File 'lib/rex/proto/dns/server.rb', line 143

def peerhost
  @peerhost
end

#peerportObject (readonly)

Returns the value of attribute peerport


143
144
145
# File 'lib/rex/proto/dns/server.rb', line 143

def peerport
  @peerport
end

#srvsockObject (readonly)

Returns the value of attribute srvsock


143
144
145
# File 'lib/rex/proto/dns/server.rb', line 143

def srvsock
  @srvsock
end

Instance Method Details

#mock_dns_client?Boolean

Test method to prevent GC/ObjectSpace abuse via class lookups

Returns:

  • (Boolean)

159
160
161
# File 'lib/rex/proto/dns/server.rb', line 159

def mock_dns_client?
  true
end

#write(data) ⇒ Object


163
164
165
# File 'lib/rex/proto/dns/server.rb', line 163

def write(data)
  srvsock.sendto(data, peerhost, peerport)
end