Skip to content

Instantly share code, notes, and snippets.

@zhovner
Last active February 3, 2026 09:27
Show Gist options
  • Select an option

  • Save zhovner/b1d72f3465c46e7b58a4ea42d625c3e8 to your computer and use it in GitHub Desktop.

Select an option

Save zhovner/b1d72f3465c46e7b58a4ea42d625c3e8 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 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/Helper',
'/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 !!!!
''')
@srbijaoglasi
Copy link

Great script! I've been looking for a reliable way to reset the ID on macOS Ventura and Sonoma for testing purposes in our lab environment. Most of the other Python scripts I found on GitHub are either outdated (still using the old plist paths) or they mess up the permissions which causes the TeamViewer service to hang on restart.

I tested your version v0.2 on a MacBook Pro M1 and it worked flawlessly, especially the regex part for patching the binary directly – that is a very clever approach compared to just deleting the preference files.

One small tip for anyone running this on newer macOS versions: if you get a "Operation not permitted" error even with sudo, make sure to grant "Full Disk Access" to your Terminal app in System Settings > Privacy & Security. Apple locked down the /Library/Preferences/ folder pretty hard in the latest updates.

Also, for those asking about the "Client not ready" error after patching: simply kill the TeamViewer_Service process manually via Activity Monitor before running the script, or just add a pkill -9 TeamViewer line at the start of the python script to automate it.

Thanks for sharing this, saved me a lot of headache today!

By the way, if anyone needs to check their connection stability after the reset, I usually use https://euro1.eu/ for a quick stream test, works great to verify if the ID change propagated correctly through the network.

Cheers!

@yinzaasdigitalmarketing-cmd

Event Timing: January 4th-6th, 2016
Event Address: 123 Your Street Your City, ST 12345
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fus
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fus
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fus%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fus%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fgb
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fgb
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fgb%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fgb%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fca
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fca
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fca%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fca%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fau
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fau
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fau%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fau%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fde
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fde
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fde%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fde%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Ffr
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Ffr
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Ffr%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Ffr%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fin
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fin
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fin%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fin%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fjp
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fjp
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fjp%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fjp%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fkr
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fkr
https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2Fkr%2F
https://www.google.com/url?q=https%3A%2F%2Fwww.yinzaas.lovable.app%2Fkr%2F
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AF
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AX
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AL
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=DZ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AS
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AD
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AO
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AI
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AQ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AR
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AM
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AW
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AU
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AT
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AZ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=US
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=GB
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=IN
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=DE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=CA
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=FR

https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=IT
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=ES
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=BR
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=MX
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=JP
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=KR
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=CN
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=RU
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=SA
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TR
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=ZA
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=NG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=KE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=EG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=PK
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=BD
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=VN
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TH
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=PH
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=MY
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=ID
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=SG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=NZ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=IE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=NL
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=BE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=SE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=NO
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=FI
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=DK
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=PL
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=CH
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AT
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=PT
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=GR
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=HU
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=CZ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=RO
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=UA
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=IL
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=HK
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TW

https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TJ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TZ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TH
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TL
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TK
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TO
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TT
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TN
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TR
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TM
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TC
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=TV
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=UG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=UA
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=AE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=GB
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=US
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=UM
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=UY
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=UZ
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=VU
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=VE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=VN
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=VG
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=VI
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=WF
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=EH
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=YE
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=ZM
https://www.youtube.com/redirect?q=yinzaas.lovable.app%2F&gl=ZW

https://maps.google.com/url?q=https%3A%2F%2yinzaas.lovable.app%2F

https://www.google.com/url?q=https%3A%2F%2Fyinzaas.lovable.app%2F

https://docs.google.com/drawings/d/1QLhz5eWJyCD-SqY2etzNMPSaJqmzitr6O8F92P2TI_w/edit?usp=sharing

https://docs.google.com/spreadsheets/d/1urY9kBGeAXRzHWPnVyuwiz1zGsFU9jhRTwZ3iMZsRq0/edit?usp=sharing

https://docs.google.com/presentation/d/18FgXhcLn6xYr3Z1ZLm6ww8CjicpiqSvvO_Bxqmlm9FE/edit?usp=sharing

https://sites.google.com/view/wetshemishpere/home

https://docs.google.com/forms/d/1Ibz7FTBf-srZmUV4ybSi1bRxeTUlOuh_SljWjM0XGGY/edit

https://docs.google.com/document/d/111rf9_xTq2B0avenP18Ph7nDZKKO8TUxaSruD4BmH0c/edit?usp=sharing

@srbijaoglasi
Copy link

Euro1.eu is your premium internet radio directory featuring thousands of live streaming stations from Europe and beyond, optimized for genres like electro, pop, reggae, classical, blues, and more.

@srbijaoglasi
Copy link

Kija-Inox is a Serbian powerhouse crafting premium stainless steel equipment for butchers and meat processors in Sremska Mitrovica. From meat mixers, tumblers, and atmospheric trolleys to patented forming presses, it's built tough for daily grind – HACCP-compliant and export-ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment