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

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

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



22
23
24
25
26
# File 'lib/rex/proto/dns/server.rb', line 22

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

Instance Attribute Details

#peerhostObject (readonly)

Returns the value of attribute peerhost.



13
14
15
# File 'lib/rex/proto/dns/server.rb', line 13

def peerhost
  @peerhost
end

#peerportObject (readonly)

Returns the value of attribute peerport.



13
14
15
# File 'lib/rex/proto/dns/server.rb', line 13

def peerport
  @peerport
end

#srvsockObject (readonly)

Returns the value of attribute srvsock.



13
14
15
# File 'lib/rex/proto/dns/server.rb', line 13

def srvsock
  @srvsock
end

Instance Method Details

#mock_dns_client?Boolean

Test method to prevent GC/ObjectSpace abuse via class lookups

Returns:

  • (Boolean)


31
32
33
# File 'lib/rex/proto/dns/server.rb', line 31

def mock_dns_client?
  true
end

#write(data) ⇒ Object



35
36
37
# File 'lib/rex/proto/dns/server.rb', line 35

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