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

Function _check_etc_hosts

sshuttle/hostwatch.py:116–134  ·  view source on GitHub ↗

If possible, read /etc/hosts to find hosts.

()

Source from the content-addressed store, hash-verified

114
115
116def _check_etc_hosts():
117 """If possible, read /etc/hosts to find hosts."""
118 filename = '/etc/hosts'
119 debug2(' > Reading %s on remote host' % filename)
120 try:
121 for line in open(filename):
122 line = re.sub(r'#.*', '', line) # remove comments
123 words = line.strip().split()
124 if not words:
125 continue
126 ip = words[0]
127 if _is_ip(ip):
128 names = words[1:]
129 debug3('< %s %r' % (ip, names))
130 for n in names:
131 check_host(n)
132 found_host(n, ip)
133 except (OSError, IOError):
134 debug1("Failed to read %s on remote host" % filename)
135
136
137def _check_revdns(ip):

Callers

nothing calls this directly

Calls 6

debug2Function · 0.90
debug3Function · 0.90
debug1Function · 0.90
_is_ipFunction · 0.85
check_hostFunction · 0.85
found_hostFunction · 0.85

Tested by

no test coverage detected