Skip to content

Instantly share code, notes, and snippets.

@nailuoGG
Last active September 6, 2023 07:41
Show Gist options
  • Save nailuoGG/0f4f89c947fd8af10c8056a9707034ff to your computer and use it in GitHub Desktop.
Save nailuoGG/0f4f89c947fd8af10c8056a9707034ff to your computer and use it in GitHub Desktop.
如何迅速从小程序工程中检查出哪些代码使用了微信隐私api。https://liujiale.me/

如何迅速从工程中检查出哪些代码使用了微信隐私api

install 安装

brew install ripgrep

download private api list

using wget

wget https://gist.githubusercontent.com/nailuoGG/0f4f89c947fd8af10c8056a9707034ff/raw/private_api.txt

or curl

curl -O https://gist.githubusercontent.com/nailuoGG/0f4f89c947fd8af10c8056a9707034ff/raw/private_api.txt

using it

rg  -i -C 5 --file ~/Code/private_api.txt  ./

命令解析

这个命令使用了rg(ripgrep)工具来在指定的目录(./)中搜索匹配private_api.txt文件中的关键词的文本内容。以下是命令中每个选项和参数的解释:

  • rg: 这是ripgrep的命令。ripgrep是一个用于在文件中快速搜索文本的工具,它支持正则表达式搜索和其他高级搜索功能。

  • -i: 这是一个选项,表示搜索时不区分大小写。使用此选项后,搜索将不受关键词的大小写影响,即不管关键词是大写还是小写,都会匹配。

  • -C 5: 这是另一个选项,表示在显示匹配结果时,显示匹配行的上下文。-C 5意味着在每个匹配行的上下文中显示5行文本,以帮助您理解匹配的上下文。

  • --file ~/Code/private_api.txt: 这是要搜索的关键词文件的路径。ripgrep将从private_api.txt文件中读取关键词列表,然后在指定的目录中搜索这些关键词。

  • ./: 这是要搜索的目录的路径。在这个命令中,./表示当前目录,也就是命令执行的工作目录。ripgrep将在当前目录中搜索匹配关键词的文本内容。

综合起来,这个命令的作用是在当前目录下搜索匹配private_api.txt文件中关键词列表的文本内容,不区分大小写,同时在每个匹配行的上下文中显示5行文本。搜索结果将包括匹配行及其上下文,以帮助您更好地理解匹配的位置和上下文。

参考资料:

<button open-type="chooseAvatar">|<input type="nickname">|getUserInfo (已回收)|getUserProfile (已回收)|<button open-type="userInfo">(已回收)|收集你的位置信息|'scope.userLocation'|'scope.userLocationBackground'|'scope.userFuzzyLocation'|getLocation|startLocationUpdate|startLocationUpdateBackground|getFuzzyLocation|收集你选择的位置信息|choosePoi|chooseLocation|收集你的地址|chooseAddress|收集你的发票信息|chooseInvoiceTitle|chooseInvoice|收集你的微信运动步数|'scope.werun'|getWeRunData|收集你的手机号|<button open-type="getPhoneNumber">|<button open-type="getRealtimePhoneNumber">|收集你的车牌号|chooseLicensePlate|收集你选中的照片或视频信息|chooseImage|chooseMedia|chooseVideo|收集你选中的文件|chooseMessageFile|访问你的麦克风|'scope.record'|startRecord|RecorderManager.start|<live-pusher>|joinVoIPChat|访问你的摄像头|'scope.camera'|createVKSession|<camera>|<live-pusher>|<voip-room>|访问你的蓝牙|'scope.bluetooth'|openBluetoothAdapter|createBLEPeripheralServer|使用你的相册(仅写入)权限|'scope.writePhotosAlbum'|saveImageToPhotosAlbum|saveVideoToPhotosAlbum|使用你的通讯录(仅写入)权限|'scope.addPhoneContact'|addPhoneContact|使用你的日历(仅写入)权限|'scope.addPhoneCalendar'|addPhoneRepeatCalendar|addPhoneCalendar|调用你的加速传感器|stopAccelerometer|startAccelerometer|onAccelerometerChange|offAccelerometerChange|调用你的磁场传感器|stopCompass|startCompass|onCompassChange|offCompassChange|调用你的方向传感器|stopDeviceMotionListening|startDeviceMotionListening|onDeviceMotionChange|offDeviceMotionChange|stopGyroscope|startGyroscope|onGyroscopeChange|offGyroscopeChange|读取你的剪切板|setClipboardData|getClipboardData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment