使用apple script管理进程

代码如下:

tell application "System Events"
	set listOfProcesses to (name of every process where background only is false)
	tell me to set selectedProcesses to choose from list listOfProcesses with multiple selections allowed
end tell
--The variable `selectedProcesses` will contain the list of selected items.
repeat with processName in selectedProcesses
	do shell script "Killall " & quoted form of processName
end repeat

和系统的活动监视器相比,好处在于只有前台进程。

xcode 9.2 集成obfuscator-llvm

Obfuscator-LLVM is a project initiated in June 2010 by the information security group of the University of Applied Sciences and Arts Western Switzerland of Yverdon-les-Bains (HEIG-VD).

The aim of this project is to provide an open-source fork of the LLVM compilation suite able to provide increased software security through code obfuscation and tamper-proofing. As we currently mostly work at the Intermediate Representation (IR) level, our tool is compatible with all programming languages (C, C++, Objective-C, Ada and Fortran) and target platforms (x86, x86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, Alpha, CellSPU, MIPS, MSP430, SystemZ, and XCore) currently supported by LLVM.

对于这个插件,网上的安装文章相对来说还是挺多的,例如官方的文档https://github.com/obfuscator-llvm/obfuscator/wiki/Installation,再例如 http://www.exchen.net/ios-hacker-obfuscator-llvm-xcode%E9%9B%86%E6%88%90%E9%85%8D%E7%BD%AE.html。已经写的都非常详细了,按照上面的文章基本都可以配置好了,唯一需要注意的是如果xcode的版本不同,对应的里面的字符串可能不一致,例如:

<string>Apple LLVM 8.0</string> -> <string>Obfuscator 4.0</string>

如果用的是xcode9 那么应该是Apple LLVM 9.0。同时如果在编译之前没有安装cmake,可以通过homebrew来安装还是非常方便的。

brew install cmake

Homebrew installs the stuff you need that Apple didn’t.

如何安装homebrew请参考这个链接:https://brew.sh/

如果不想跳转上面的链接,直接在终端中执行下面的安装代码即可:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

这里想说的是安装完成之后,还可能会出现别的问题,例如提示编译的时候提示下面的信息:

clang-4.0: error: cannot specify -o when generating multiple output files
Continue Reading

osx cycript image not found

今天在osx上运行cycript的时候出现了如下的错误:

/Users/obaby/Desktop/小项目/keygen/cycript_0.9.594/cycript
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
Referenced from: /Users/obaby/Desktop/小项目/keygen/cycript_0.9.594/Cycript.lib/cycript-apl
Reason: image not found
Abort trap: 6

看起来貌似是因为libruby.2.0.0.dylib文件没有找到,打开ruby目录发现果然没有2.0的文件,只有2.3的。处理方法也很简单,直接把2.3的复制一份,改为2.0即可

百度语音识别 语音唤醒失败

半夜起来给小朋友冲奶粉,于是忽然想到了那个在机柜里落灰的树莓派。当时用百度的语音识别和合成用python实现了一些功能。但是并没有实现语音唤醒,于是要想实现语音唤醒就只能不断的轮询接口,然后发送到百度云进行识别。但是觉得这种方式太坑了,什么都上传了,感觉随时在被监听一样。今天又看了下百度的sdk发现支持语音唤醒了。还能自定义唤醒词。

唤醒词规则

1 . 支持设置10个唤醒词,包含指令唤醒词和自定义唤醒词,指令唤醒词不支持自定义;10个唤醒词中,最多可以设置3个自定义唤醒词,最多可以包含3个两字指令唤醒词(如播放、暂停、拍照等)

2 . 已经支持的指令唤醒词有:
相机类:拍照、茄子
音乐类:增大音量、减小音量、播放、停止、暂停、上一首、下一首、
电灯类:打开电灯、关闭电灯、增大亮度、减小亮度
手电筒类:打开手电筒、关闭手电筒

3 . 自定义唤醒词可根据应用的个性化需求来免费定制,例如您的应用希望通过“你好百度”启动应用,则就可以设置“你好百度”为唤醒词;

4 . 建议每个自定义唤醒词在3至5个字之间(这里的1个字是指1个汉字、或1个英文字母),4个字最佳;一个唤醒词可以包含最多2个(含)英文字母;唤醒词中暂时不支持纯英文单词,如california;

5 . 唤醒词定制的温馨提示:请勿选择太常用的词作为唤醒词,例如”吃饭吧”,在生活中经常会用到,容易误唤醒;为保证唤醒效果,不同意义的唤醒词,请考虑唤醒词之间的差异,尽量保证唤醒词之间不易混淆;唤醒词过短会导致唤醒错误率较高,请不要选择太多短唤醒词(包括指令唤醒词);

6 . 唤醒词的音节覆盖尽量多,长度最少为4个音节;相邻音节请尽可能规避,字要发音清晰响度大;生僻字请尽量规避;零声母字请尽量规避;请避免使用叠词;例如:质量较高的唤醒词:“百度外卖”,音节覆盖多差异大;质量较差的唤醒词:“语音识别”,“语音”两个字均为零声母字,不是一个质量高的唤醒词;

Continue Reading

从com.alibaba.wxlib.exception.WXRuntimeException: should call prepareTargetKey first 说起

对于安卓的开发,我并没有太多的经验,并且很多的东西目前也没有深入的研究。最近在更新Findu的安卓版本的时候,出现了一个意外的错误。错误代码如下:

03-07 15:03:30.046 12215-12290/today.findu.findu.alibaba.openIMUI:watchdog E/AndroidRuntime: FATAL EXCEPTION: initFeedbackThread
  Process: today.findu.findu.alibaba.openIMUI:watchdog, PID: 12215
  com.alibaba.wxlib.exception.WXRuntimeException: should call prepareTargetKey first
      at com.alibaba.mobileim.utility.AccountInfoTools.initTargetAppKeys(AccountInfoTools.java:190)
      at com.alibaba.mobileim.FeedbackAPI.initFeedbackImpl(FeedbackAPI.java:108)
      at com.alibaba.mobileim.FeedbackAPI.access$000(FeedbackAPI.java:38)
      at com.alibaba.mobileim.FeedbackAPI$1.run(FeedbackAPI.java:97)
      at java.lang.Thread.run(Thread.java:761)

并且同时还有大量的其他的错误信息:

03-07 15:03:34.274 12215-12215/today.findu.findu.alibaba.openIMUI:watchdog E/security: [2014@taobao_h5_3.0.0][WLqJSW6PXu8DAOb+xk4MZjLO][] : ***********************************************************
  错误编码 = 10010
  错误消息 = 发生错误,消息为 null sec code 162, 请使用 LogCat 查看更多细节
  解决建议 = 请使用默认的 androiddebugkey 对当前开发应用签名或在应用初始化之前调用 AlibabaSDK.turnOnDebug(), 运行程序查看 logcat 输出以获取更多错误细节,并采取对应操作
  错误堆栈 = ErrorCode = 162
  com.alibaba.wireless.security.open.SecException
      at com.alibaba.wireless.security.open.initialize.c.a(Unknown Source)
      at com.alibaba.wireless.security.open.initialize.a.a(Unknown Source)
      at com.alibaba.wireless.security.open.initialize.b.b(Unknown Source)
      at com.alibaba.wireless.security.open.initialize.b.loadLibrarySync(Unknown Source)
      at com.alibaba.wireless.security.open.initialize.b.initialize(Unknown Source)
      at com.alibaba.sdk.android.security.impl.h.a(SourceFile:23)
      at com.alibaba.sdk.android.security.impl.SecurityGuardWrapper.init(SourceFile:61)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.alibaba.sdk.android.a.a.a.a(SourceFile:91)
      at com.alibaba.sdk.android.task.a.c(SourceFile:186)
      at com.alibaba.sdk.android.task.a.a(SourceFile:144)
      at com.alibaba.sdk.android.AlibabaSDK.a(SourceFile:135)
      at com.alibaba.sdk.android.AlibabaSDK.asyncInit(SourceFile:98)
      at cn.org.findu.finduUI.demo.DemoApplication.onCreate(DemoApplication.java:61)
      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
      at android.app.ActivityThread.-wrap2(ActivityThread.java)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:154)
      at android.app.ActivityThread.main(ActivityThread.java:6119)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Continue Reading