macOS使用TeamViewer ID避免连接失败

作者:matrix 发布时间:2019 年 2 月 27 日 分类:零零星星

TeamViewer使用频繁或者被检测到某些ip段中会被标记为商业行为的使用,也就会要求付费。对应的TeamViewer ID也就会被要求进行商业授权许可。
图片4393-macOS切换TeamViewer ID避免连接失败的商业许可
本来之前使用都是正常,今天给朋友远程执行脚本命令,我连接控制了半分钟就提示断开连接「超时后连接被阻断」,然后等待时间过后就提示了监测到「商业行为」。网上说TeamViewer修改了商业行为的判定导致客户大量流失,TeamViewer目前报价对于单用户单连接/年需要¥2500,有点贵啊。期间尝试过mac端的向日葵远程控制端和系统自带的屏幕共享,前者只能查看不能操作,后者完全连接不上亦或使用内网VNC地址成功,使用apple id就连接失败,mac端qq就根本没这个功能。

方法0

使用其他工具:
https://anydesk.com/zhs
https://sunlogin.oray.com/zh_CN/download
http://www.xt800.cn/download

参考:https://www.appinn.com/alternative-teamviewer/

有人建议使用俄罗斯版本:https://www.teamviewer.com/ru/

方法1

申述TeamViewerID为个人用户使用,最快7天内解决申请。
https://www.teamviewer.com/en/support/commercial-use-suspected/

2019年3月11日 22:36收到邮件“Your TeamViewer ID has been reset to free”

图片4452-macOS使用TeamViewer ID避免连接失败

方法2

TeamViewer会把ID进行标记,所以换一个新的ID就可以使用了。
使用虚拟机VirtualBox来使用TeamViewer,如果被检测有商业行为就给虚拟机重新初始化MAC地址。这样就可以切换新ID

方法3

使用脚本修改,切换TeamViewer新ID

感谢@zhovner的一键切换脚本TeamViewer ID Changer for MAC OS解决帮了大忙:

测试版本:TeamViewer for macOs V14.0.13880版本
python 2.7.10测试运行

#!/usr/bin/env python 

#coding:utf-8
import sys
import os
import glob
import platform
import re
import random
import string

print('''
--------------------------------
TeamViewer ID Changer for MAC OS
--------------------------------
''')

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 os.environ.has_key('SUDO_USER'):
    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'.lower() 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.
''')
# Delete config files
else:
    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',
]

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%sUUID"

    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.digits):
    return ''.join(random.choice(chars) for _ in range(size))

RANDOMSERIAL = random_generator()
RANDOMPLATFORM = "IOPlatformExpert" + random_generator(6)


for file in TMBINARYES:
        try:
            idpatch(file,RANDOMPLATFORM,RANDOMSERIAL)
        except:
            print "Error: can not patch file " + file
            print "Wrong version?"
            sys.exit();

print "PlatformDevice: " + RANDOMPLATFORM
print "PlatformSerial: " + RANDOMSERIAL

print('''
ID changed sucessfully.
!!! Logout User Or Restart computer before using TeamViewer !!!!
''')

脚本执行成功会显示ID changed sucessfully.之后重启电脑或者注销用户启用就好了。之后打开teamViewer会发现是新的ID。

主要兼容11,12,和14.0版本

14.0.13880 mac版本:https://www.malavida.com/en/soft/teamviewer/mac/
14.0.13488 windows:https://www.filepuma.com/download/teamviewer_14.0.13488-20699/
12.0.72647 mac版本:https://teamviewer.en.uptodown.com/mac/download/1510547

P.S. 4月份发现脚本无法切换ID,软件会提示商业使用,但是使用上依然没问题

PEACE~

参考:
https://gist.github.com/zhovner/b1d72f3465c46e7b58a4ea42d625c3e8
https://community.spiceworks.com/topic/1151930-teamviewer-5-minute-timelimit

Alfred工作流workflows实例 - 查询内网ip

作者:matrix 发布时间:2018 年 9 月 7 日 分类:零零星星

Alfredmac上强大的快速启动工具 可以自定义php/shell/ruby/python脚本执行任意操作。比如快速搜索关键字打开网页 查询字符转码 ip。。。这些都是可以自己定义操作的,只是需要一些脚本语言编写的知识。

windows 上有类型的Wox https://github.com/Wox-launcher/Wox

下载Alfred

官网: https://www.Alfredapp.com/

工作流workflows自定义脚本的功能在Alfred中是收费的功能,还好 有可用的版本

nmac.to cracked:https://userscloud.com/o3ibe2w7071h/nmac.to_alf37931b.zip

添加/配置workflows

点击Workflows切换到工作流选项

窗口左下角 「 help + -」,点击 +->Blank Workflow 开始新建工作流程

填写名称name,描述Description,Bundle id为自己标记的包名id 要确保唯一性。

图片4087-Alfred工作流workflows实例

右边黑色背景窗口中右键 inputs->Script Filter 添加自定义执行的脚本

图片4086-Alfred工作流workflows实例

配置执行脚本以及触发的关键字

keyword为触发的关键字 比如alfred启动框框中输入baidu空格query,baidu就是触发脚本的自定义关键字,空格后面的query即为查询的参数下面的Language`即为脚本语言 这里用的系统自带的权限脚本。

图片4090-Alfred工作流workflows实例

#!/bin/bash
ip=$(ifconfig en0 | grep 'inet .*'  | sed 's/^.*inet//g' | sed 's/ netmask.*//g')
cat << EOF
{"items": [
    {
        "title": "${ip}",
        "subtitle": "局域网en0 ip",
        "arg": "${ip}"
    }
]}
EOF

说明:
使用系统bash 查询ifconfig命令en0网卡的IP信息 管道命令符|继续处理sed截取输出结果。
最后使用cat输出json数据用于Alfred读取并显示到结果列表
items具体参数释义参考下方alfredapp.com链接。
这里arg是用于复制粘贴/通知等操作的Alfred变量赋值,否则会没反应。如果只是显示查看 可以只设置titlesubtitle 效果就已经比较好了。

点击save保存

调试

窗口右边有蜘蛛「🕷️」图标 下方的Log下拉框 选择 all information便于查看调试信息

图片4102-Alfred工作流workflows实例 - 查询本地ip

启动

option+space启动 输入触发关键字
图片4097-Alfred工作流workflows实例 - 查询本地ip

下载

上面只是操作记录 这里可以直接下载:local ip.alfredworkflow
解压缩 直接打开alfredworkflow文件import导入

参考:
https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
https://www.jianshu.com/p/7e1ea4f296c8
https://sspai.com/post/44624
https://www.jianshu.com/p/e9f3352c785f