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

借鉴https://bbs.feng.com/read-htm-tid-11907107.html 

本人下载的是最新版本的teamview---1.4 

官网下载地址:https://www.teamviewer.com/cn/download/mac-os/ 

用了几天之后发现自己被鉴定为商业用途,只能远程控制几分钟...炒鸡烦人!!!!!!

自己就从网上找了个办法,自己改改使用,发现修改了id,解决了这个只能连五分钟的问题.


文件路径:

TeamViewer-id-changer.py

我修改了TeamViewer-id-changer.py文件中的路径,因为之前网上的下载对应路径不适合我,改了之后就可以用了.

使用步骤:

1 现将自己的teamview退出后台(要是自己登陆了teamview账户,一定要退出账户,不然上面的文件没用),要是没退出直接kill;   

2 然后将 TeamViewer-id-changer.py放进mac的下载目录

MAC系统下解决Teamviewer 是商业用途只能连5分钟的问题--修改Teamviewer的id_第1张图片

3 执行脚本

sudo python Downloads/TeamViewer-id-changer.py 

4 然后让你重启电脑后生效

5 重启电脑,打开teamview,id会发现发生了变化.

6 文件:

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

 

你可能感兴趣的:(其他编程语言)