mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-04-23 18:58:59 +02:00
suppport --auto-hosts in Windows
This commit is contained in:
parent
89a94ff150
commit
81a598a4cc
@ -15,7 +15,10 @@ import sshuttle.helpers as helpers
|
|||||||
from sshuttle.helpers import is_admin_user, log, debug1, debug2, debug3, Fatal
|
from sshuttle.helpers import is_admin_user, log, debug1, debug2, debug3, Fatal
|
||||||
from sshuttle.methods import get_auto_method, get_method
|
from sshuttle.methods import get_auto_method, get_method
|
||||||
|
|
||||||
HOSTSFILE = '/etc/hosts'
|
if sys.platform == 'win32':
|
||||||
|
HOSTSFILE = r"C:\Windows\System32\drivers\etc\hosts"
|
||||||
|
else:
|
||||||
|
HOSTSFILE = '/etc/hosts'
|
||||||
sshuttle_pid = None
|
sshuttle_pid = None
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +51,7 @@ def rewrite_etc_hosts(hostmap, port):
|
|||||||
f.write('%-30s %s\n' % ('%s %s' % (ip, name), APPEND))
|
f.write('%-30s %s\n' % ('%s %s' % (ip, name), APPEND))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
if sys.platform != 'win32':
|
||||||
if st is not None:
|
if st is not None:
|
||||||
os.chown(tmpname, st.st_uid, st.st_gid)
|
os.chown(tmpname, st.st_uid, st.st_gid)
|
||||||
os.chmod(tmpname, st.st_mode)
|
os.chmod(tmpname, st.st_mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user