惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
M
MIT News - Artificial intelligence
D
Docker
S
SegmentFault 最新的问题
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
C
Check Point Blog
GbyAI
GbyAI
美团技术团队
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog

LanYunのBlog

优化macOS Dock栏的显示与隐藏 解决macOS全屏模式下某些情况显示原始鼠标指针的问题 Yarn从Classic迁移到Modern nginx自编译 用santa对二进制进行监控和授权 ESXI 8.0安装黑群晖DSM 7.x openwrt编译过程记录 编译monero For macOS ARM 自建busuanzi不蒜子平台统计平台 浅记博客更新日志 (机翻)Kubo配置文件 修改brew services中服务的启动参数 解决Surge模块不能同步问题 为Arch Linux配置邮件服务 自编译NutClient-ESXI,更改邮件逻辑 解决ESXI和群晖使用SSH密钥登录问题 为J4125软路由ESXI中群晖提供UPS服务 在arch linux上搭建rustdesk server 解决虚拟机扩容中GPT PMBR大小不符问题 搭建Tuic V5 优雅地为macOS提供python多版本的支持 修复root路径下文件权限问题 解决macOS 14上利用Whisky运行steam时有关问题 在macOS中用PhpStorm配置Xdebug调试 利用CloudFlare Workers快速自建一个IP获取器 如何自动续期证书? 从0开始速配VPS用于网站等 搭建一个基于ChatGPT的QQ机器人(Yunzai-Bot) For Mac 010 Editor For Mac 13.0.1 Crack 破解 关于部署Cloudflare Zero Trust遇到的问题浅记录📝
技术杂记📝
LanYun · 2023-08-04 · via LanYunのBlog

前言

主要还是想分享一些技术和一些可能用的上的东西吧.原来有篇日常杂记,但出于某些原因不能公开.故另起一文主要做少许记录,确保内容无太多情绪的语言.内容也更为随意(翻译:方便CV的就记录一下),更新时间完全看心情了(翻译:随机+懒+忘记写=容易鸽🐦).

下面把部分内容搬运过来一些.

注: 此篇禁CN网络访问.已解除限制🔓

现在含日常记录📝了.

2026年1月14日 星期三

在对我macOS系统部分组件(隔空投送/接力等)进行问题排查和分析过程中,意外发现iOS Authenticator应用将2FA保存到iCloud钥匙串中(com.microsoft.authenticator.backup,2FA secret在AccountOathSecretKey中),之前我想了很多办法试图导出Authenticator中的2FA(砸壳/逆向/抓包)都失败了,不过现在既然能导出2FA数据,那么终于可以对微软垃圾应用Authenticator Say Never meet again! 可以回到我高贵Apple原生密码应用中了(😁only Apple can do!)

2025年12月23日 星期二

真 牛马(worker),没得假期,虽然早9晚5,但是还是挺无聊的,最近花了点时间写一个Web工具箱(打磨得不错了,比较美观),网址: tool.lanyundev.com (已上线)

其中主要工作是QR(二维码)传输工具的前端布局,(在AI的潮流下,我居然都是一点点抠出来的😂),我不希望依赖前端UI框架,纯原生javascript和css,在写这个工具箱的过程中,我对于代码管理和架构有进一步的理解(感觉是一丢丢)

吐槽: So,Safari,fuck you! (Chrome上显示的没问题,但就是在Safari上有问题,以后再慢慢修)

杂谈: 作为保守派,或者说传统派,想法一直是以底层命令为核心,比如链路:语音指令->分析并拆分任务->直接执行相关操作/指令/请求等,无需通过GUI等用户层来进行模拟点击之类的,只不过我觉得像豆包手机这种激进派的想法太保守了。😂

2025年11月8日 星期六

毕业之后上班了,感觉有点累(但压力目前不是很大),没有双休(无视劳动法),工资也低(基本的5险一金还算有),在技术这方面,上班之后确实更加懈怠了🥱

不过还是写一些丑陋的不便公开的私有代码(功能上有一定bug,性能上有巨大提升空间),我想的是Done(做出来),之后看心情再better(做的更好)

目前实现了有反洗钱(AML)自动智能处理化评级(甄别做了一点就没做了,有点懒)、国库集中支付自动智能处理化(常规/大部分情况下都处理),中文转拼音及数字专人民币大写等工具箱

—写于被感冒困扰的我😭…

2025年7月18日 星期五

在macOS 外置显示器上玩2077,记得把 控制中心/菜单栏 中 自动隐藏和显示菜单栏 设置为始终,否则画面覆盖不全.

在macOS 15.5,M1 MAX 64GB 外置LG 4K显示器的设备上玩2.3版本2077,关闭帧生成,关闭系统中占用高CPU的进程,分辨率设为2560x1440,纹理质量等特效均设置为高,平均FPS为61.64,最大FPS为71.51,最小FPS为52.37,采用默认动态分辨率调节.

1
2
3
4
5
6
7

sudo log config --mode "level:off"
sudo log config --mode "persist:off"
sudo log config --mode "stream:default"
sudo log config --status

launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist

2025年7月10日 星期四

macOS 英文输入法恢复按键重复功能: defaults write -g ApplePressAndHoldEnabled -bool false

注销用户并重新登录生效或者重启macOS系统

2025年5月5日 星期一

草了,macOS 系统这么怎么垃圾,到处都有内存泄露的bug,md,系统私有框架 Portrait.framework 我真的服了,从macOS 10.11 上被发现到我目前用的 macOS 15.4.1 依然没修复。

我怎么发现的?

我真的草了,我用 FFmpeg 调用 AVFoundation 硬件采集(-f avfoundation),然后这逼进程内存持续增长,我tm追踪一看,底层 Portrait.framework 无法释放某些 CFString 路径资源导致的(反复加载但未释放的 VFX 资产路径字符串: file:///System/Library/PrivateFrameworks/Portrait.framework/Resources/…)

2025年4月24日 星期四

在工具受限或技术有限情况下,通过遍历线程并提供堆栈来找到程序性能瓶颈,参考: 1.poormansprofiler.org 2.旧版翻译

2025年4月10日 星期四

如果/private/var/log/alf.log文件无法被正常创建/读取,那么将无法打开macOS设置中的网络界面。

2025年1月20日 星期一

macOS arm架构,OrbStack 通过 Rosetta 运行的 x64 linux 虚拟机,通过 qemu-x86_64 -g 1234 /path/filegdb /path/file 可以进行调试.

1
2
3
4
5
6
7
8
9
10

qemu-x86_64 -g 1234 /path/file


gdb /path/file
target remote localhost:1234




否则报错

1
2
3
4
warning: linux_ptrace_test_ret_to_nx: Cannot PTRACE_GETREGS: Input/output error
warning: linux_ptrace_test_ret_to_nx: PC (nil) is neither near return address 0x7ffff8e1e000 nor is the return instruction 0x675672!
Couldn't get CS register: Input/output error.
Exception occurred: Error: Couldn't get registers: Input/output error. (<class 'gdb.error'>)

临时解除非root用户对其他进程的调试限制: echo 0 > /proc/sys/kernel/yama/ptrace_scope 或者 sysctl -w kernel.yama.ptrace_scope=0

持久化: vim /etc/sysctl.conf 添加 kernel.yama.ptrace_scope=0

下面办法有可能不可行(出现转译器不支持特定的 QEMU 指令集时),不清楚详细原因.(参考: https://github.com/docker/for-mac/issues/6921 )

1
2
3
4
5
6
7
8

ROSETTA_DEBUGSERVER_PORT=1234 /path/file


gdb-multiarch
set architecture i386:x86-64
file /path/file
target remote localhost:1234

有可能出现报错

1
2
3
4
5
6
7
8
9
10
11
12

rosetta error: no handlers found for <Qqemu.sstepbits>, length=<15>!


warning: remote target does not support file transfer, attempting to access files from local filesystem.
Exception occurred: Error: Remote connection closed (<class 'pwndbg.dbg.Error'>)
For more info invoke set exception-verbose on and rerun the command
or debug it by yourself with set exception-debugger on
Python Exception <class 'pwndbg.dbg.Error'>: Remote connection closed
./gdb/thread.c:87: internal-error: inferior_thread: Assertion current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

参考: GDB crashes debugging x86 binary under Rosetta 2 + Apple Virtualization Framework Unable to debug amd64 binaries on apple silicon Unable to Debug on Apple M1/M2 when using linux/amd64 devcontainer Using pwndbg debugger to report errors in ubuntu with arm architecture

2025年1月16日 星期四

狗屎拳头公司,macOS端的英雄联盟(League of Legends)全屏有bug,界面上面一部分横排鼠标点击没图标,怀疑遮挡代码有问题,先切换到无边框模式再切换回来就正常了(但是切换后有段时间是卡卡的,垃圾riot公司,优化太差了).

2025年1月4日 星期六

已知bug: surge增强模式会(准确说是开启VPN这个状态)导致 navigator.onLine 判断始终为 true ,即不能真实反映网络联通状态.

2024年12月23日 星期一

鉴于 ishot 2.5.9 版本crack版依然存在使用截图相关功能会导致进程崩溃重启,现给出临时办法(关闭ishot进程后需再次执行): 在进行录屏的过程使用截图相关功能再退出录屏即可,这样能”留住” Legacy Color Picker Extensions (/System/Library/Frameworks/AppKit.framework/Versions/C/XPCServices/LegacyExternalColorPickerService-arm64.xpc/Contents/MacOS/LegacyExternalColorPickerService-arm64) 而不导致ishot崩溃.

2024年12月17日 星期二

macOS 15.2 禁用服务(忘了说了,这命令可能需要关闭sip才能执行) sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.modelmanagerd.plist # AI 会导致 /usr/sbin/coreaudiod 进程CPU飙升,占用大量CPU资源

这玩意Klack(1.6.1)软件也有bug,会导致 coreaudiod 进程CPU百分之10以上,本身软件也占CPU比较高.

下面是关于外置ssd安装macOS中遇到的问题的一些不友好语言输出.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
沟槽的macOS系统降级,真操蛋,限制真JB多,BUG也非常多
走USB协议的外置硬盘,遇到许多问题
像什么 无法验证启动器、源宗卷无法恢复 密封已损坏、无法备份 OSStatus error 49153、当前实例与预期不相符、启动磁盘授权失败(管理员密码对了也不给,怀疑代码有问题)、启动外置磁盘中系统强制验证联网、通过终端运行安装器强制联网并下载最新版、恢复模式启动外置硬盘旧版安装器,如果你连了网,安装器不会安装旧版而是联网下载最新版进行安装(逆天),如果你没联网,验证完了给你来句需要互联网连接😅(我卡着时间验证完就它网,这样它才会使用安装器里面的镜像)
😅人都麻了、、
安装器日志各种报错、
从 macOS 15.2 -> 14.3.1 -> 12.5 x-> 11.2.3

根本启动不了走USB协议的外置硬盘里的系统,试过都不行,服了、、只好装到主硬盘再通过(asr)恢复主硬盘宗卷(要求密封完整,byd有验证)到外置硬盘中、、
在恢复模式中装到外置硬盘、在操作系统中运行相匹配的安装器、都他妈不行、

https://discussions.apple.com/thread/253787672?sortBy=rank

似乎只有使用APFS格式化的外部雷雳驱动器才能启动。USB闪存驱动器不可启动,您无法将APFS放在安装程序卷上

要关sip才能安装pkg,但是关闭sip会破坏卷宗密封

M1 MAX 不支持 Big Sur (11.x),原因:安装版本不能超过出厂版本(😅)
上面说的USB协议是指走的USB3 <=10gb/s速率的协议或通道
内置硬盘走pcie协议没问题,外置硬盘走USB4/雷雳4(速率>=40gb/s)协议(通过PCI-Express进行连接)可以启动.

2024年12月9日 星期一

通过brew更新python后,pyenv可能需要更新相关pyvenv.cfg文件路径

ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python

2024年12月2日 星期一

解决macOS通过brew安装rust/gem安装依赖后PATH路径问题.

例如: gem install cocoapods,命令gem envEXECUTABLE DIRECTORY添加到PATH中

安装rust

1
2
brew install rust 
brew install rustup

如果遇到无法解决的奇奇怪怪的问题,就用官方安装办法尝试

1
2
3
rustup self uninstall
brew remove rust rustup
curl -sSf https://sh.rustup.rs | sh

2024年11月23日 星期六

macOS 语音备忘录 录音存放位置

1
open ~/Library/Group\ Containers/group.com.apple.VoiceMemos.shared/Recordings

macOS 日志/临时文件相关位置

1
2
3
4
5
6
7
8
9
/Library/Logs
/private/var/tmp
/private/var/log
/private/var/logs
/private/tmp
open ~/Library/Logs
open ~/Library/Caches
/private/var/root/Library/Logs
/private/var/root/Library/Caches

全局环境变量设置 参考:

1
/bin/launchctl setenv MTL_HUD_ENABLED 1

2024年11月13日 星期三

部分域名如 *.cnki.net 需用国内DNS解析如 223.5.5.5,否则访问不了.

2024年11月7日 星期四

v2raya(v2.2.6.2) 在macOS上,某些情况下会导致kernel panic(系统崩溃),简短点说就是macOS 内存保护机制,发现这个进程访问非法内存地址指针(可能说的不准确,但确实和macOS内存保护机制有关,期间CPU跑满),然后系统炸掉重启.

2024年11月6日 星期三

macOS,开机时这个路径/private/var/root/Library/Caches如果不能正常访问,那么开机会卡在login加载界面.

2024年11月5日 星期二

没人🙌比我👐更懂👌macOS☝️(划掉

最近上 macOS 15 了,byd,一些系统服务 launchctl unload -w 后开机还是要启动

结合前几天的研究和 macOS 15 这个特性写了个自动化脚本(😏自用,因为耗费较多精力且还有待完善,暂不免费公开,有bug,出问题了我不想负责.)

脚本自动关闭系统收集数据相关进程,且能保证系统不会炸掉(崩溃),同时自动将一些many disk write(喜欢写数据/拉屎)的应用(例如: Chrome,qq等)的数据路径全部重定向到Ram Disk(内存磁盘)中去,大幅缓解SSD损耗.同时在关机前自动将数据备份到指定路径中,开机时自动恢复.完善的日志记录,方便排查问题.后面再加什么功能就懒得写了.反正对于我来说很爽(磁盘写入敏感性/强迫症用户).

用ishot crack(2.5.6)版截图一次,进程崩溃重启一次(2.5.4 crack版没这个问题),目前通过奇怪的方式修好了(😏,过几版本看修复了没,没的话就分享出来)

2024年11月4日 星期一

禁用systemstats等进程,停止记录系统级别信息

1
2
3
4
5
6
7
8
9
10
11
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstats.analysis.plist;sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstatusd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstats.daily.plist;sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstats.microstackshot_periodic.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ecosystemanalyticsd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.photoanalysisd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.inputanalyticsd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.geoanalyticsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.analyticsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.audioanalyticsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.wifianalyticsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.osanalytics.osanalyticshelper.plist

进程analyticsd拉屎位置: /private/var/db/analyticsd (我他妈直接rm -rf)

2024年11月3日 星期日

🐎的,艹了,手残把/private/var/db/oah给删了(删文件夹下的内容也会出问题,好不容易定位到这个地方的问题,最近在狠狠地调教macOS系统,删了很多垃圾,禁止一些行为的拉屎等等,但是这不算完☝️,以后有空慢慢玩.)

解决办法:

进恢复模式,用终端,关sip(csrutil disable),pkgutil --files com.apple.pkg.RosettaUpdateAuto --volume xx(自己填硬盘的DATA路径)找到它安装到哪些位置(例如我的是: /Library/Apple/usr/lib/libRosettaAot.dylib /Library/Apple/usr/libexec/oah /Library/Apple/usr/share/rosetta),然后狠狠地rm -rf(不放心自己mv到其他地方).byd,oah相关进程崩溃导致loginwindow无响应,艹了.killall -HUP loginwindow 勉强能用.

2024年11月1日 星期五

如果能研究出macOS应用Containers沙盒通过软链接访问外部存储设备就好了.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.rtcreportingd.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.suggestd.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.system_installd.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.idleassetsd.plist


launchctl unload -w /System/Library/LaunchAgents/com.apple.sharingd.plist



记录一下在macOS环境下遇到electron构建的应用相关报错(主要是不会搞让应用的容器路径下让应用能够访问软链接到外部的路径或文件,应用没权限,因为不知道怎么添加这个权限,我就打算去掉sandbox,但是遇到了些问题.)

使用命令sudo codesign -f -s - --timestamp=none --all-architectures签名,遇到的问题:

[32428:1102/000248.192282:ERROR:network_service_instance_impl.cc(600)] Network service crashed, restarting service.

GPU process exited unexpectedly: exit_code=5

等等.

终于经过研究实践用如下命令签名解决

1
2

sudo codesign -f -s "lanyun" --deep --verbose xx

2024年10月31日 星期四

如果你发现ANECompilerService进程写入量很高,那是因为它在

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/private/var/folders/9y/xxx/C/com.apple.quicklook.ThumbnailsAgent/com.apple.QuickLook.thumbnailcache/thumbnails.data




mdutil -a -i off;mdutil -aE

sudo pmset sleepnow


clear

BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m"
BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m"
CYAN="\033[0;36m"
LIGHT_CYAN="\033[1;36m"
RED="\033[0;31m"
LIGHT_RED="\033[1;31m"
PURPLE="\033[0;35m"
LIGHT_PURPLE="\033[1;35m"
BROWN="\033[0;33m"
YELLOW="\033[0;33m"
LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m"
NC="\033[0m"
CLTGDIR="/Library/Developer/CommandLineTools/"

if [[ $EUID -ne 0 ]]; then
echo -e "${RED}请以管理员身份运行此脚本。${NC}"
exec sudo "$0" "$@"
fi
while true; do
clear
echo ""
echo -e "${GREEN}macOS小助手${NC} ${RED}by lw404-ai${NC}"
echo ""
PS2='直接回车默认执行 [重新签名] 与 [绕过签名] 选项 (其他选择请输入非空字符): '
PS3='请输入数字然后按下回车进行选择: '
options=(
"绕过签名认证 (可解决『应用无法运行』问题)"
"应用进行签名 (可解决『意外退出/崩溃闪退』问题)"
"查看SIP状态"
"禁用系统更新提示"
"退出脚本"
)

read -p "$PS2" REPLY

if [[ -z "$REPLY" ]]; then

echo -e "${YELLOW}请将需要执行的程序拖放到此处,然后按回车键${NC}"
read -e -p "应用路径: " FILEPATH1
if [ -e "$FILEPATH1" ]; then
sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine "$FILEPATH1"
echo -e "${GREEN}--- 1 ---绕过签名成功!${NC}"
else
echo -e "${RED}路径无效,请确认文件是否存在。${NC}"
fi
if [ -e "$FILEPATH1" ];then
if [ ! -d "$CLTGDIR" ]; then
echo -e "${RED}未安装Command Line Tools,请先安装。${NC}"
echo "你可以通过运行 'xcode-select --install' 来安装。"
else
sudo codesign --force --deep --sign - "$FILEPATH1"
echo -e "${GREEN}--- 2 ---重新签名成功!${NC}"
fi
fi
else

select opt in "${options[@]}"; do
case $opt in
"绕过签名认证 (可解决『应用无法运行』问题)")
echo ""
echo -e "${YELLOW}请将需要绕过签名的程序拖放到此处,然后按回车键${NC}"
read -e -p "应用路径: " FILEPATH
if [ -e "$FILEPATH" ]; then
sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine "$FILEPATH"
echo -e "${GREEN}绕过签名认证成功!${NC}"
else
echo -e "${RED}路径无效,请确认文件是否存在。${NC}"
fi
break
;;
"应用进行签名 (可解决『意外退出/崩溃闪退』问题)")
echo ""
echo -e "${YELLOW}请将需要签名的程序拖放到此处,然后按回车键${NC}"
read -e -p "应用路径: " FILEPATH
if [ -e "$FILEPATH" ]; then
if [ ! -d "$CLTGDIR" ]; then
echo -e "${RED}未安装Command Line Tools,请先安装。${NC}"
echo "你可以通过运行 'xcode-select --install' 来安装。"
else
sudo spctl --master-disable
sudo codesign --force --deep --sign - "$FILEPATH"
echo -e "${GREEN}签名成功!${NC} 请重新运行应用查看结果。"
fi
else
echo -e "${RED}路径无效,请确认文件是否存在。${NC}"
fi
break
;;
"查看SIP状态")
echo ""
echo -e "您选择了${LIGHT_BLUE}查看SIP状态${NC}"
csrutil status
echo -e "${RED}disabled${NC} 代表SIP已${CYAN}关闭${NC}${RED}enabled${NC} 代表SIP已${YELLOW}开启${NC}。"
break
;;
"禁用系统更新提示")
echo ""
echo -e "您选择了${LIGHT_BLUE}禁用系统更新提示${NC}"
sudo defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
sudo killall Dock
echo -e "${GREEN}系统更新提示已禁用!${NC}"
break
;;
"退出脚本")
echo -e "${RED}脚本结束,窗口即将关闭${NC}"
exit 0
;;
*)
echo -e "${RED}无效选择,请重新输入。${NC}"
;;
esac
break
done
fi
echo ""
echo -e "${YELLOW}按下任意键重新运行脚本,或按下ESC键退出${NC}"
read -rsn1 key
if [[ $key == $'\e' ]]; then
echo -e "${RED}脚本结束,窗口即将关闭${NC}"
break
fi
done
exit 0


for file in *.mp4; do
duration=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$file")
new_duration=$(echo "$duration - 15 - 5" | bc)
ffmpeg -i "$file" -ss 5 -t "$new_duration" -c copy "temp_$file"
mv "temp_$file" "$file"
done


/etc/init.d/dnsmasq restart


python3 -m venv .venv
source .venv/bin/activate
1
2
3
4
5
6
7
8
9
10
11

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--disk-cache-size=1 \
--media-cache-size=1 \
--disable-gpu-program-cache \
--disable-gpu-shader-disk-cache \
--skia-font-cache-limit-mb=1 \
--skia-resource-cache-limit-mb=1 \
--v8-cache-options=none > /dev/null 2>&1


还是Safari文明些,不像Google Chrome喜欢往disk拉屎(many disk write).

2024年10月30日 星期三

删除Google Chrome上该死的旧版本.

1
2

open '/Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions'

利用TmpDisk,将一些cache目录(特别是Chrome,Spotify等喜欢disk write的傻逼软件)重定向到内存磁盘上去了.顺便在系统允许的范围内也禁用一些喜欢disk write的软件(如:helpd)

记录macOS启动流程中目录不可访问失败

1
2
3

/private/var/folders/9y/xxx/0/com.apple.LaunchServices.dv
~/Library/Caches

2024年10月28日 星期一

垃圾macOS,下面👇命令 ⚠️ 慎用(待完善)! 有可能会导致系统崩溃.(先别加-w,不然崩溃重启后你需要迅速执行launchctl load -w相关命令,否则有可能会连续崩溃.)

macOS禁用并删除一部分(不完全)系统/软件日志:

1
2
3
4
5
6
7
8
9
10
11
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.logd_helper.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.logd_reporter.plist
sudo rm -rf "/private/var/db/diagnostics"
sudo rm -rf "/private/var/db/DiagnosticsReporter"
sudo rm -rf "/private/var/db/uuidtext"
sudo rm -rf "/Library/Logs"
sudo rm -rf "/Users/$(whoami)/Library/Logs"
sudo rm -rf "/private/var/log"*

其他相关命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
sudo log erase --all 
echo pffff >> dsc; sudo rm -rf /private/var/db/uuidtext/dsc; sudo mv dsc /private/var/db/uuidtext/

sudo plutil -convert xml1 /Library/Preferences/com.apple.alf.plist
sudo vim /Library/Preferences/com.apple.alf.plist
sudo plutil -convert binary1 /Library/Preferences/com.apple.alf.plist

sudo vim /private/etc/asl.conf

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist




/Users/$(whoami)/Library/Group Containers/TC3Q7MAJXF.com.adguard.mac/Library/Logs
/Users/$(whoami)/Library/Group Containers/TC3Q7MAJXF.com.adguard.mac/Logs


rm -rf "/Users/$(whoami)/Library/Group Containers/TC3Q7MAJXF.com.adguard.mac/Library/Logs/com.adguard.mac.adguard/Adguard-group.log";ln -s /dev/null "/Users/$(whoami)/Library/Group Containers/TC3Q7MAJXF.com.adguard.mac/Library/Logs/com.adguard.mac.adguard/Adguard-group.log"



sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd_helper.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd_reporter.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.watchdogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.logd_helper.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.logd_reporter.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.watchdogd.plist



sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd_helper.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd_reporter.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.watchdogd.plist
sudo rm -rf /private/var/db/diagnostics;sudo rm -rf /private/var/db/uuidtext
sudo launchctl load /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.watchdogd.plist




sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.logd_helper.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.logd_reporter.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.watchdogd.plist
sudo rm -rf /private/var/db/diagnostics/*
sudo launchctl load /System/Library/LaunchDaemons/com.apple.logd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.watchdogd.plist







注意事项

1
2
3
4
5
# 通过对panicString(/Library/Logs/DiagnosticReports)研究发现,如果logd进程在120秒内没有响应watchdogd进程(通过launchctl unload命令,此时logd已经被关闭/杀死),那么watchdogd进程将触发的用户态系统崩溃
# 所以杀/结束logd进程之前,先杀死watchdogd进程(虽然watchdogd进程也挺有用的).
# launchctl unload -w /System/Library/LaunchDaemons/com.apple.watchdogd.plist
# 禁用后发现,macOS发现watchdogd进程挂了也会崩溃.算了,懒的继续搞了,以后有时间再看看.
# 注: launchctl unload 添加 -w 是永久保存修改的意思,即重启后不会再load

(可选)关闭Apple 推送通知服务 (apsd)

1
2
3
4
5
6
7
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.helpd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.corespotlightd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.coresymbolicationd.plist

(无效)禁用系统更新等服务(以后尝试用Santa看看)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38






daemons=('com.apple.analyticsd' 'com.apple.appleseed.fbahelperd' 'com.apple.dprivacyd' 'com.apple.ReportCrash.Root' 'com.apple.SubmitDiagInfo')


agents=('com.apple.appleseed.seedusaged' 'com.apple.appleseed.seedusaged.postinstall' 'com.apple.ReportCrash' 'com.apple.softwareupdate_notify_agent' 'com.apple.SoftwareUpdateNotificationManager' 'com.apple.ReportCrash')

for daemon in "${daemons[@]}"; do
{
sudo /usr/libexec/PlistBuddy -c "Add Disabled bool true" /System/Library/LaunchDaemons/${daemon}.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/${daemon}.plist
} &> /dev/null

daemon_flag=$(/usr/libexec/PlistBuddy -c "Print Disabled" /System/Library/LaunchDaemons/${daemon}.plist 2> /dev/null)
if [[ ${daemon_flag} == 'true' ]]; then
echo "[SUCCESS] Disabled ${daemon}"
else
echo "[ERROR] Failed to disable ${daemon}"
fi
done

for agent in "${agents[@]}"; do
{
sudo /usr/libexec/PlistBuddy -c "Add Disabled bool true" /System/Library/LaunchAgents/${agent}.plist
sudo launchctl unload -w /System/Library/LaunchAgents/${agent}.plist
} &> /dev/null

agent_flag=$(/usr/libexec/PlistBuddy -c "Print Disabled" /System/Library/LaunchAgents/${agent}.plist 2> /dev/null)
if [[ ${agent_flag} == 'true' ]]; then
echo "[SUCCESS] Disabled ${agent}"
else
echo "[ERROR] Failed to disable ${agent}"
fi
done

2024年7月24日 星期三

macOS 图书 中书籍位置信息:

iCloud 位置: ~/Library/Mobile\ Documents/iCloud\~com\~apple\~iBooks/Documents

本机位置: ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks

open命令打开上面路径即可找到你的书籍文件,可惜目前我只了解到Mac上可以这样无视苹果图书软件限制导出书籍.

2024年7月23日 星期二

在macOS上清除 OrbStack docker 容器日志.

方法一:

1
2
3
4
docker inspect --format='{{.LogPath}}' 容器ID 
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh


方法二(推荐):

1
2
3

open ~/OrbStack/docker/containers/容器ID/var/lib/docker/containers

上面方法都是利用了Docker CE virtual machine来实现访问/var/lib/docker路径.

2024年5月3日 星期五

uu加速器 台服英雄联盟 IP似乎被封禁.利用Proxifier将pvp.net子域名走代理(eg:香港节点),其余域名走direct,通过uu加速器设定的6.6.6.6本地DNS解析实现加速.另外,在macOS上,uu加速器会走系统设定的代理服务,而代理服务通过Proxifier分流到direct.这会导致一个DNS loop的问题.解决办法:在系统设置,网络,过滤条件中关闭Proxifier DNS代理.

tips: 如果Adguard开启dns保护,大概率会导致lol客户端报错: 无法连接到平台SIPT ,因为uu加速器设置的dns会被adguard的dns模块给劫持了,导致客户端获取ip不匹配/未走加速器线路.

2024年3月30日 星期六

tmd,CodeWhisperer疯狂下载/上传,域名:specs.codewhisperer.us-east-1.amazonaws.com,鬼知道在上传什么数据.

2024年3月25日 星期一

修改passwall服务器端中各个协议配置模版相关代码位置:

1
/usr/lib/lua/luci/passwall

2024年2月18日 星期日

对于macOS中sed命令.POSIX 规范要求sed在(a/i/c)\后面需要有一个换行符.

例如:

1
2
3
4
5
6
7
8
9

sed -i '' -e "3i\\
This is added at the beginning of line 3" $file

sed -i '' -e '/#/i\'$'\nwords' $file
sed -i '' -e '1i\'$'\nwords' $file
sed -i '' -e $'1i\\\nwords' $file


2024年2月17日 星期六

已知,macOS adobe软件会导致系统指针切换为自定义指针异常.解决: 退出相关软件即可恢复正常.

掌握一项技能: 手动将位图转换为矢量图(包含其中调整,修饰等)

2024年1月25日 星期四

(不完善,不全面,存在缺陷)删除并阻止macOS日志生成.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
user=$(whoami)
log_path=(
"/Library/Logs"
"/Users/${user}/Library/Logs"
"/private/var/log"
"/private/var/logs"
)
sudo rm -rf "${log_path[@]}"
sudo touch "${log_path[@]}"
sudo chmod 000 "${log_path[@]}"



sudo rm -rf "/private/var/log"
dig lanyundev.com +answer || dig lanyundev.com +answer
sudo touch "/private/var/log"
sudo chmod 000 "/private/var/log"



sudo rm -rf "/Users/${user}/Library/Logs"

杀死提交诊断信息进程(应该不止这一个):killall SubmitDiagInfo

2024年1月24日 星期三

禁止macOS连接到新网络时检查互联网连接并启动 Captive Portal 助理实用程序应用程序

1
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control.plist Active -bool false

2024年1月23日 星期二

在macOS M芯片上关闭SIP(System Integrity Protection status: disabled)的情况下,如果nvram boot-args中存在amfi_get_out_of_my_way=0x1,那么java将crash崩溃.报错部分内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40














--------------- S U M M A R Y ------------

Command Line:

Host: "MacBookPro18,2" arm64, 10 cores, 64G, Darwin 23.3.0, macOS 14.3 (23D56)
Time: Tue Jan 23 13:07:16 2024 CST elapsed time: 0.012328 seconds (0d 0h 0m 0s)

--------------- T H R E A D ---------------

Current thread (0x0000000134808600): JavaThread "Unknown thread" [_thread_in_vm, id=10499, stack(0x000000016fa78000,0x000000016fc7b000) (2060K)]

Stack: [0x000000016fa78000,0x000000016fc7b000], sp=0x000000016fc7a940, free space=2058k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x37d020] CodeHeap::allocate(unsigned long)+0x15c
V [libjvm.dylib+0x2015a4] CodeCache::allocate(int, CodeBlobType, bool, CodeBlobType)+0x58
V [libjvm.dylib+0x1fbaa8] BufferBlob::create(char const*, int)+0x7c
V [libjvm.dylib+0x788bcc] initialize_stubs(StubCodeGenerator::StubsKind, int, int, char const*, char const*, char const*)+0xac
V [libjvm.dylib+0x788b10] StubRoutines::initialize_initial_stubs()+0x38
V [libjvm.dylib+0x39dcf4] init_globals()+0x2c
V [libjvm.dylib+0x7d6518] Threads::create_vm(JavaVMInitArgs*, bool*)+0x228
V [libjvm.dylib+0x43407c] JNI_CreateJavaVM+0x74
C [libjli.dylib+0x8950] JavaMain+0x100
C [libjli.dylib+0xb988] ThreadJavaMain+0xc
C [libsystem_pthread.dylib+0x7034] _pthread_start+0x88

siginfo: si_signo: 10 (SIGBUS), si_code: 1 (BUS_ADRALN), si_addr: 0x0000000112304000

对于AMFI,应该使用此命令来代替上面的参数填入:sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool true

2023年12月1日 星期五

macOS允许某个用户在不输入密码(免密码root执行)的情况下用root身份执行特定的命令.

下面以我lanyun用户,命令spoof为例

1
2
3
4
5
which spoof 
sudo vim /etc/sudoers

lanyun ALL = (ALL) NOPASSWD: /opt/homebrew/bin/spoof

2023年11月8日 星期三

推荐一个适用于 macOS 的二进制授权和监控系统 Santa,Google开发,专制流氓.

快速删除一堆小文件(文件数量多):

1
2
3
4
5
tmp=$(python3 -c "from uuid import uuid4;print(uuid4())")
tmp_dir="$(dirname "$(pwd)")/tmp-${tmp}"
mkdir -p "${tmp_dir}"
rsync --delete-before -d "${tmp_dir}/" ./
rm -rf "${tmp_dir}"

如果是大文件,先用 truncate -s 0 <FILE> 把大小置为 0 再删除.

修复问题: 现在不能打开“废纸篓”,因为它正用于其他用途 下面代码可能没用.

1
2
3
4
location="$HOME" 
mkdir -p "${location}/.Trash"
shopt -s dotglob; sudo chflags -R noschg,nouchg "${location}/.Trash"; sudo rm -rf "${location}/.Trash/*"

禁用 mds_stores:

mdsSpotlight的一部分.也就是你按 Command (⌘) + 空格 弹出来的那个东西.它为所有文件建立索引,以便在你要搜索文件的时候快速的找到你想要的东西.因为我用基本上用Scherlokk而不用Spotlight,而且苹果这玩意不仅吃CPU和内存,还狠狠地吃硬盘I/O,硬盘寿命—–

  • 在终端中输入 sudo mdutil -a -i off 即可禁用索引.然后去硬盘根目录删除隐藏文件夹.Spotlight-V100(内置硬盘,应该在~下).排除索引: 设置 -> Siri与聚焦 -> 聚焦隐私
  • 若想恢复索引,需要在终端中输入 sudo mdutil -a -i on

2023年10月26日 星期四

在macOS上禁用(毒瘤+垃圾)软件:WeChat、QQ的部分日志目录权限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

cd ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Caches/com.tencent.xinWeChat/2.0b4.0.9
sudo chown root:wheel ./log
sudo chmod 400 log

cd ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Containers/com.tencent.xinWeChat/Data/Library/Caches/com.tencent.xinWeChat/2.0b4.0.9
sudo chown root:wheel ./log
sudo chmod 400 log

cd ~/Library/Containers/com.tencent.xinWeChat/Data/.wxapplet
sudo chown root:wheel ./xlog
sudo chmod 400 xlog


cd ~/Library/Containers/com.tencent.qq/Data/Library/Application\ Support/QQ/global/nt_data
sudo chown root:wheel ./Log
sudo chmod 400 Log

cd ~/Library/Containers/com.tencent.qq/Data/Library/Application\ Support/QQ

sudo chown root:wheel ./log
sudo chmod 400 log
sudo chown root:wheel ./log-cache
sudo chmod 400 log-cache



user=$(whoami)
log_path=(
"/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Logs"
"/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/global/nt_data/Log"
"/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/log"

"/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/Session Storage"
"/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/Local Storage"
)
target_dir="/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ"
sub_dir=$(find "${target_dir}" -maxdepth 1 -mindepth 1 -type d -name "nt_qq*")
for subdir in "${sub_dir[@]}"; do
log_path+=("${subdir}/nt_data/log")
log_path+=("${subdir}/nt_data/log-cache")
done

target_dir="/Users/${user}/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/Partitions"
sub_dir=$(find "${target_dir}" -maxdepth 1 -mindepth 1 -type d -name "qqnt*")
for subdir in "${sub_dir[@]}"; do
log_path+=("${subdir}/shared_proto_db")
log_path+=("${subdir}/Session Storage")
log_path+=("${subdir}/Local Storage")
done

sudo rm -rf "${log_path[@]}"
sudo touch "${log_path[@]}"
sudo chmod 000 "${log_path[@]}"

顺便删除截图插件

1
2
3
4
5
6
7
8
9
10
11
12
13
ban_path=(
"/Applications/QQ.app/Contents/Resources/app/QQ ScreenCapture plugin.app"

)
rm -rf "${ban_path[@]}"
sudo touch "${ban_path[@]}"
sudo chmod 000 "${ban_path[@]}"



sudo rm -rf /Applications/QQ.app/Contents/Resources/app/QQ截屏插件.app
sudo chown root:wheel /Applications/QQ.app/Contents/Resources/app/ScreenCaptureAgent.framework/Versions/A/Resources
sudo chmod 400 /Applications/QQ.app/Contents/Resources/app/ScreenCaptureAgent.framework/Versions/A/Resources

2023年10月24日 星期二

iptables IP阻断

单个IP的命令是

iptables -I INPUT -s 59.151.119.180 -j DROP

封IP段的命令是

iptables -I INPUT -s 211.1.0.0/16 -j DROP

iptables -I INPUT -s 211.2.0.0/16 -j DROP

iptables -I INPUT -s 211.3.0.0/16 -j DROP

封整个段的命令是

iptables -I INPUT -s 211.0.0.0/8 -j DROP

封几个段的命令是

iptables -I INPUT -s 61.37.80.0/24 -j DROP

iptables -I INPUT -s 61.37.81.0/24 -j DROP

iptables -I INPUT -s 211.1.0.0/16 -j DROP

解封:

iptables -L INPUT

iptables -L –line-numbers 然后iptables -D INPUT 序号

iptables 限制ip访问

通过iptables限制9889端口的访问(只允许192.168.1.201、192.168.1.202、192.168.1.203),其他ip都禁止访问

iptables -I INPUT -p tcp –dport 9889 -j DROP

iptables -I INPUT -s 192.168.1.201 -p tcp –dport 9889 -j ACCEPT

iptables -I INPUT -s 192.168.1.202 -p tcp –dport 9889 -j ACCEPT

iptables -I INPUT -s 192.168.1.203 -p tcp –dport 9889 -j ACCEPT

注意命令的顺序不能反了。

列出 INPUT链 所有的规则:iptables -L INPUT –line-numbers

删除某条规则,其中5代表序号(序号可用上面的命令查看):iptables -D INPUT 5

开放指定的端口:iptables -A INPUT -p tcp –dport 80 -j ACCEPT

禁止指定的端口:iptables -A INPUT -p tcp –dport 22 -j DROP

拒绝所有的端口:iptables -A INPUT -j DROP

2023年9月29日 星期五

Windows RDP远程桌面无密码账户 连接发生报错:

ERRCONNECT_ACCOUNT_RESTRICTION(Ox00000017)

解决: 开始 — 运行(win+R) — secpol.msc — 安全设置 — 本地策略 — 安全选项 — 帐户:使用空密码的本地帐户只允许… — 双击 — 选择 “已禁用”

2023年9月20日 星期三

杂记:

/Users/$USER/Library/Preferences/w3access

~/Library/Preferences/w3access

增加一项公开云端存储方案–IPFS

2023年8月20日 星期日

macOS在关sip下装crack的ios应用

关闭库验证

sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool true

arm64e第三方调试

sudo nvram boot-args=”-arm64e_preview_abi”

查看ssv状态

csrutil authenticated-root status

如果开启,恢复模式进去status换disable进行关闭

2023年8月9日 星期三

mac的sed真JB难用,特么我想用sed命令在某行之后添加一些内容,需要换行,网上看一圈都是用的单引号,但是单引号没法弄变量,我脚本中行数不是固定的,需要动态获取,看了又看stackoverflow和sed官方文档,属实给我整晕了.🧠直接宕机.(不过总算是解决了.原创原理不解释了.真tm复杂)

给2个典型,能用就行,想弄明白下面参考链接🔗

先说单引号.

1
2
3
4
5
6
echo "lan,yun,dev,com" | sed $'s/,/\\\n/g'

lan
yun
dev
com

前面加个$,然后\\\n就是换行了

双引号(这里直接借用https://stackoverflow.com/a/6111851).

1
2
3
4
5
echo test1234foo123bar1234 | sed "s/\(1234\)/\\`echo -e '\n\r'`\1/g"

test
1234foo123bar
1234

然后在这里浅浅说一下如果用sed a\附加命令又用到双引号该怎么操作.

1
2
3
4
sed -i '' -e "${tmp_line}a\\
内容1 \\
内容2 \\
" "${DestDir}/文件"

(没错,用的是\\来表示换行,是不是很神奇?用两个反斜杠表示一个反斜杠,我的评价是Mac版的sed逻辑真nm傻*逼.)

参考链接🔗: 关于流编辑器 sed 的常见问题 regex - Insert linefeed in sed (Mac OS X) - Stack Overflow

linux - \n is not working on the MacOS shell with sed - Stack Overflow regex - Replace newline with string in sed on mac - Stack Overflow sed Man Page - macOS - SS64.com 如何在 MacOS 上使用 sed 添加新行? - 堆栈溢出

更多的就不整了,看完你应该懂了吧?

git grep -I --name-only -z -l $'\r' | xargs -0 sed -i '' $'s/\r$//'

查找所有包含Windows风格换行符的文件,并将这些文件中的回车符\r替换为空字符串,从而将其转换为Unix风格的换行符\n

2023年8月4日 星期五

为新版macOS的sudo提供指纹touch ID支持.

先看看ls /etc/pam.d/下有没有sudo_local.template

有的话,直接注释掉第3行内容

image-20230804230532517

没有的话(或者不生效的话),直接命令

1
sudo sed -i ".bak" '2s/^/auth       sufficient     pam_tid.so\'$'\n/g' /etc/pam.d/sudo

✅解决!

2023年4月24日 星期一

修复 macOS 微信文件变成只读.文章

1
2
3
find "${HOME}/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat" -type f -path '*/*/Message/MessageTemp/*/File/*' -exec chmod 644 {} \;

find "$HOME/Library/Containers/com.tencent.xinWeChat/Data/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat" -type f -path '*/*/Message/MessageTemp/*/File/*' -exec chmod 644 {} \;

2023年3月25日 星期六

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pm2 start xxxx

查看log
pm2 log xxxx

xxxxx在重启后自动运行:
只需运行此命令以生成一个活动的启动脚本:
pm2 startup
并冻结自动重生的进程列表:
pm2 save

更新 PM2
我们让它变得简单,版本之间没有重大变化,过程很简单:
npm install pm2@latest -g
然后更新内存中的 PM2 :
pm2 update

pm2 list

pm2文档: https://pm2.keymetrics.io/docs/usage/quick-start/

2023年3月22日 星期三

1
2
3
4
5
6
7
8
9
10
screen -S blog 
screen -ls
screen -r
screen -wipe






2022年12月6日 星期二

Windows挂载WebDAV

发生系统错误 67。 找不到网络名。

services.msc

在服务中打开WebClient服务即可

同时允许HTTP与HTTPS:

打开注册表编辑器,定位到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters,修改键BasicAuthLevel值为2

接触50MB文件大小限制:

打开注册表编辑器,定位到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters,修改键FileSizeLimitInBytes值为适当大小

2022年7月2日 星期六

python更新所有库

pip3 install pip-review

pip-review –local –interactive

输入A,全部更新

gdb使用:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

$ gdb {file}
-cd:设置工作目录;
-q:安静模式,不打印介绍信息和版本信息;
-d:添加文件查找路径;
-x:从指定文件中执行GDB指令;
-s:设置读取的符号表文件。

file {file}


r


c


l


b <行号>
b <函数名称>
b *<函数名称>
b *<代码地址> d [编号]
b +/-offset
tbreak
rbreak regex


i b



d 断点序号


stack <行数>


n
s


ni
si


p <value>


q


h


disass


x/i
x/s
x/b






gdb --args 命令行+参数等


bt
bt n
bt -n
bt full
bt full n
bt full -n

2022年5月27日 星期五

初学者指南远离 scanf()

2022年5月16日 星期一

昨天某人打我电话,原来是叫我玩约战重置版本,作为一名小小的股东,我懂,又要钱钱💰了嘛.

IMG_3889

2022年5月13日 星期五

硬盘盒和硬盘都到货啦~赶紧格式化测个速.

image-20220513170641189

个人感觉非常不错!速度达到了雷电3的理论最高数据层传输速度.

2022年5月11日 星期三

设计并买了固态硬盘2T,采用的方案是 USB4.0硬盘盒NVMe M.2选用品牌为绿联 + PCIE4.0协议2T固态硬盘选用品牌为希捷

硬盘花费软妹币: 2182元 硬盘盒 798元 ,合计🟰: 2,980 元.

目前就等到货了…预计能跑到雷电3的数据层的最高速度,因为USB4.0硬盘盒其实也是用的雷电3主控芯片,那我为什么不买雷电3硬盘盒呢?

因为雷电3硬盘盒用的是Intel JHL6340主控芯片,USB-C接口只支持雷电3且不向下兼容USB 3.2、3.1、3.0、2.0;而新款USB 4.0硬盘盒用的是Intel JHL7440主控芯片,USB-C接口不仅支持雷电3且向下兼容USB 3.2、3.1、3.0(不兼容USB 2.0),兼容USB协议最高支持10Gbps(USB 3.2 Gen 2).

Intel JHL6340单链(Single)DP 1.2输出,功率:1.7W。Intel JHL7440双链(Dual)DP 1.4输出,功率:2.4W。两款雷电3芯片的物理传输数据的总带宽均为:22 Gbps ,但是根据数据测试,USB4.0硬盘盒JHL7440)的读写速度明显是要比雷电3硬盘盒JHL6340)的读写速度更快一些.

而且选择**PCIe 4.0 x4 SSD(Gen 4 NVMe SSD)**能让这个固态硬盘毫无余力地发挥雷电接口的最高数据传输速度.

综上,目前方案最适合我这种追求高速读写的传输速度的用户.就是钱包在燃烧🔥…🥹

2022年4月27日 星期三

记录📝一下Hacking Tools

记录📝一下BinWalk安装和命令参数详解.

记录📝一下压缩包破解字符集爆破:

fcrackzip是一个部分用汇编程序编写的快速密码破解程序。它能够通过暴力破解或基于字典的攻击破解受密码保护的 zip 文件,还可以选择使用解压缩结果进行测试。它还可以破解 cpmask 的图像。
命令:fcrackzip -v -b -u -l 1-10 -c1 xxx.zip
解释:-b 暴力破解模式 -c 指定掩码类型(-c1=纯数字,-c2=纯字母,-c3=数字字母混合模式(a=a-z;1=0-9;!=特殊字符)) -l 指定密码长度 -u 压缩文件名

kali自带的帮助文档基本是英文的,用Google给翻译了一下,可能不太准确,凑合和看吧!

[-b–蛮力] 使用暴力破解

[-d–字典] 使用字典破解

[-B–基准] 执行一个小基准

[-c–charset characterset] 指定字符类型(数字,字母,混合等)

[-h–帮助] 显示帮助文档

[–version] 显示此程序的版本

[-v–validate] 健全性检查Algortihm

[-v–verbose] 更详细

[-p–init password string] 指定开始字符(比如要只记得密码是2开头的4位纯数字,可以指定从2000开始破解,提升效率)

[-l–length min max] 指定密码长度区间

[-u–使用unzip] 使用unzip清除错误的密码

[-m–方法编号] 使用方法编号“num”(见下文)

[-2–modulo r/m] 仅计算密码的1/m

rarcrack
此程序使用暴力算法来猜测加密压缩文件的密码。
此程序可以破解zip、7z和rar文件密码。
用法: rarcrack encrypted_archive.ext [–threads NUM] [–type rar|zip|7z]
选项:–help:显示这个屏幕。
–type:你可以指定存档程序,当程序无法检测到合适的文件类型时,需要这样做。
–threads: 你可以指定运行多少个线程,最多12个(默认:2个)。

John the Ripper免费的开源软件,是一个快速的密码破解工具,用于在已知密文的情况下尝试破解出明文的破解密码软件,支持目前大多数的加密算法,如DES、MD4、MD5等。它支持多种不同类型的系统架构,包括Unix、Linux、Windows、DOS模式、BeOS和OpenVMS,主要目的是破解不够牢固的Unix/Linux系统密码。目前的最新版本是John the Ripper 1.8.0版,针对Windows平台的最新免费版为John the Ripper 1.7.9版。

参考它的help

John the Ripper 1.9.0-jumbo-1+bleeding-aec1328d6c 2021-11-02 10:45:52 +0100 OMP [linux-gnu 64-bit aarch64 ASIMD AC]
Copyright (c) 1996-2021 by Solar Designer and others
Homepage: https://www.openwall.com/john/

Usage: john [OPTIONS] [PASSWORD-FILES]

–help Print usage summary
–single[=SECTION[,..]] “Single crack” mode, using default or named rules
–single=:rule[,..] Same, using “immediate” rule(s)
–single-seed=WORD[,WORD] Add static seed word(s) for all salts in single mode
–single-wordlist=FILE Short wordlist with static seed words/morphemes
–single-user-seed=FILE Wordlist with seeds per username (user:password[s]
format)
–single-pair-max=N Override max. number of word pairs generated (6)
–no-single-pair Disable single word pair generation
–[no-]single-retest-guess Override config for SingleRetestGuess
–wordlist[=FILE] –stdin Wordlist mode, read words from FILE or stdin
–pipe like –stdin, but bulk reads, and allows rules
–rules[=SECTION[,..]] Enable word mangling rules (for wordlist or PRINCE
modes), using default or named rules
–rules=:rule[;..]] Same, using “immediate” rule(s)
–rules-stack=SECTION[,..] Stacked rules, applied after regular rules or to
modes that otherwise don’t support rules
–rules-stack=:rule[;..] Same, using “immediate” rule(s)
–rules-skip-nop Skip any NOP “:” rules (you already ran w/o rules)
–loopback[=FILE] Like –wordlist, but extract words from a .pot file
–mem-file-size=SIZE Size threshold for wordlist preload (default 2048 MB)
–dupe-suppression Suppress all dupes in wordlist (and force preload)
–incremental[=MODE] “Incremental” mode [using section MODE]
–incremental-charcount=N Override CharCount for incremental mode
–external=MODE External mode or word filter
–mask[=MASK] Mask mode using MASK (or default from john.conf)
–markov[=OPTIONS] “Markov” mode (see doc/MARKOV)
–mkv-stats=FILE “Markov” stats file
–prince[=FILE] PRINCE mode, read words from FILE
–prince-loopback[=FILE] Fetch words from a .pot file
–prince-elem-cnt-min=N Minimum number of elements per chain (1)
–prince-elem-cnt-max=[-]N Maximum number of elements per chain (negative N is
relative to word length) (8)
–prince-skip=N Initial skip
–prince-limit=N Limit number of candidates generated
–prince-wl-dist-len Calculate length distribution from wordlist
–prince-wl-max=N Load only N words from input wordlist
–prince-case-permute Permute case of first letter
–prince-mmap Memory-map infile (not available with case permute)
–prince-keyspace Just show total keyspace that would be produced
(disregarding skip and limit)
–subsets[=CHARSET] “Subsets” mode (see doc/SUBSETS)
–subsets-required=N The N first characters of “subsets” charset are
the “required set”
–subsets-min-diff=N Minimum unique characters in subset
–subsets-max-diff=[-]N Maximum unique characters in subset (negative N is
relative to word length)
–subsets-prefer-short Prefer shorter candidates over smaller subsets
–subsets-prefer-small Prefer smaller subsets over shorter candidates
–make-charset=FILE Make a charset, FILE will be overwritten
–stdout[=LENGTH] Just output candidate passwords [cut at LENGTH]
–session=NAME Give a new session the NAME
–status[=NAME] Print status of a session [called NAME]
–restore[=NAME] Restore an interrupted session [called NAME]
–[no-]crack-status Emit a status line whenever a password is cracked
–progress-every=N Emit a status line every N seconds
–show[=left] Show cracked passwords [if =left, then uncracked]
–show=formats Show information about hashes in a file (JSON)
–show=invalid Show lines that are not valid for selected format(s)
–test[=TIME] Run tests and benchmarks for TIME seconds each
(if TIME is explicitly 0, test w/o benchmark)
–stress-test[=TIME] Loop self tests forever
–test-full=LEVEL Run more thorough self-tests
–no-mask Used with –test for alternate benchmark w/o mask
–skip-self-tests Skip self tests
–users=[-]LOGIN|UID[,..] [Do not] load this (these) user(s) only
–groups=[-]GID[,..] Load users [not] of this (these) group(s) only
–shells=[-]SHELL[,..] Load users with[out] this (these) shell(s) only
–salts=[-]COUNT[:MAX] Load salts with[out] COUNT [to MAX] hashes, or
–salts=#M[-N] Load M [to N] most populated salts
–costs=[-]C[:M][,…] Load salts with[out] cost value Cn [to Mn]. For
tunable cost parameters, see doc/OPTIONS
–fork=N Fork N processes
–node=MIN[-MAX]/TOTAL This node’s number range out of TOTAL count
–save-memory=LEVEL Enable memory saving, at LEVEL 1..3
–log-stderr Log to screen instead of file
–verbosity=N Change verbosity (1-5 or 6 for debug, default 3)
–no-log Disables creation and writing to john.log file
–bare-always-valid=Y Treat bare hashes as valid (Y/N)
–catch-up=NAME Catch up with existing (paused) session NAME
–config=FILE Use FILE instead of john.conf or john.ini
–encoding=NAME Input encoding (eg. UTF-8, ISO-8859-1). See also
doc/ENCODINGS.
–input-encoding=NAME Input encoding (alias for –encoding)
–internal-codepage=NAME Codepage used in rules/masks (see doc/ENCODINGS)
–target-encoding=NAME Output encoding (used by format)
–force-tty Set up terminal for reading keystrokes even if we’re
not the foreground process
–field-separator-char=C Use ‘C’ instead of the ‘:’ in input and pot files
–[no-]keep-guessing Try finding plaintext collisions
–list=WHAT List capabilities, see –list=help or doc/OPTIONS
–length=N Shortcut for –min-len=N –max-len=N
–min-length=N Request a minimum candidate length in bytes
–max-length=N Request a maximum candidate length in bytes
–max-candidates=[-]N Gracefully exit after this many candidates tried.
(if negative, reset count on each crack)
–max-run-time=[-]N Gracefully exit after this many seconds (if negative,
reset timer on each crack)
–mkpc=N Request a lower max. keys per crypt
–no-loader-dupecheck Disable the dupe checking when loading hashes
–pot=NAME Pot file to use
–regen-lost-salts=N Brute force unknown salts (see doc/OPTIONS)
–reject-printable Reject printable binaries
–tune=HOW Tuning options (auto/report/N)
–subformat=FORMAT Pick a benchmark format for –format=crypt
–format=[NAME|CLASS][,..] Force hash of type NAME. The supported formats can
be seen with –list=formats and –list=subformats.
See also doc/OPTIONS for more advanced selection of
format(s), including using classes and wildcards.

2022年4月26日 星期二

记录📝一下ddos攻击 ```hping3 -i u1 -S -p80 xxx.xx.x.x``

hping3用来干嘛?
防火墙测试
实用的端口扫描
网络检测,可以用不同的协议、服务类型(TOS)、IP分片
手工探测MTU(最大传输单元)路径
先进的路由跟踪,支持所有的协议
远程操作系统探测
远程的运行时间探测
TCP/IP堆栈审计
使用hping3进行DDoS攻击:

1
hping3 -c 5000 -d 150 -S -w 64 -p 80 --flood --rand-source xxx 

-c:发送数据包的个数 -d:每个数据包的大小. -S:发送SYN数据包
-w:TCP window大小 -p:目标端口,你可以指定任意端口 –flood:尽可能快的发送数据包

-H –help 显示帮助。
-v -VERSION 版本信息。
-c –count count 发送数据包的次数 关于countreached_timeout 可以在hping2.h里编辑。
-i –interval 包发送间隔时间(单位是毫秒)缺省时间是1秒,此功能在增加传输率上很重要,在idle/spoofing扫描时此功能也会被用到,你可以参考hping-howto获得更多信息-fast 每秒发10个数据包。
-n -nmeric 数字输出,象征性输出主机地址。
-q -quiet 退出。
-I –interface interface name 无非就是eth0之类的参数。
-v –verbose 显示很多信息,TCP回应一般如:len=46 ip=192.168.1.1 flags=RADF seq=0 ttl=255 id=0 win=0 rtt=0.4ms tos=0 iplen=40 seq=0 ack=1380893504 sum=2010 urp=0
-D –debug 进入debug模式当你遇到麻烦时,比如用HPING遇到一些不合你习惯的时候,你可以用此模式修改HPING,(INTERFACE DETECTION,DATA LINK LAYER ACCESS,INTERFACE SETTINGS,…….)
-z –bind 快捷键的使用。
-Z –unbind 消除快捷键。
-O –rawip RAWIP模式,在此模式下HPING会发送带数据的IP头。
-1 –icmp ICMP模式,此模式下HPING会发送IGMP应答报,你可以用–ICMPTYPE –ICMPCODE选项发送其他类型/模式的ICMP报文。
-2 –udp UDP 模式,缺省下,HPING会发送UDP报文到主机的0端口,你可以用–baseport –destport –keep选项指定其模式。
-9 –listen signatuer hping的listen模式,用此模式,HPING会接收指定的数据。
-a –spoof hostname 伪造IP攻击,防火墙就不会记录你的真实IP了,当然回应的包你也接收不到了。
-t –ttl time to live 可以指定发出包的TTL值。
-H –ipproto 在RAW IP模式里选择IP协议。
-w –WINID UNIX ,WINDIWS的id回应不同的,这选项可以让你的ID回应和WINDOWS一样。
-r –rel 更改ID的,可以让ID曾递减输出,详见HPING-HOWTO。
-F –FRAG 更改包的FRAG,这可以测试对方对于包碎片的处理能力,缺省的“virtual mtu”是16字节。
-x –morefrag 此功能可以发送碎片使主机忙于恢复碎片而造成主机的拒绝服务。
-y -dontfrag 发送不可恢复的IP碎片,这可以让你了解更多的MTU PATH DISCOVERY。
-G –fragoff fragment offset value set the fragment offset
-m –mtu mtu value 用此项后ID数值变得很大,50000没指定此项时3000-20000左右。
-G –rroute 记录路由,可以看到详悉的数据等等,最多可以经过9个路由,即使主机屏蔽了ICMP报文。
-C –ICMPTYPE type 指定ICMP类型,缺省是ICMP echo REQUEST。
-K –ICMPCODE CODE 指定ICMP代号,缺省0。
–icmp-ipver 把IP版本也插入IP头。
–icmp-iphlen 设置IP头的长度,缺省为5(32字节)。
–icmp-iplen 设置IP包长度。
–icmp-ipid 设置ICMP报文IP头的ID,缺省是RANDOM。
–icmp-ipproto 设置协议的,缺省是TCP。
-icmp-cksum 设置校验和。
-icmp-ts alias for –icmptype 13 (to send ICMP timestamp requests)
–icmp-addr Alias for –icmptype 17 (to send ICMP address mask requests)
-s –baseport source port hping 用源端口猜测回应的包,它从一个基本端口计数,每收一个包,端口也加1,这规则你可以自己定义。
-p –deskport [+][+]desk port 设置目标端口,缺省为0,一个加号设置为:每发送一个请求包到达后,端口加1,两个加号为:每发一个包,端口数加1。
–keep 上面说过了。
-w –win 发的大小和windows一样大,64BYTE。
-O –tcpoff Set fake tcp data offset. Normal data offset is tcphdrlen / 4.
-m –tcpseq 设置TCP序列数。
-l –tcpck 设置TCP ack。
-Q –seqnum 搜集序列号的,这对于你分析TCP序列号有很大作用。

参考Linux hping3 命令详解:测试网络及主机的安全