Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
import random
import re
import string
import sys
print('''
--------------------------------
TeamViewer 14 ID Changer for MAC OS
Version: 0.2 2019
--------------------------------
''')
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/TeamViewer_Desktop',
'/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 -f -s - /Applications/TeamViewer.app/")
print('''
ID changed sucessfully.
!!! Restart computer before using TeamViewer !!!!
''')
@Firues

This comment has been minimized.

Copy link

commented Jul 29, 2017

Thank you!

@ryutao

This comment has been minimized.

Copy link

commented Mar 31, 2018

Thank you very much!

@SoniyaSmug

This comment has been minimized.

Copy link

commented Apr 7, 2018

This is not working for me. Showing the following error.
Traceback (most recent call last):
File "./TeamViewer-id-changer.py", line 26, in
if os.environ.has_key('SUDO_USER'):
AttributeError: '_Environ' object has no attribute 'has_key.

Please anybody help

@flash66

This comment has been minimized.

Copy link

commented Apr 9, 2018

Absolutely brilliant! Where can I donate?

@konredi

This comment has been minimized.

Copy link

commented Apr 22, 2018

Thank you Thank you Thank you Thank you !

@flip68

This comment has been minimized.

Copy link

commented May 8, 2018

This doesn't appear to work for Teamviewer 13 releases?

@pingod

This comment has been minimized.

Copy link

commented May 15, 2018

@flip68 try it,you will get what you want

@pingod

This comment has been minimized.

Copy link

commented May 15, 2018

Thank you Thank you Thank you Thank you !

@yuuzhang

This comment has been minimized.

Copy link

commented Jun 5, 2018

Perfectly work on release 13.14170, Thank your brilliant job!

@alluminator

This comment has been minimized.

Copy link

commented Jun 9, 2018

how does it run? I do not understand. I installed pyton, but the script is executed and nothing happens. Can someone record a video?

@wzrzt

This comment has been minimized.

Copy link

commented Jun 13, 2018

@SoniyaSmug, try run it with /usr/bin/python *.py
You should use python2

@LonelyWolfJH

This comment has been minimized.

Copy link

commented Jun 22, 2018

@SoniyaSmug, @alluminator
There is a revised version as Python 3 in here
just do "sudo ./filename.py" in the Terminal.
Thank you for Pavel Zhovner

@julik272237

This comment has been minimized.

Copy link

commented Jul 8, 2018

I do not understand, how to do it!
Can someone record a video, please?

@julik272237

This comment has been minimized.

Copy link

commented Jul 8, 2018

Could somebody help with this ? Can't run the script

This script must be run form root.
Exit status: 0
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Процесс завершен]

@kenjdcee

This comment has been minimized.

Copy link

commented Jul 19, 2018

hi guys,

got an error running this script.

Traceback (most recent call last):
File "./TeamViewer-id-changer.py", line 45, in
for file in listdir_fullpath(HOMEDIRLIB):
File "./TeamViewer-id-changer.py", line 43, in listdir_fullpath
return [os.path.join(d, f) for f in os.listdir(d)]
OSError: [Errno 2] No such file or directory: '/Users/username of my pc/library/Preferences/

Thank youm

@zibot

This comment has been minimized.

Copy link

commented Aug 9, 2018

Да

@WorldWideWebDev

This comment has been minimized.

Copy link

commented Aug 9, 2018

How can i sue this to re-instate an old "ID" such as the original "ID" i registered with? Can anyone help? Its an important question.
Regards Anthony.

@slashtiger

This comment has been minimized.

Copy link

commented Aug 11, 2018

@WorldWodeWeb sorry, you can’t… This script generates a random ID and resets various identifiers with which TeamViewer presents itself to the server, such as the Platform Serial Number. I myself actually would’ve liked the script to have been able to let you specify an ID, bit that wouldn’t have worked anyway. This is because doing so would automatically block that ID on TeamViewer’s server-end. I would have loved to have been able to use my own older ID, purely because I know it off by heart.The reason I myself am looking into changing my ID is because I have been wrongly accused of using the product commercially, twice in a row. At first, they cleared me; then they decided just now to do it again. I’m under the impression that my current ID is also being used elsewhere, because there is no factor nearby me that could’ve triggered a flag in their system. So I’m currently first trying to play nice by sending in a form where you can state your case into using the software non-commercially as intended (you can find that here:
(click))

If they decide my case is not valid, for some reason, then I might try it through this route. It can take anywhere from a week to two months to have the ‘Commercial Use’ flag taken off your ID if you go the intended route, but it actually is the only foolproof route there is. Changing your ID but then continuing not to use TeamViewer according to its non-commercial use guidelines, will have you flagged again in no time.

@jat-x

This comment has been minimized.

Copy link

commented Aug 15, 2018

It`s work with TeamViewer 13.
Thank You!

@lyon007

This comment has been minimized.

Copy link

commented Aug 24, 2018

You are great !!!!!!!

@nguyenbathanh

This comment has been minimized.

Copy link

commented Aug 25, 2018

Oh my god! It works perfectly.

@carythesaddler

This comment has been minimized.

Copy link

commented Aug 25, 2018

i am NOT a coder. however i'm trying to run this script in terminal. i keep getting command not found. i set it to sudo the root etc and just cannot execute this script. any help for a non techie?

@juato4

This comment has been minimized.

Copy link

commented Sep 4, 2018

WONDERFULLLLLLL

@chatiking

This comment has been minimized.

Copy link

commented Sep 8, 2018

I am getting this error, could somebody help me for finding out what I am doing wrong?

if platform.system() != 'Darwin':
-bash: syntax error near unexpected token !=' ~ print('This script can be run only on MAC OS.') -bash: syntax error near unexpected token 'This script can be run only on MAC OS.''
~ sys.exit();
-bash: syntax error near unexpected token `;'
~
~ if os.geteuid() != 0

@chatiking

This comment has been minimized.

Copy link

commented Sep 8, 2018

it is working now!
just using :
sudo python ./TeamViewer-id-changer.py

@xtechgamer735

This comment has been minimized.

Copy link

commented Sep 15, 2018

@WorldWodeWeb sorry, you can’t… This script generates a random ID and resets various identifiers with which TeamViewer presents itself to the server, such as the Platform Serial Number. I myself actually would’ve liked the script to have been able to let you specify an ID, bit that wouldn’t have worked anyway. This is because doing so would automatically block that ID on TeamViewer’s server-end. I would have loved to have been able to use my own older ID, purely because I know it off by heart.The reason I myself am looking into changing my ID is because I have been wrongly accused of using the product commercially, twice in a row. At first, they cleared me; then they decided just now to do it again. I’m under the impression that my current ID is also being used elsewhere, because there is no factor nearby me that could’ve triggered a flag in their system. So I’m currently first trying to play nice by sending in a form where you can state your case into using the software non-commercially as intended (you can find that here:
(click))

If they decide my case is not valid, for some reason, then I might try it through this route. It can take anywhere from a week to two months to have the ‘Commercial Use’ flag taken off your ID if you go the intended route, but it actually is the only foolproof route there is. Changing your ID but then continuing not to use TeamViewer according to its non-commercial use guidelines, will have you flagged again in no time.

Did you ever get the flag removed? In the same boat with the commercial pop up. Thanks!

@Kangqj

This comment has been minimized.

Copy link

commented Oct 8, 2018

good!
it is work, thank you very much!

@liujie-gd

This comment has been minimized.

Copy link

commented Oct 12, 2018

Cool!
Thanks very much!

@JimLee1996

This comment has been minimized.

Copy link

commented Oct 16, 2018

It's very awesome! Is there any python3 version?

@trahtenberg68

This comment has been minimized.

Copy link

commented Oct 16, 2018

Hi. I've try it on TV10 on mac 10.7.4 and it didn't work, because serial pattern little bit different, to work correctly you need replace
SerialPattern = "IOPlatformSerialNumber%s%s%sUUID"
to SerialPattern = "IOPlatformSerialNumber%s%s%s"
Thank you!

@charlyborwn

This comment has been minimized.

Copy link

commented Oct 18, 2018

Thank you so much!

@jazzygff

This comment has been minimized.

Copy link

commented Oct 30, 2018

Anyone having issues with latest teamviewer beta? I had updated on other pcs but when trying to connect to one of those pcs I get prompted to update. Once update the app just crashes over and over. Tried full uninstall etc removing via terminal using rm commands. no luck. Wondering if the use of this script has caused it?

@tranthaihoang

This comment has been minimized.

Copy link

commented Oct 31, 2018

Good! thank you

@jahrider

This comment has been minimized.

Copy link

commented Dec 18, 2018

Guys, can anyone give me advice?
Script is not working for me, could you help me how to solve the problem?

MacOs Mojave, Teamviewer 12.


TeamViewer ID Changer for MAC OS

Traceback (most recent call last):
File "./TeamViewer-id-changer.py", line 45, in
for file in listdir_fullpath(HOMEDIRLIB):
File "./TeamViewer-id-changer.py", line 43, in listdir_fullpath
return [os.path.join(d, f) for f in os.listdir(d)]
OSError: [Errno 2] No such file or directory: '/Users/jahrider2/library/preferences/'

@leomyth330

This comment has been minimized.

Copy link

commented Jan 3, 2019

Not working with 14.1.3399

@HaoJi666

This comment has been minimized.

Copy link

commented Jan 11, 2019

Not working with 14.1.3399

Same as your version, but I can. D:

@AlemAblat

This comment has been minimized.

Copy link

commented Jan 12, 2019

Not working with 14.1.3399

@AlemAblat

This comment has been minimized.

Copy link

commented Jan 12, 2019

Error Code : 0X00000004
Trap Number: 14

@cspatel2008

This comment has been minimized.

Copy link

commented Jan 12, 2019

Same thing again! Not working with 14.1.3399. Experts please suggest an alternative.

@AlemAblat

This comment has been minimized.

Copy link

commented Jan 13, 2019

Experts please suggest an alternative

You can reinstall 13 or 12 is working fine!

@cspatel2008

This comment has been minimized.

Copy link

commented Jan 15, 2019

True, However it will not connect to any TV Client running over V.No. 13.

@lanlinlan

This comment has been minimized.

Copy link

commented Jan 15, 2019

14.1 is not working!! anyone can share the 14.0 dmg files?

@AlemAblat

This comment has been minimized.

Copy link

commented Jan 17, 2019

14.1 is not working!! anyone can share the 14.0 dmg files?

https://www.malavida.com/en/soft/teamviewer/mac/

Thanks!

@zhenhappy

This comment has been minimized.

Copy link

commented Jan 18, 2019

Not working with 14.1.3399

Change "IOPlatformSerialNumber%s%s%sUUID" to "IOPlatformSerialNumber%s%s%s" can be supported 14.1.3399

@pingod

This comment has been minimized.

Copy link

commented Jan 23, 2019

Change "IOPlatformSerialNumber%s%s%sUUID" to "IOPlatformSerialNumber%s%s%s" can be supported 14.1.3399

Thanks!

@cspatel2008

This comment has been minimized.

Copy link

commented Jan 26, 2019

Not working with 14.1.3399

Change "IOPlatformSerialNumber%s%s%sUUID" to "IOPlatformSerialNumber%s%s%s" can be supported 14.1.3399

Thanks!!

@diablothebest

This comment has been minimized.

Copy link

commented Jan 27, 2019

Change "IOPlatformSerialNumber%s%s%sUUID" to "IOPlatformSerialNumber%s%s%s" can be supported 14.1.3399

After use it in script, TV14 don't work anymore!

@AlemAblat

This comment has been minimized.

Copy link

commented Jan 29, 2019

Change "IOPlatformSerialNumber%s%s%sUUID" to "IOPlatformSerialNumber%s%s%s" can be supported 14.1.3399

After use it in script, TV14 don't work anymore!

Can't support 14.1.XXXX

@inhouseaustralia

This comment has been minimized.

Copy link

commented Feb 12, 2019

same issue as above

@zhenhappy

This comment has been minimized.

Copy link

commented Feb 12, 2019

same issue as above

Can you paste your code and three files with '/Applications/TeamViewer.app/Contents/MacOS/TeamViewer',
'/Applications/TeamViewer.app/Contents/MacOS/TeamViewer_Service',
'/Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Desktop'

@remixjc

This comment has been minimized.

Copy link

commented Feb 16, 2019

Hello everyone,I come from China,so i can only speak chinese,
所以,我要告诉大家,请打开Terminal.app ,然后输入 sudo -i ,输入你的密码
进入到root用户下,输入python 空格 ,把保存好的python文件拉进来会自动生成路径,回车即可。

@zhenhappy

This comment has been minimized.

Copy link

commented Feb 19, 2019

Hello everyone,I come from China,so i can only speak chinese,
所以,我要告诉大家,请打开Terminal.app ,然后输入 sudo -i ,输入你的密码
进入到root用户下,输入python 空格 ,把保存好的python文件拉进来会自动生成路径,回车即可。

最新的版本你那边能成功吗

@WesleyPolicena

This comment has been minimized.

Copy link

commented Feb 19, 2019

Some solution for the TV 14.1.9025?

@sleepent

This comment has been minimized.

Copy link

commented Feb 22, 2019

TV 14.1.9025 Already available

@sleepent

This comment has been minimized.

Copy link

commented Feb 22, 2019

把保存好的python文件拉进来会自

按你的方法做的,可是使用,谢谢

@ramiz918

This comment has been minimized.

Copy link

commented Feb 22, 2019

Please update for Teamviewer 14 the given script is not working thnaks

@buratinosa

This comment has been minimized.

Copy link

commented Feb 22, 2019

Teamviewer 14 protected the binaries from being changed
All scripts not working

@kainjinez

This comment has been minimized.

Copy link

commented Feb 25, 2019

Does not work on v14.1.9025. Experts please give solution. Thanks.

@Hootrix

This comment has been minimized.

Copy link

commented Feb 26, 2019

感谢 可用。。
Thanks!!
Please use version 12.0.72647 for Mac to run successfully.

不能用的需要使用旧版本应用。
下载: https://teamviewer.en.uptodown.com/mac/download/1510547

@ramiz918

This comment has been minimized.

Copy link

commented Feb 28, 2019

in version 12 that automatically time out after every 5 minutes even we change the ID via script

@whoisoscar

This comment has been minimized.

Copy link

commented Mar 2, 2019

I am able to patch version 12 and 13 but once the app is quit and re-opened, it fails to open and asks for password to install helper which never does anything...

@lepangdan

This comment has been minimized.

Copy link

commented Mar 9, 2019

After running the script and restarting my computer, the TeamViewer cannot be opened. Any help will be appreciated.
image

@Lodour

This comment has been minimized.

Copy link

commented Mar 15, 2019

This ad-hoc codesign works for version 14.
sudo codesign -f -s - /Applications/TeamViewer.app/Contents/MacOS/TeamViewer

@diablothebest

This comment has been minimized.

Copy link

commented Mar 15, 2019

All works with 14 version! Just disable SIP in your OS (test ok on TV 14.1.18533)

@Deyashkin

This comment has been minimized.

Copy link

commented Mar 19, 2019

Thank you so much!!!
You are very helpful!!

@madmorf

This comment has been minimized.

Copy link

commented Mar 22, 2019

SIP disabled, working fine.

@ramiz918

This comment has been minimized.

Copy link

commented Mar 23, 2019

Disabled SIp , tested working fine, thank you soo much mates to let us know!!

@zhenhappy

This comment has been minimized.

Copy link

commented Mar 28, 2019

The latest version script for teamviewer 14 is here:
https://gist.github.com/zhenhappy/3c808a198715978a38acf0ba44044ea6

@CoinShine

This comment has been minimized.

Copy link

commented Mar 28, 2019

I use version 13,but it always pop window and can't close.

@thomasgogo

This comment has been minimized.

Copy link

commented Apr 7, 2019

thank you !

@WuQic

This comment has been minimized.

Copy link

commented Apr 28, 2019

重置了但是现在不能开机启动了 而且关闭就全部退出了? 没有历史访问记录了

@mike14-2

This comment has been minimized.

Copy link

commented Jun 26, 2019

i have the problem to run the script.
In the Terminal i tried sudo ./TeamViewer-id-changer.py;
And i get this result: ... is not in the sudoers file. This incident will be reported.

I also tried python TeamViewer-id-changer.py

after writing my pasword, i got this result:

--------------------------------
TeamViewer ID Changer for MAC OS
--------------------------------
This script must be run form root.

Can someone help me?

@zhovner

This comment has been minimized.

Copy link
Owner Author

commented Jun 26, 2019

@mike14-2 you don't have configured root account. Also as i remember, this script is no longer works on newer versions of TeamViewer.

@mike14-2

This comment has been minimized.

Copy link

commented Jun 26, 2019

@mike14-2 you don't have configured root account. Also as i remember, this script is no longer works on newer versions of TeamViewer.

@zhovner: thanks, how do i configure root account?

@pwnyxz

This comment has been minimized.

Copy link

commented Jul 8, 2019

升级10.15 catalina beta,TV14.1.3399,使用脚本后,TV打开时就崩溃了,有人遇到相同情况吗?谢谢

@alexfoods1

This comment has been minimized.

Copy link

commented Jul 9, 2019

@Lodour: Thank You! helped!

@Pekary

This comment has been minimized.

Copy link

commented Jul 18, 2019

could you write a script for restore the original ID? i have encountered a situation which need revert the ID, but it seems impossible now. so maybe we can backup the file about restoring original ID, and then write a scrip to restore it.

@Pekary

This comment has been minimized.

Copy link

commented Jul 19, 2019

i found reinstall teamviewer solved my asked question, hope it will help others.

@pwnyxz

This comment has been minimized.

Copy link

commented Jul 20, 2019

The latest version script for teamviewer 14 is here:
https://gist.github.com/zhenhappy/3c808a198715978a38acf0ba44044ea6

多谢,问题已解决。虽然仍然有提示,但是已经不会很快自动断开了

@zhovner

This comment has been minimized.

Copy link
Owner Author

commented Jul 26, 2019

多谢,问题已解决。虽然仍然有提示,但是已经不会很快自动断开了

@pwnyxz как насчет того, чтобы использовать english, братан?

@fisklask

This comment has been minimized.

Copy link

commented Aug 20, 2019

👍
Worked like a charm!
UPD: added details:
macOS 10.14.6 (18G87), TV v14.2.2558
SIP is enabled, GateKeeper is obviously disabled

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.