-
-
Save 0x2a94b5/89100d40e68639643cc0f1a5624cf64b to your computer and use it in GitHub Desktop.
Teamviewer 15 id changer for Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# System: macOS Mojave 10.14.6 | |
# Version: TeamViewer v15.2.2756 | |
# Python: 2.7.10 | |
# Command: sudo python TeamViewer-15-id-changer-for-mac.py | |
# | |
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', | |
'/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 --force --deep --sign - /Applications/TeamViewer.app/") | |
print(''' | |
ID changed sucessfully. | |
!!! Restart computer before using TeamViewer !!!! | |
''') |
Hi,
1. install python 2.7
2. code runner run in terminal: sudo python 2.7 <file.py>
3. Enter password
Được gửi từ iPhone của tôi
Vào ngày 5 thg 10, 2021, lúc 7:46 CH, marble-it ***@***.***> đã viết:
***@***.*** commented on this gist.
…________________________________
I downloaded the .py file but I have no clue how to run it. Sorry.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://gist.github.com/89100d40e68639643cc0f1a5624cf64b#gistcomment-3917044>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APN25YIBLWHORWUPTDC6QUDUFLXS7ANCNFSM5FLWRWZQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Hello,
thx for the quick reply.
I tried it installing 2.7 Python and then, after having deleted the 2.7, I tried even with the 3.10.
This is what I get on mac terminal (that is the terminal I should use, right?).
When I open again the TeamV, I get the window like it's the first installation but the ID is always the same.
Thank you again for your support
For anyone looking for a python 3 based script: https://gist.github.com/STiXzoOR/ab46bfebcf6644d6f2aebb97d09cd6f9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I downloaded the .py file but I have no clue how to run it. Sorry.