-
-
Save zhenhappy/3c808a198715978a38acf0ba44044ea6 to your computer and use it in GitHub Desktop.
#!/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/Helpers/Restarter', | |
'/Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Assignment' | |
] | |
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 --force --deep --sign - /Applications/TeamViewer.app/") | |
print(''' | |
ID changed sucessfully. | |
!!! Restart computer before using TeamViewer !!!! | |
''') |
For the latest version, please skip the security password screen, allow all accessibility
This version works for TV 14:
https://gist.github.com/zhovner/b1d72f3465c46e7b58a4ea42d625c3e8
Support TV 15
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 %
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.pyTeamViewer ID Changer for MAC OS
Configs found:
/Users/vitaliygorsky/library/preferences/com.teamviewer.TeamViewer.plist
/Users/vitaliygorsky/library/preferences/com.teamviewer.teamviewer.preferences.Machine.plistThis files will be DELETED permanently.
All TeamViewer settings will be lostPress 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
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
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
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.
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
@zhenhappy thank for your support new version 15. I love you <3
同样出现退出后提示安装新帮助,然后闪退,重启后能正常使用
works for me,thx
只能用在2.7版本吗? 我的mac装了3.7 是不是就不能用了? 一直报
can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
这个应该怎么处理呢,谢谢。
只能用在2.7版本吗? 我的mac装了3.7 是不是就不能用了? 一直报
can not patch file /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
这个应该怎么处理呢,谢谢。
原则上Mac默认自带都有自带python27, 为了兼容大多数人嘛, 你运行的时候用/usr/bin/python方式运行就可以, python3也不是不行, 有几句话版本上有差异, 有能力的话自己改下也可以
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.pyTeamViewer 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
same problem
$ sudo python ./TeamViewer-id-changer2.py
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file './TeamViewer-id-changer2.py': [Errno 2] No such file or directory
$ ls
TeamViewer-id-changer_2.py readme.md
I try also with absolute path but nothing. is it my python configuration the problem?
sen this erro:
Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'TeamViewer.py': [Errno 2] No such file or directory
sen this erro:
Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'TeamViewer.py': [Errno 2] No such file or directory
See this
For anyone looking for a python 3 based script: STiXzoOR/ab46bfebcf6644d6f2aebb97d09cd6f9
For anyone looking for a python 3 based script: STiXzoOR/ab46bfebcf6644d6f2aebb97d09cd6f9
Super!
我运行程序正常,但是重新开机ID没有变化。
Please use python 2.7. Can you check your python version?
sudo /usr/bin/python TeamViewer-14-id-changer-for-mac.py