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

Function windows_nameservers

sshuttle/helpers.py:118–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116
117
118def windows_nameservers():
119 out = subprocess.check_output(["powershell", "-NonInteractive", "-NoProfile", "-Command", "Get-DnsClientServerAddress"],
120 encoding="utf-8")
121 servers = set()
122 for line in out.splitlines():
123 if line.startswith("Loopback "):
124 continue
125 m = re.search(r'{.+}', line)
126 if not m:
127 continue
128 for s in m.group().strip('{}').split(','):
129 s = s.strip()
130 if s.startswith('fec0:0:0:ffff'):
131 continue
132 servers.add(s)
133 debug2("Found DNS servers: %s" % servers)
134 return [(socket.AF_INET6 if ':' in s else socket.AF_INET, s) for s in servers]
135
136
137def get_random_nameserver():

Callers 1

get_random_nameserverFunction · 0.85

Calls 2

debug2Function · 0.85
addMethod · 0.80

Tested by

no test coverage detected