MCPcopy Index your code
hub / github.com/sshuttle/sshuttle / ondns

Function ondns

sshuttle/client.py:570–588  ·  view source on GitHub ↗
(listener, method, mux, handlers)

Source from the content-addressed store, hash-verified

568
569
570def ondns(listener, method, mux, handlers):
571 now = time.time()
572 t = method.recv_udp(listener, 4096)
573 if t is None:
574 return
575 srcip, dstip, data = t
576 # dstip is None if we are using a method where we can't determine
577 # the destination IP of the DNS request that we captured from the client.
578 if dstip is None:
579 debug1('DNS request from %r: %d bytes' % (srcip, len(data)))
580 else:
581 debug1('DNS request from %r to %r: %d bytes' %
582 (srcip, dstip, len(data)))
583 chan = mux.next_channel()
584 dnsreqs[chan] = now + 30
585 mux.send(chan, ssnet.CMD_DNS_REQ, data)
586 mux.channels[chan] = lambda cmd, data: dns_done(
587 chan, data, method, listener, srcip=dstip, dstip=srcip, mux=mux)
588 expire_connections(now, mux)
589
590
591def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename,

Callers

nothing calls this directly

Calls 6

debug1Function · 0.90
dns_doneFunction · 0.85
expire_connectionsFunction · 0.85
next_channelMethod · 0.80
recv_udpMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected