b60990c19c
In order to handle TCP and UDP clients in a common manner, the DNS server created a Rex::Socket::Udp object to represent the client object allowing for a client.write(response) approach to returning results for both TCP and UDP clients. During work on the common socket abstractions (#6692) it became apparent that remote pivoted sockets cannot be created with the same exact param set used on the server socket - sockets dont reuse with localhost and localport params being the same, an exception is raised from the Windows side of the pivot abstraction. Creating a new socket for every request is also needless overhead and noise. Create the MockDnsClient class to consume peerhost, peerport, and the DNS server's UDP socket as arguments in order to execute a sendto() from the existing socket when sending a response. A write method is provided in the class for common interface between the UDP and TCP request handlers. This has been tested in conjunction with #6692 and shown to be successful as serving remote requests from the IO.select polled pivot socket running on a Windows host via Meterpreter.