首页 正文

teamviewer克隆系统后id相同的解决办法大全

       3134      2018-04-08    

因为我的mac换了硬盘。所以用磁盘工具把原来的硬盘都整个复制了去到新的硬盘。同时就得硬盘还能用,就换到一台就得mac mini上去了。谁知道两台电脑打开teamviewer后发现用的是同一个teamviewer id 。这就搞笑了。于是上google找了一下对应的方法,顺便记录下来给有需要的朋友用。


MAC更换或重置的方法

在任意位置新建文件teamviewer.py

然后输入下面代码

#!/usr/bin/env python 

#coding:utf-8
import sys
import os
import glob
import platform
import re
import random
import string

print('''
--------------------------------
TeamViewer ID Changer for MAC OS
--------------------------------
''')

if platform.system() != 'Darwin':
    print('This script can be run only on MAC OS.')
    sys.exit();

if os.geteuid() != 0:
    print('This script must be run form root.')
    sys.exit();

if os.environ.has_key('SUDO_USER'):
    USERNAME = os.environ['SUDO_USER']
    if USERNAME == 'root':
       print('Can not find user name. Run this script via sudo from regular user')
       sys.exit();
else:
    print('Can not find user name. Run this script via sudo from regular user')
    sys.exit();

HOMEDIRLIB = '/Users/' + USERNAME  + '/library/preferences/'
GLOBALLIB  =  '/library/preferences/'

CONFIGS = []

# Find config files

def listdir_fullpath(d):
    return [os.path.join(d, f) for f in os.listdir(d)]

for file in listdir_fullpath(HOMEDIRLIB):
    if 'teamviewer'.lower() in file.lower():
        CONFIGS.append(file)

if not CONFIGS:
    print ('''
There is no TemViewer configs found.
Maybe you have deleted it manualy or never run TeamViewer after installation.
Nothing to delete.
''')
# Delete config files
else:
    print("Configs found:\n")
    for file in CONFIGS:
        print file

    print('''
This files will be DELETED permanently.
All TeamViewer settings will be lost
''')
    raw_input("Press Enter to continue or CTR+C to abort...")

    for file in CONFIGS:
        try:
            os.remove(file)
        except:
            print("Cannot delete config files. Permission denied?")
            sys.exit();
    print("Done.")

# Find binaryes

TMBINARYES = [
'/Applications/TeamViewer.app/Contents/MacOS/TeamViewer',
'/Applications/TeamViewer.app/Contents/MacOS/TeamViewer_Service',
'/Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Desktop',
]

for file in TMBINARYES:
    if os.path.exists(file):
        pass
    else:
        print("File not found: " + file)
        print ("Install TeamViewer correctly")
        sys.exit();

# Patch files

def idpatch(fpath,platf,serial):
    file = open(fpath, 'r+b')
    binary = file.read()
    PlatformPattern = "IOPlatformExpert.{6}"
    SerialPattern =  "IOPlatformSerialNumber%s%s%sUUID"

    binary = re.sub(PlatformPattern, platf, binary)
    binary = re.sub(SerialPattern % (chr(0), "[0-9a-zA-Z]{8,8}", chr(0)), SerialPattern%(chr(0), serial, chr(0)), binary)

    file = open(fpath,'wb').write(binary)
    return True

def random_generator(size=8, chars=string.ascii_uppercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))

RANDOMSERIAL = random_generator()
RANDOMPLATFORM = "IOPlatformExpert" + random_generator(6)


for file in TMBINARYES:
        try:
            idpatch(file,RANDOMPLATFORM,RANDOMSERIAL)
        except:
            print "Error: can not patch file " + file
            print "Wrong version?"
            sys.exit();

print "PlatformDevice: " + RANDOMPLATFORM
print "PlatformSerial: " + RANDOMSERIAL

print('''
ID changed sucessfully.
!!! Restart computer before using TeamViewer !!!!
''')

保存后,在终端那里找到文件位置输入

sudo ./teamviewer.py

即可。如果不行的话运行完后把teamviewer删了重装基本就可以的了。

windows10更换或重置的方法

ctrl+r,输入regedit.exe,打开注册表。

对于32位系统的找到 HKLM\SOFTWARE\TeamViewer\Version[X] 然后删除 DWORD里ClientID的值; 

对于64位的找到 HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version[X]然后删除DWORD里ClientID的值; 查看一下HKEY_CURRENT_USER\Software\TeamViewer是否存在,如果存在就把他删了


原文链接https://theitbros.com/reset-teamviewer-id/

我要打赏