def main(): if os.name != 'nt': return sysver = platform.version() if sysver < '6': # Teredo item was added to Group Policy starting with Windows Vista return windir = os.environ.get('windir') if not windir: return try: zh_locale = locale.getdefaultlocale()[0] == 'zh_CN' except: zh_locale = None if zh_locale: notice_title = u'\u63d0\u9192' notice_text = u'\u53d1\u73b0\u7ec4\u7b56\u7565 Teredo \u8bbe\u7f6e\uff0c\u662f\u5426\u91cd\u7f6e\uff1f' else: notice_title = 'Notice' notice_text = 'Found Teredo settings in Group Policy, do you want to reset it?' sys64 = os.path.exists(windir + '\\SysWOW64') pe32 = platform.architecture()[0] == '32bit' sysalias = 'Sysnative' if sys64 and pe32 else 'System32' sysnative = '%s\\%s' % (windir, sysalias) gp_regpol_file = sysnative + '\\GroupPolicy\\Machine\\Registry.pol' if os.path.exists(gp_regpol_file): if not win32runas.is_admin(): win32runas.runas(os.path.abspath(__file__)) return reset_teredo()
wait_info = 'Please wait 10 seconds...' resume_info = 'The teredo cilent has resumed.' warn_1 = 'The value of parameter "-p" error: local port must be a number.' warn_2 = 'The value of parameter "-P" error: remote port must be a number.' warn_3 = 'This device may not be able to use teredo tunnel, the NAT type is %s!' warn_4 = 'We can not judge the NAT type.' confirm_stop = 'Stop teredo cilent for run prober, Y/N? ' confirm_set = 'Do you want to set recommend teredo server, Y/N? ' confirm_reset = 'Do you want to reset refreshinterval to the default value, Y/N? ' confirm_over = 'Press enter to over...' confirm_force = 'Do you want to force probe and set the teredo servers, Y/N? ' nat_type_result = 'The NAT type is %s.' if os.name == 'nt': import win32runas if win32runas.is_admin(): runas = os.system else: def runas(cmd): cmd = tuple(cmd.split(None, 1)) if len(cmd) == 1: cmd += None, win32runas.runas(cmd[1], cmd[0]) def main(local_port=None, remote_port=None, *args): server_list = [] + teredo_server_list for arg in args: if isinstance(arg, str): server_list.append(arg) elif isinstance(arg, list): server_list += arg
if len(gp_regpol_new) != len(gp_regpol_old) and \ win32_notify(u'发现组策略 Teredo 设置,是否重置?', u'提醒'): with open(gp_regpol_file, 'wb') as f: f.write(gp_split.join(gp_regpol_new)) os.system(sysnative + '\\gpupdate /target:computer /force') if '__main__' == __name__: if os.name != 'nt': sys.exit(0) sysver = platform.version() if sysver < '6': # Teredo item was added to Group Policy starting with Windows Vista sys.exit(0) windir = os.environ.get('windir') if not windir: sys.exit(-1) sys64 = os.path.exists(windir + '\\SysWOW64') pe32 = platform.architecture()[0] == '32bit' sysalias = 'Sysnative' if sys64 and pe32 else 'System32' sysnative = '%s\\%s' % (windir, sysalias) gp_regpol_file = sysnative + '\\GroupPolicy\\Machine\\Registry.pol' if os.path.exists(gp_regpol_file): if not win32runas.is_admin(): win32runas.runas() sys.exit(0) reset_teredo()
if len(gp_regpol_new) != len(gp_regpol_old) and \ win32_notify(u'发现组策略 Teredo 设置,是否重置?', u'提醒'): with open(gp_regpol_file, 'wb') as f: f.write(gp_split.join(gp_regpol_new)) os.system(sysnative + '\\gpupdate /target:computer /force') if '__main__' == __name__: if os.name != 'nt': sys.exit(0) sysver = platform.version() if sysver < '6': # Teredo item was added to Group Policy starting with Windows Vista sys.exit(0) windir = os.environ.get('windir') if not windir: sys.exit(-1) sys64 = os.path.exists(windir + '\\SysWOW64') pe32 = platform.architecture()[0] == '32bit' sysalias = 'Sysnative' if sys64 and pe32 else 'System32' sysnative = '%s\\%s' % (windir, sysalias) gp_regpol_file = sysnative + '\\GroupPolicy\\Machine\\Registry.pol' if os.path.exists(gp_regpol_file): if not win32runas.is_admin(): win32runas.runas() sys.exit(0) reset_teredo()
wait_info = 'Please wait 10 seconds...' resume_info = 'The teredo cilent has resumed.' warn_1 = 'The value of parameter "-p" error: local port must be a number.' warn_2 = 'The value of parameter "-P" error: remote port must be a number.' warn_3 = 'This device may not be able to use teredo tunnel, the NAT type is %s!' warn_4 = 'We can not judge the NAT type.' confirm_stop = 'Stop teredo cilent for run prober, Y/N? ' confirm_set = 'Do you want to set recommend teredo server, Y/N? ' confirm_reset = 'Do you want to reset refreshinterval to the default value, Y/N? ' confirm_over = 'Press enter to over...' confirm_force = 'Do you want to force probe and set the teredo servers, Y/N? ' nat_type_result = 'The NAT type is %s.' if os.name == 'nt': import win32runas if win32runas.is_admin(): runas = os.system else: def runas(cmd): cmd = tuple(cmd.split(None, 1)) if len(cmd) == 1: cmd += None, win32runas.runas(cmd[1], cmd[0]) def main(local_port=None, remote_port=None, *args): server_list = [] + teredo_server_list for arg in args: if isinstance(arg, str): server_list.append(arg) elif isinstance(arg, list): server_list += arg