Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Teamviewer 15 id changer for Mac OS X
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
import random
import re
import string
import sys
print('''
--------------------------------
TeamViewer ID Changer for MAC OS
--------------------------------
''')
if sys.version[0:1] != "2":
print("This script can be run only on Python27.")
sys.exit()
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' in file.lower():
CONFIGS.append(file)
for file in listdir_fullpath(GLOBALLIB):
if 'teamviewer' 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.
''')
else:
# Delete config files
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/MacOS/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%s"
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.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
RANDOMSERIAL = random_generator(8)
RANDOMPLATFORM = "IOPlatformExpert" + random_generator(6)
for file in TMBINARYES:
try:
idpatch(file, RANDOMPLATFORM, RANDOMSERIAL)
except:
print("Error: can not patch file " + file)
sys.exit()
print("PlatformDevice: " + RANDOMPLATFORM)
print("PlatformSerial: " + RANDOMSERIAL)
os.system("sudo codesign -f -s - /Applications/TeamViewer.app/")
print('''
ID changed sucessfully.
!!! Restart computer before using TeamViewer !!!!
''')
@hyuhui

This comment has been minimized.

Copy link

hyuhui commented Mar 30, 2019

使用这个脚本之后,重启电脑,t打开eamviewer马上就会闪退

@nichwang88

This comment has been minimized.

Copy link

nichwang88 commented Apr 4, 2019

用了你之前的py和这个py在最新的版本14.2.2558上。重启能进入软件,并且获得新的ID,但是无法显示(本计算机),并且关闭程序再次尝试进入程序就一直报需要安装帮助,导致无法进入程序。重装官方软件,登录账户以后,又恢复成之前的ID,依然有限制。最后还是非常感谢作者制作这个代码。

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Apr 24, 2019

你们如果还是不能用的话可以尝试下禁用SIP试试

@MittWillson

This comment has been minimized.

Copy link

MittWillson commented May 5, 2019

或者重新签名整个 TeamViewer.app 可以避免禁用SIP和重启电脑

$ sudo codesign -f -s - /Applications/TeamViewer.app/
@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented May 8, 2019

@MittWillson 我脚本代码里面已经包含重签代码了, 不过我只重签了二进制文件, 没有整个app重签, 不知道区别如何, 还有一点, 就是你们在用的时候有没有发现每次启动都提示你要开隐私权限的问题

@junny0204

This comment has been minimized.

Copy link

junny0204 commented May 16, 2019

如果不關閉SIP,的確無法啟動,而且每次都會提示開啟隱私權的問題,我的版本是 14.1.3399

@gebiwang168

This comment has been minimized.

Copy link

gebiwang168 commented May 18, 2019

我的版本是14.0.xxx,用这个脚本执行完后重启电脑,ID会变,连客户端会还是会提示5minuites,提示内容如下:
IMPORTANT:Please update the remote TeamViewer now,as it does not use the latest version.
The remote TeamViewer version will be deprecated soon.
Therefore,please update otherwise your connection will be stopped after 5 minutes!
During the connection,click on Action -> Remote update

@DawnLi-code

This comment has been minimized.

Copy link

DawnLi-code commented Jun 8, 2019

@gebiwang168

你这个也可能是敌方...哦不...对方的tv被商业化了,对方也脚本走一波试试。

@diablothebest

This comment has been minimized.

Copy link

diablothebest commented Jun 25, 2019

Work perfect on Mojave 10.14.6 Beta with TV 14.3.4730 ! SIP disable course)

@sqp15567

This comment has been minimized.

Copy link

sqp15567 commented Jun 27, 2019

Hint: grep -r "IOPlatformExpert" /Applications/TeamViewer.app/

@McDifference

This comment has been minimized.

Copy link

McDifference commented Jul 11, 2019

macOS Mojave 10.14.5
TeamViewer 14.3.4730
可以用,只是每次启动都手动授予权限。
It works. But have to grant accessibility permissions every time you start TeamViewer.

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Jul 15, 2019

macOS Mojave 10.14.5
TeamViewer 14.3.4730
可以用,只是每次启动都手动授予权限。
It works. But have to grant accessibility permissions every time you start TeamViewer.

你这情况之前我也遇到过,我也没找到原因,怀疑跟重签名有关系,也可能跟没删除干净有关系,如果实在不行的话打开SIP肯定可以解决

@zhovner

This comment has been minimized.

Copy link

zhovner commented Jul 20, 2019

Nice, thank you! Will update my source.

@hungdev

This comment has been minimized.

Copy link

hungdev commented Jul 21, 2019

@zhenhappy it works for me, thank you.
macOS Mojave 10.14.5
TeamViewer 14.4.2669
And i get the error like McDifference. it asks me grant accessibility permissions every time i start TeamViewer. But i think it is not problem. =))) thanks you so much.

@IngJedi76

This comment has been minimized.

Copy link

IngJedi76 commented Jul 31, 2019

macOS High Sierra 10.13.6
Teamviewer 14.3.4730
it works perfectly
open terminal to write sudo python file.py
reset computer

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Aug 1, 2019

@zhenhappy it works for me, thank you.
macOS Mojave 10.14.5
TeamViewer 14.4.2669
And i get the error like McDifference. it asks me grant accessibility permissions every time i start TeamViewer. But i think it is not problem. =))) thanks you so much.

Yeah, I have encountered this problem, this problem is not necessarily present, you can try to disabled SIP

@YaoZhongwei

This comment has been minimized.

Copy link

YaoZhongwei commented Aug 19, 2019

Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
请问这个是什么问题?

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Aug 21, 2019

Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
请问这个是什么问题?

你命令用sudo了吗

@milch1997

This comment has been minimized.

Copy link

milch1997 commented Aug 22, 2019

Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
请问这个是什么问题?

你命令用sudo了吗
Can you help me with TeamViewer for mac os.
I did your script and can not open teamviewer.
SIP turn off
macOS Mojave 10.14.6
Teamviewer 14.3.4730
Maybe need delete previous teamviewer version? How to do it?

@milch1997

This comment has been minimized.

Copy link

milch1997 commented Aug 22, 2019

All working
BIG THANKS
$ sudo codesign -f -s - /Applications/TeamViewer.app/ T
These help me

@crisper91

This comment has been minimized.

Copy link

crisper91 commented Sep 9, 2019

I still get error Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
macOS Mojave 10.14.6
Teamviewer 14.3.4730
How to fix it?
Screen Shot 2019-09-09 at 8 58 37 AM

@ghost

This comment has been minimized.

Copy link

ghost commented Sep 15, 2019

TeamViewer ID Changer for MAC OS

Configs found:

/Users/zhangxiaoyue/library/preferences/com.teamviewer.teamviewer.preferences.plist
/Users/zhangxiaoyue/library/preferences/com.teamviewer.TeamViewer.plist
/Users/zhangxiaoyue/library/preferences/com.teamviewer.teamviewer.preferences.Machine.plist

This files will be DELETED permanently.
All TeamViewer settings will be lost

Press Enter to continue or CTR+C to abort...
Done.
File not found: /Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Assignment
Install TeamViewer correctly

执行脚本后提示这个,算成功了吗

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Sep 17, 2019

TeamViewer ID Changer for MAC OS

Configs found:

/Users/zhangxiaoyue/library/preferences/com.teamviewer.teamviewer.preferences.plist
/Users/zhangxiaoyue/library/preferences/com.teamviewer.TeamViewer.plist
/Users/zhangxiaoyue/library/preferences/com.teamviewer.teamviewer.preferences.Machine.plist

This files will be DELETED permanently.
All TeamViewer settings will be lost

Press Enter to continue or CTR+C to abort...
Done.
File not found: /Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Assignment
Install TeamViewer correctly

执行脚本后提示这个,算成功了吗

失败的, 提示找不到文件,你检查下是否有这个文件

@crisper91

This comment has been minimized.

Copy link

crisper91 commented Sep 17, 2019

失败的, 提示找不到文件,你检查下是否有这个文件
image
I still get error Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
How to fix it? @zhenhappy
Thanks

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Sep 25, 2019

失败的, 提示找不到文件,你检查下是否有这个文件
image
I still get error Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
How to fix it? @zhenhappy
Thanks

What's your teamviewer's version?

@crisper91

This comment has been minimized.

Copy link

crisper91 commented Sep 27, 2019

失败的, 提示找不到文件,你检查下是否有这个文件
image
I still get error Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
How to fix it? @zhenhappy
Thanks

What's your teamviewer's version?

macOS Mojave 10.14.6
Teamviewer 14.3.4730

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Sep 30, 2019

失败的, 提示找不到文件,你检查下是否有这个文件
image
I still get error Error: can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
How to fix it? @zhenhappy
Thanks

What's your teamviewer's version?

macOS Mojave 10.14.6
Teamviewer 14.3.4730

Please use python 2.7. Can you check your python version?

sudo /usr/bin/python TeamViewer-14-id-changer-for-mac.py

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Oct 26, 2019

For the latest version, please skip the security password screen, allow all accessibility

@luciphear

This comment has been minimized.

Copy link

luciphear commented Nov 11, 2019

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Nov 24, 2019

Support TV 15

@vitaliygorsky

This comment has been minimized.

Copy link

vitaliygorsky commented Dec 21, 2019

Hi, I have a problem, how can I fix it? Teamviewer 15

Last login: Sat Dec 21 11:14:42 on ttys000
vitaliygorsky@MBPVitaiiGorsky ~ % sudo /usr/bin/python TeamViewer-14-id-changer-for-mac.py
Password:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'TeamViewer-14-id-changer-for-mac.py': [Errno 2] No such file or directory
vitaliygorsky@MBPVitaiiGorsky ~ % cd desktop
vitaliygorsky@MBPVitaiiGorsky desktop % sudo /usr/bin/python TeamViewer-14-id-changer-for-mac.py


TeamViewer ID Changer for MAC OS

Configs found:

/Users/vitaliygorsky/library/preferences/com.teamviewer.TeamViewer.plist
/Users/vitaliygorsky/library/preferences/com.teamviewer.teamviewer.preferences.Machine.plist

This files will be DELETED permanently.
All TeamViewer settings will be lost

Press Enter to continue or CTR+C to abort...
Done.
File not found: /Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Desktop
Install TeamViewer correctly
vitaliygorsky@MBPVitaiiGorsky desktop %

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Dec 24, 2019

Hi, I have a problem, how can I fix it? Teamviewer 15

Last login: Sat Dec 21 11:14:42 on ttys000
vitaliygorsky@MBPVitaiiGorsky ~ % sudo /usr/bin/python TeamViewer-14-id-changer-for-mac.py
Password:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'TeamViewer-14-id-changer-for-mac.py': [Errno 2] No such file or directory
vitaliygorsky@MBPVitaiiGorsky ~ % cd desktop
vitaliygorsky@MBPVitaiiGorsky desktop % sudo /usr/bin/python TeamViewer-14-id-changer-for-mac.py

TeamViewer ID Changer for MAC OS

Configs found:

/Users/vitaliygorsky/library/preferences/com.teamviewer.TeamViewer.plist
/Users/vitaliygorsky/library/preferences/com.teamviewer.teamviewer.preferences.Machine.plist

This files will be DELETED permanently.
All TeamViewer settings will be lost

Press Enter to continue or CTR+C to abort...
Done.
File not found: /Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Desktop
Install TeamViewer correctly
vitaliygorsky@MBPVitaiiGorsky desktop %

yeah, I update the code, you can download the lastest version and try it again

@idarek

This comment has been minimized.

Copy link

idarek commented Dec 29, 2019

My issue was quite simple:

/Applications/TeamViewer.app/: replacing existing signature
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/Applications/TeamViewer.app/: the codesign_allocate helper tool cannot be found or used

I have installed CommandLineTools from terminal using
xcode-select --install

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Dec 31, 2019

My issue was quite simple:

/Applications/TeamViewer.app/: replacing existing signature
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/Applications/TeamViewer.app/: the codesign_allocate helper tool cannot be found or used

I have installed CommandLineTools from terminal using
xcode-select --install

You can try this answer https://stackoverflow.com/questions/29848622/codesign-allocate-error-unable-to-find-utility-codesign-allocate-not-a-deve

@idarek

This comment has been minimized.

Copy link

idarek commented Jan 2, 2020

My issue was quite simple:

/Applications/TeamViewer.app/: replacing existing signature
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/Applications/TeamViewer.app/: the codesign_allocate helper tool cannot be found or used

I have installed CommandLineTools from terminal using
xcode-select --install

You can try this answer https://stackoverflow.com/questions/29848622/codesign-allocate-error-unable-to-find-utility-codesign-allocate-not-a-deve

No need, I explain my issue and how I sorted it. All working fine. Just posted in case other will have simillar.

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Jan 2, 2020

My issue was quite simple:

/Applications/TeamViewer.app/: replacing existing signature
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/Applications/TeamViewer.app/: the codesign_allocate helper tool cannot be found or used

I have installed CommandLineTools from terminal using
xcode-select --install

You can try this answer https://stackoverflow.com/questions/29848622/codesign-allocate-error-unable-to-find-utility-codesign-allocate-not-a-deve

No need, I explain my issue and how I sorted it. All working fine. Just posted in case other will have simillar.

Thanks

@AlanSachin

This comment has been minimized.

Copy link

AlanSachin commented Jan 8, 2020

TV 版本15.1.3937
系统版本:macOS 10.15.3 (19D49f)
使用这个脚本并且系统关闭SIP后,重启后第一次打开TV,可以正常使用。
不过完全退出TV后,再次打开TV,会提示需要提示安装帮助程序,输入密码后闪退,只有重启一次,才可以正常打开。
如果再次完全退出TV的话,也就只能重启一次才能重新打开TV,不过还是非常感谢作者的脚本。
Xnip2020-01-09_01-03-15

@zhenhappy

This comment has been minimized.

Copy link
Owner Author

zhenhappy commented Jan 11, 2020

TV 版本15.1.3937
系统版本:macOS 10.15.3 (19D49f)
使用这个脚本并且系统关闭SIP后,重启后第一次打开TV,可以正常使用。
不过完全退出TV后,再次打开TV,会提示需要提示安装帮助程序,输入密码后闪退,只有重启一次,才可以正常打开。
如果再次完全退出TV的话,也就只能重启一次才能重新打开TV,不过还是非常感谢作者的脚本。
Xnip2020-01-09_01-03-15

你这个不太清楚是什么原因, 我版本跟你一样的, 并没有出现这个情况, 你看下是不是试着卸载清理干净重新装下试试

@hungdev

This comment has been minimized.

Copy link

hungdev commented Jan 16, 2020

@zhenhappy thank for your support new version 15. I love you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.