Skip to content

Commit 8f4d30b

Browse files
committed
update
1 parent 825a2fd commit 8f4d30b

File tree

6 files changed

+170
-5
lines changed

6 files changed

+170
-5
lines changed

README.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ADoyle 的碎片化知识笔记。https://til.adoyle.me
3939

4040
## 版权声明
4141

42-
Copyright 2016-2024 ADoyle ([email protected]). Some Rights Reserved.
42+
Copyright 2016-2025 ADoyle ([email protected]). Some Rights Reserved.
4343
The project is licensed under the **BSD 3-clause License**.
4444

4545
Read the [LICENSE](./LICENSE) file for the specific language governing permissions and limitations under the License.
@@ -245,6 +245,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
245245
- [`<script async>``<script defer>`](front-end/async-defer-script-dom.md)
246246
- [圆角的玩法](front-end/border-radius-tricks.md)
247247
- [Chrome 浏览器 DNS 解析](front-end/chrome-dns-resolver.md)
248+
- [Chrome Stalled 请求](front-end/chrome-stalled-requests.md)
248249
- [Safari 浏览器的类继承 Bug](front-end/class-extend-bug-in-safari.md)
249250
- [代码分离](front-end/code-split.md)
250251
- [颜色对比度](front-end/color-contrast.md)
@@ -295,6 +296,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
295296
## Git
296297

297298
- [用 shell 脚本查询 git commit hash](git/a-shell-script-to-get-current-commit-hash.md)
299+
- [Connection closed by UNKNOWN port 65535](git/connection-closed-by-unknown-port-65535.md)
298300
- [Git Diff](git/diff.md)
299301
- [Git 学习资料](git/git-books.md)
300302
- [git ssh 代理](git/git-ssh-proxy.md)
@@ -555,6 +557,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
555557
- [用别的用户运行命令](linux/run-command-with-different-user.md)
556558
- [runit](linux/runit.md)
557559
- [SATA 热拔插](linux/sata-hotplug.md)
560+
- [scp: Connection closed](linux/scp-failure.md)
558561
- [程序的退出码 (Exit Code)](linux/script-exit-code.md)
559562
- [sed](linux/sed.md)
560563
- [在 alpine 中找不到 setup-apkcache 等 setup-* 命令](linux/setup-scripts-in-alpine.md)
@@ -767,20 +770,27 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
767770
- [adguard home](others/adguard-home.md)
768771
- [在梅林固件路由器里安装 AdGuard Home](others/adguardhome-in-asuswrt-merlin-device.md)
769772
- [Alfred Workflow debug 技巧](others/alfred-workflow-debug.md)
773+
- [aliyun cli](others/aliyun-cli.md)
770774
- [永久链接](others/archive-webpage.md)
771775
- [在 Alpine docker 容器里启动 aria2](others/aria2-in-alpine-docker.md)
772776
- [aria2](others/aria2.md)
773777
- [ASCII 与 ANSI](others/ascii-and-ansi.md)
774778
- [梅林固件 asuswrt-merlin](others/asuswrt-merlin.md)
775779
- [脱字符 (caret)](others/caret.md)
776780
- [Chrome 小技巧](others/chrome-tricks.md)
781+
- [cloudflare 缓存](others/cloudflare-cache.md)
782+
- [托管域名到 Cloudflare](others/cloudflare-hosting.md)
783+
- [cloudflare proxy](others/cloudflare-proxy.md)
784+
- [一个复杂的小 bug: cd 补全问题](others/complex-and-small-bug-with-cd.md)
777785
- [复制粘贴好过手写](others/copy-paste-better-than-handwriting.md)
786+
- [curl 快速失败](others/curl-fail-fast.md)
778787
- [Mac 文件系统的剪切快捷键](others/cut-in-mac-file-system.md)
779788
- [数据恢复工具](others/data-recovery-tool.md)
780789
- [YAML 中的 Date 类型陷阱](others/date-trap-in-yaml.md)
781790
- [MacOS 彻底删除搜狗输入法](others/delete-sogou-input-in-macos.md)
782791
- [dropbear](others/dropbear.md)
783792
- [Duplicati](others/duplicati.md)
793+
- [editorconfig](others/editorconfig.md)
784794
- [在浏览器里启动 DoH](others/enable-doh-in-browser.md)
785795
- [文件命名,下划线还是中划线?](others/file-naming-with-underscores-and-dashes.md)
786796
- [fonts.googleapis.com 不可访问](others/fonts.googleapis.com-is-inaccessible.md)
@@ -811,6 +821,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
811821
- [原码, 反码, 补码](others/one_complement-and-two_complement.md)
812822
- [如何打开超大文件](others/open-huge-file-with-editor.md)
813823
- [Ubnt EdgeRouter X (er-x) 刷 OpenWRT](others/openwrt-with-ubnt-edgerouter-x.md)
824+
- [POST /cdn-cgi/rum](others/post-request-cdn-cgi-rum.md)
814825
- [Protocol Buffers](others/protocal-buffers.md)
815826
- [在美区 app store 充值](others/recharge-app-store-in-US.md)
816827
- [正则表达式的小技巧](others/regexp-tricks.md)
@@ -828,6 +839,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
828839
- [时间回跳问题](others/time-backward-issue.md)
829840
- [Dockerfile 里使用 tini](others/tini-in-dockerfile.md)
830841
- [tmux 环境变量](others/tmux-environment-variable.md)
842+
- [umami.is 网站被反广告规则屏蔽](others/umami-is-blocked.md)
831843
- [usbipd 与 Windows WSL](others/usbipd-windows-wsl.md)
832844
- [UTF-8 vs UTF-16](others/utf-8-vs-utf-16.md)
833845
- [Vagrant DNS](others/vagrant-dns.md)
@@ -892,6 +904,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
892904
## 安全攻防
893905

894906
- [不要在生产环境绑定 0.0.0.0](security/do-not-bind-0.0.0.0.md)
907+
- [hashcat](security/hashcat.md)
895908
- [Kali Linux](security/kali.md)
896909
- [Reverse Shell](security/reverse-shell.md)
897910

@@ -915,7 +928,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
915928
- [Shell 操作文件描述符](shell/file-descriptor.md)
916929
- [刷新命令的路径缓存](shell/flush-cache-of-command-path.md)
917930
- [在 console 里滚屏翻页](shell/page-up-down-in-console.md)
918-
- [`printf '%s\n' $@` 为何可以打印多行?](shell/printf-array.md)
931+
- [printf 打印多行](shell/printf-array.md)
919932
- [Readline](shell/readline.md)
920933
- [学习 Shell](shell/shell-learning.md)
921934
- [Bash 的 subshell 与子进程](shell/subshell-and-child-process.md)

front-end/chrome-stalled-requests.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Chrome Stalled 请求
2+
3+
当打开 Chrome 开发者工具发现请求网页时一直卡在 stalled 状态。如何排查问题?
4+
5+
1. 关闭其他网页,进入隐身模式,只请求当前要排查的网页。
6+
2. 关闭浏览器进程。在终端以监听日志方式打开浏览器:`/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-logging --v=1`。访问网页,观察终端的日志输出。

security/hashcat.md

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# hashcat
2+
3+
## hashcat --help
4+
5+
`hashcat --help` 命令经常卡在 `hashcat (v6.2.6) starting in help mode`,要等很久才会打印出帮助文档。
6+
7+
`Usage: hashcat [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]...`
8+
9+
## 样例
10+
11+
暴力破解: `hashcat -a 3 -m 13000 --session=test --increment --increment-min 5 ./hashfile '?a?a?a?a?a?a?a'`
12+
13+
暴力破解: `hashcat -a 3 -m 13000 --session=test --increment --increment-min 5 --increment-min 8 ./hashfile --custom-charset1=?l?u?d ?1`
14+
15+
字典破解: `hashcat -a 0 -m 13000 --session=test ./hashfile ./dict/` (把多个字典都放在 ./dict 目录下。注意它不能递归查找,比如 ./dict/abc/ 目录下的字典就不会使用)
16+
17+
## hashfile 的格式
18+
19+
如果用 `rar2john` 会得到这样格式的结果:
20+
21+
`./hashfile:$rar5$16$8e7e3940fd955dd9ffb9c0ec5da84f84$15$9a9270cded7h0ab3bd097182724968c2$8$2ad570261d32c110`
22+
23+
但 hashcat 不需要前面的文件路径,你需要修改 hashfile 的内容,改成如下样子:
24+
25+
`$rar5$16$8e7e3940fd955dd9ffb9c0ec5da84f84$15$9a9270cded7h0ab3bd097182724968c2$8$2ad570261d32c110`
26+
27+
hashcat 才能正常识别 hashfile。
28+
29+
## Attack Modes
30+
31+
```
32+
-a 0 # Straight (Dictionary)
33+
-a 1 # Combination
34+
-a 3 # Brute-force
35+
-a 6 # Hybrid Wordlist + Mask
36+
-a 7 # Hybrid Mask + Wordlist
37+
-a 9 # Association
38+
```
39+
40+
## Built-in charsets
41+
42+
```
43+
?l = abcdefghijklmnopqrstuvwxyz
44+
?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ
45+
?d = 0123456789
46+
?h = 0123456789abcdef
47+
?H = 0123456789ABCDEF
48+
?s = «space»!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
49+
?a = ?l?u?d?s
50+
?b = 0x00 - 0xf f
51+
```
52+
53+
54+
## Apple's OpenCL drivers (GPU) are known to be unreliable
55+
56+
```
57+
* Device #2: Apple's OpenCL drivers (GPU) are known to be unreliable.
58+
You have been warned.
59+
```
60+
61+
通过 homebrew 安装的 hashcat 有问题。
62+
63+
### 解决方法
64+
65+
删除 homebrew 安装的 hashcat 。通过[源码编译](https://github.com/hashcat/hashcat/blob/master/BUILD.md#building-hashcat-for-linux-and-macos)
66+
67+
1. 执行 `mkdir -p ~/.cache/hashcat/kernels/`
68+
2. 执行 `hashcat -I`
69+
70+
```
71+
hashcat (v6.2.6) starting in backend information mode
72+
73+
Metal Info:
74+
===========
75+
76+
Metal.Version.: 343.21
77+
78+
Backend Device ID #1 (Alias: #2)
79+
Type...........: GPU
80+
Vendor.ID......: 2
81+
Vendor.........: Apple
82+
Name...........: Apple M3
83+
Processor(s)...: 10
84+
Clock..........: N/A
85+
Memory.Total...: 10922 MB (limited to 4096 MB allocatable in one block)
86+
Memory.Free....: 5408 MB
87+
Local.Memory...: 32 KB
88+
Phys.Location..: built-in
89+
Feature.Set....: macOS GPU Family 2 v1
90+
Registry.ID....: 1545
91+
Max.TX.Rate....: N/A
92+
GPU.Properties.: headless 0, low-power 0, removable 0
93+
94+
OpenCL Info:
95+
============
96+
97+
OpenCL Platform ID #1
98+
Vendor..: Apple
99+
Name....: Apple
100+
Version.: OpenCL 1.2 (Jun 28 2024 22:57:48)
101+
102+
Backend Device ID #2 (Alias: #1)
103+
Type...........: GPU
104+
Vendor.ID......: 2
105+
Vendor.........: Apple
106+
Name...........: Apple M3
107+
Version........: OpenCL 1.2
108+
Processor(s)...: 10
109+
Clock..........: 1000
110+
Memory.Total...: 10922 MB (limited to 1024 MB allocatable in one block)
111+
Memory.Free....: 5408 MB
112+
Local.Memory...: 32 KB
113+
OpenCL.Version.: OpenCL C 1.2
114+
Driver.Version.: 1.2 1.0
115+
```
116+

shell/bash-pitfalls.md

+5
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,8 @@ cleanup() {
251251
但是这只能解决这一种情况。当 `func-a || func-b` 这种格式下,func-a 内所有执行的函数都有可能报错,那要给每个执行都加上 `|| return` 吗?这显然不合理。
252252

253253
`func-a || func-b` 这种格式其实会经常用到,`func-b` 是一个容错处理函数。但是 bash 的语法机制又会导致这种错误。目前似乎无解!
254+
255+
## return 与 return 0 的区别
256+
257+
- `return`:返回上一个命令的退出状态码。
258+
- `return 0`:返回成功状态码 0,无论之前的命令是否成功。

shell/bash-tricks.md

+9
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,12 @@ https://stackoverflow.com/a/3427931/4622308
362362
- **`${var:+x}`** 只有当 `var` 被设置且不为空时,才会返回 `x`;否则返回空。
363363

364364
两者主要用于不同的场景:`${var+x}` 用于检测变量是否被设置,而 `${var:+x}` 用于检测变量是否既被设置又有值。
365+
366+
## 定位函数在哪个文件定义的
367+
368+
在函数定义之前执行 `shopt -s extdebug`。或者启动 bash 时加参数 `--debugger`: `bash --debugger`
369+
然后使用 `deflare -F function_name` 就能打印文件位置。
370+
371+
详见 https://unix.stackexchange.com/a/322887
372+
373+
变量没法这样用。
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
# permission denied for schema public
22

3-
当 Postgres 从 14 升级到 15 后,大概率会遇到这个错误。这是因为在 PG 15 中,只要不是 pg_database_owner 中指定的用户,包超级用户在内都不能在默认的 schema public 中创建对象。
3+
当 Postgres 从 14 升级到 15 后,大概率会遇到这个错误。这是因为在 PG 15 中,只要不是超级用户或者 pg_database_owner 中指定的用户,都不能在默认的 schema public 中创建对象。这是 PG 为了督促用户控制权限的精细度,提高安全性
44

5-
解决方法是给用户创建一个用户模式。
5+
具体请看官方文档的 [secure schema usage](https://www.postgresql.org/docs/17/ddl-schemas.html#DDL-SCHEMAS-PATTERNS) 以及 [Connecting to the Database Server](https://www.postgresql.org/docs/17/ecpg-connect.html#ECPG-CONNECTING)
6+
7+
有两种解决方法:
8+
9+
## 给用户创建新的 Schema
10+
11+
推荐这种方法。
612

713
1. 登录到对应的数据库。
8-
2. 执行命令 `CREATE SCHEMA AUTHORIZATION user1;` 将会创建与用户名同名的 schema。
14+
2. 执行命令 `CREATE SCHEMA AUTHORIZATION user1;` 将会创建与用户同名的 schema,并授权该用户访问。
15+
16+
程序连接数据库时,在 DATABASE_URL 中使用 `options=-c search_path=myschema` 来指定当前会话的默认 schema。
17+
18+
`DATABASE_URL=postgresql://user:password@host:port/database?options=-c%20search_path%3Dmyschema`
19+
20+
## 给用户授予权限
21+
22+
`GRANT ALL ON SCHEMA public TO user1;`
23+
24+
不推荐这种方法。仅限个别场景中使用。

0 commit comments

Comments
 (0)