macOS使用TeamViewer ID避免连接失败
作者:matrix 发布时间:2019-02-27 分类:零零星星
TeamViewer使用频繁或者被检测到某些ip段中会被标记为商业行为的使用,也就会要求付费。对应的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”
方法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
Linux批量修改文件名前缀rename命令
作者:matrix 发布时间:2019-02-22 分类:零零星星
win上的打包的文件丢到linux解压发现中文的前缀乱码,本来mv
命令到是可以修改 顾于文件太多,发现用rename
方便的多
需要将╬в╨┼═╝╞м_20180626102853.jpg
修改还原为微信图片_20180626102853.jpg
执行操作
文件数量有点多执行
命令$:rename 's/╬в╨┼═╝╞м(.*)/微信图片$1/' *
rename --help
Usage:
rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E *perlexpr*]*|*perlexpr*
[ *files* ]
Options:
-v, -verbose
Verbose: print names of files successfully renamed.
-n, -nono
No action: print names of files to be renamed, but don't rename.
-f, -force
Over write: allow existing files to be over-written.
-h, -help
Help: print SYNOPSIS and OPTIONS.
-m, -man
Manual: print manual page.
-V, -version
Version: show version number.
-e Expression: code to act on files name.
May be repeated to build up code (like "perl -e"). If no -e, the
first argument is used as code.
-E Statement: code to act on files name, as -e but terminated by
';'.
perlexpr表达式
perlexpr还可用于其他命令,如sed
perlexpr表达式形如:
- Substitution替换
s / expr1 / expr2 / [gi]
/
为分界符,可以使用其他任意字符为分界符
expr1,expr2
都支持正则
expr1
会被查找替换为expr2
。
ig
两个字母分别为正则的匹配模式:忽略大小写和全局匹配,否则默认换行为分界符。方括号[]包裹表示他们可不填。 -
Translation字符转译
类似于替换s
,它可用于将一个字符串转换为另一个字符串,即字符转换。表达式如:y/charset1/charset2/
如:
转换为小写:rename 'y/A-Z/a-z/' *
添加txt后缀:rename 's/$/\.txt/' *
PEACE~
参考:
https://www.computerhope.com/unix/rename.htm
https://wangchujiang.com/linux-command/c/rename.html
https://blog.csdn.net/qq_37858386/article/details/78404001
http://bbs.chinaunix.net/thread-4119882-1-1.html
macOS开启HIDPI解决自定分辨率显示模糊问题
作者:matrix 发布时间:2019-02-13 分类:零零星星
macOs外接一台2K显示器用1920*2080分辨率满屏显示的情况下会发现字体微模糊的情况。原因在于没有开启HIDPI,使用RDM软件切换分辨率就会发现没有闪电⚡️图标。
测试: 笔记本MACOS Mojave 10.14.3 (18D109) 外接 MAYA U2717H 27英寸2K显示器
禁用系统文件保护SIP
重启电脑并按住Command+R
进入恢复模式 顶部的菜单中找到终端
工具,输入 csrutil disable; reboot
。禁用system系统文件保护。
下面按照comsysto.github.io工具的五个步骤操作
1.1执行命令[Big Sur及以上版本]
$ sudo cp -R /System/Library/Displays /Library/
1.1.1 直接跳转到第4步
将保存路径修改为/Library/Displays/Contents/Resources/Overrides/
例如:
$ sudo cp ~/Downloads/DisplayProductID-ccd.plist /Library/Displays/Contents/Resources/Overrides/DisplayVendorID-5e3/DisplayProductID-ccd
1.2执行命令[Catalina及以下版本]
$ sudo mount -uw / #Catalina 10.15+以上的系统需要把系统分区重新挂载为可写。重启后失效
$ sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionEnabled -bool true
2.获取显示器参数ID值
终端执行ioreg -lw0 | grep IODisplayPrefsKey
笔记本电脑外接MAYA U2717H显示器的信息是第二个IODisplayPrefsKey
:
IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2/AppleIntelFramebuffer@2/display0/AppleDisplay-3721-2717
其中DisplayVendorId
为3721,DisplayProductID
为2717,都是16进制值。
使用ioreg -l | grep "DisplayVendorID"
命令获取的为10进制数值。
这两个显示器的相关参数需要在comsysto.github.io工具
配置中使用。
3.配置显示参数
注意修改对应的DisplayProductID
和DisplayVendorID
值。
DisplayProductName
显示器名称可以填写上去。下面Scale Resolutions
中需要确保有自己使用的分辨率的且开启hidpi
。我这里是想用1920*2080分辨率
也就可以将就他的配置,只是需要修改显示器id参数。
之后点击框框下方的DisplayProductID-XXXX
按钮下载plist文件DisplayProductID-2717.plist
4.放置显示器配置文件到system系统
#3721为显示器的DisplayVendorId
#2717为显示器的DisplayProductID
cd /System/Library/Displays/Contents/Resources/Overrides
mkdir DisplayVendorID-3721 #创建显示器名称的目录
sudo cp ~/Downloads/DisplayProductID-2717.plist /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorID-3721/DisplayProductID-2717
5.重启系统
重启后使用RDM选择对应的分辨率,会看到1920*2080分辨率有闪电⚡️图标
切换之后就可以马上看到效果了
RDM下载:http://avi.alkalay.net/software/RDM/
显示器配置文件plist:
MAYA U2717H:DisplayProductID-2717.plist
显示器欺骗器5e3-ccd:DisplayProductID-ccd.plist
参考:
https://developer.apple.com/forums/thread/649832?answerId=646352022#646352022
https://bbs.feng.com/read-htm-tid-12512988.html
https://zhuanlan.zhihu.com/p/20684620
https://comsysto.github.io/Display-Override-PropertyList-File-Parser-and-Generator-with-HIDPI-Support-For-Scaled-Resolutions/
https://www.jianshu.com/p/4ea389848679