一个Python3脚本,专门来用修改MacOS主机下TeamViewer软件的连接id,以防止初始id被官方误认为企业用户
#Python3 version
#!/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 'SUDO_USER' in os.environ:
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
''')
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}".encode('utf-8')
SerialPattern = "IOPlatformSerialNumber%s%s%sUUID"
ResultSerial1 = SerialPattern % (chr(0), "[0-9a-zA-Z]{8,8}", chr(0))
ResultSerial2 = SerialPattern%(chr(0), serial, chr(0))
binary = re.sub(PlatformPattern, platf.encode('utf-8'), binary)
binary = re.sub(ResultSerial1.encode('utf-8'), ResultSerial2.encode('utf-8'), 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 Exception as ex:
print(ex)
print("Error: can not patch file " + file)
print("Wrong version?")
sys.exit();
print('''
ID changed sucessfully.
!!! Restart computer before using TeamViewer !!!!
''')
11 条评论
jljlph · 2025-12-11 14:20
Great insights on horse racing strategies! It’s always smart to analyze data before placing bets. For a seamless betting experience, platforms like JLJLPH offer a wide range of options, from slots to live dealer games.
maxvina · 2025-12-19 20:07
Hey guys, Just heard of maxvina for first time and looks worth the hype. Anyone else checked it out before?
nhacai188bet · 2025-12-24 10:49
Been finding it hard to locate 188bet? Nhacai188bet.org is a reliable portal. I found that it works pretty well. Check it out and play away! Right here: nhacai188bet
91phcom · 2026-01-14 17:07
91phcom https://www.91phcom.net
bk8casino · 2026-01-14 18:42
bk8casino https://www.bk8casinovs.com
philucky · 2026-01-14 21:34
philucky https://www.usphilucky.org
balato88 · 2026-01-14 22:33
balato88 https://www.balato88u.com
pin77 online · 2026-01-14 22:44
pin77 online https://www.pin77-online.com
phtaya10 · 2026-01-14 23:57
phtaya10 https://www.phtaya10y.com
slotphlogin · 2026-01-15 03:42
slotphlogin https://www.exslotphlogin.net
684casino · 2026-01-25 13:56
684casino https://www.lists684casino.com