MAC系统下解决Teamviewer 是商业用途只能连5分钟的问题

烦烦烦烦,由于之前在一台WindowsServer2012上面下载了Teamviewer没有看清楚是商业版的,然后安装运行了一段时间后到期了。虽然已经在WindowsServer2012上面卸载了Teamviewer但是悲催的事情就是,商业用途的情况一直未能接触,后来后知后觉才发现原来是安装过商业版之后,teamview的id就会被判断为商业用途的噩梦。

后来百般波折终于找到了原因,Windows的话需要用清理软件的工具清理干净Teamviewer并且重新修改网卡的mac地址后再重新安装才可以,Windows如何修改mac地址呢,其实非常非常的简单,看下面的截图就可以了。

Mac os的话就相对来说比较复杂了,一开始度娘了之后发现需要在终端修改,一般的命令是sudo ifconfig en3 ether 00:e0:4c:6c:05:f6就可以了的,但是死活不行,后来度娘了之后发现有更高级的方法,需要用到Python去修改应用目录的文件。

下面就不多说了,拷贝下面的代码在电脑中新建一个TeamViewer-id-changer.py的运行文件,然后在终端执行sudo python TeamViewer-id-changer.py即可,然后重启电脑你就会看到你的Teamviewer的id就会有所变化,注意macOS的话需要先安装然后终端执行Python文件,以下代码;

#!/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 !!!!
''')

代码来源:CSDN

Comments: 2

「人生在世,留句话给我吧」

提交评论