SunBK201 / UA3F

Implementation of the new generation of HTTP User-Agent modification methodology.
https://blog.sunbk201.site/posts/ua3f/
GNU General Public License v3.0
127 stars 6 forks source link

使用luci或service启动ua3f无法正常工作 #13

Open Haocen2004 opened 3 weeks ago

Haocen2004 commented 3 weeks ago

RT 使用luci启动时日志显示偶尔有链接 但打不开国内网站 使用了ua3f-global-enhance.yaml配置 使用service启动也是无法打开国内网站 日志差不多

[2024-06-06 15:27:44][INFO]: UA3F v0.4.0
[2024-06-06 15:27:44][INFO]: Port: 1080
[2024-06-06 15:27:44][INFO]: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
[2024-06-06 15:27:44][INFO]: Log level: debug
[2024-06-06 15:27:44][INFO]: Listen on 127.0.0.1:1080
[2024-06-06 15:27:44][DEBUG]: Accept 127.0.0.1:54882
[2024-06-06 15:27:44][DEBUG]: Accept 127.0.0.1:54890
[2024-06-06 15:27:44][DEBUG]: Connecting www.bilibili.com:443
[2024-06-06 15:27:44][DEBUG]: Connecting www.bilibili.com:443
[2024-06-06 15:27:44][DEBUG]: Accept 127.0.0.1:54896
[2024-06-06 15:27:44][DEBUG]: Connecting i0.hdslb.com:443
[2024-06-06 15:27:44][DEBUG]: Accept 127.0.0.1:54900
[2024-06-06 15:27:44][DEBUG]: Connecting www.bilibili.com:443
[2024-06-06 15:27:44][DEBUG]: Accept 127.0.0.1:54910
[2024-06-06 15:27:44][DEBUG]: Connecting client.wns.windows.com:443

在切换至ssh链接并手动执行sudo -u nobody /usr/bin/ua3f后 可以正常使用并访问国内网站

root@N1:~# ua3f -l debug -f "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
[2024-06-06 15:30:15][INFO]: UA3F v0.4.0
[2024-06-06 15:30:15][INFO]: Port: 1080
[2024-06-06 15:30:15][INFO]: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
[2024-06-06 15:30:15][INFO]: Log level: debug
[2024-06-06 15:30:15][INFO]: Listen on 127.0.0.1:1080
[2024-06-06 15:30:15][DEBUG]: Accept 127.0.0.1:37152
[2024-06-06 15:30:15][DEBUG]: Connecting 58.83.177.124:1883
[2024-06-06 15:30:15][DEBUG]: Connected 58.83.177.124:1883
[2024-06-06 15:30:15][DEBUG]: Accept 127.0.0.1:37162
[2024-06-06 15:30:15][DEBUG]: Connecting www.baidu.com:443
[2024-06-06 15:30:15][DEBUG]: Connected www.baidu.com:443
[2024-06-06 15:30:15][DEBUG]: Accept 127.0.0.1:37170
[2024-06-06 15:30:15][DEBUG]: Connecting api2.mina.mi.com:443
[2024-06-06 15:30:15][DEBUG]: Connected api2.mina.mi.com:443
[2024-06-06 15:30:16][DEBUG]: Not HTTP, Hint: [22 3 1 2 0 1 0], Add LRU Relay Cache: www.baidu.com:443, Cache Len: 1
[2024-06-06 15:30:16][DEBUG]: Not HTTP, Hint: [22 3 1 2 0 1 0], Add LRU Relay Cache: api2.mina.mi.com:443, Cache Len: 2
[2024-06-06 15:30:16][DEBUG]: Accept 127.0.0.1:37186
[2024-06-06 15:30:16][DEBUG]: Connecting api2.mina.mi.com:443
[2024-06-06 15:30:16][DEBUG]: Connected api2.mina.mi.com:443
[2024-06-06 15:30:16][DEBUG]: Hit LRU Relay Cache: api2.mina.mi.com:443
[2024-06-06 15:30:18][DEBUG]: Accept 127.0.0.1:57112
[2024-06-06 15:30:18][DEBUG]: Connecting 59.82.122.57:443
[2024-06-06 15:30:18][DEBUG]: Connected 59.82.122.57:443
[2024-06-06 15:30:18][DEBUG]: Accept 127.0.0.1:57116
[2024-06-06 15:30:18][DEBUG]: Connecting 111.206.203.5:443
[2024-06-06 15:30:18][DEBUG]: Connected 111.206.203.5:443
[2024-06-06 15:30:18][DEBUG]: Accept 127.0.0.1:57124
[2024-06-06 15:30:18][DEBUG]: Accept 127.0.0.1:57136
[2024-06-06 15:30:18][DEBUG]: Connecting 119.147.175.28:443
[2024-06-06 15:30:18][DEBUG]: Connected 119.147.175.28:443
[2024-06-06 15:30:18][DEBUG]: Connecting 119.147.175.28:443
[2024-06-06 15:30:18][DEBUG]: Connected 119.147.175.28:443
[2024-06-06 15:30:18][DEBUG]: Accept 127.0.0.1:57138
[2024-06-06 15:30:18][DEBUG]: Connecting api2.mina.mi.com:443
[2024-06-06 15:30:18][DEBUG]: Connected api2.mina.mi.com:443
[2024-06-06 15:30:18][DEBUG]: Hit LRU Relay Cache: api2.mina.mi.com:443
[2024-06-06 15:30:19][DEBUG]: Accept 127.0.0.1:57152
[2024-06-06 15:30:19][DEBUG]: Connecting api-cn.cdo.heytapmobi.com:443
[2024-06-06 15:30:19][DEBUG]: Connected api-cn.cdo.heytapmobi.com:443
[2024-06-06 15:30:19][DEBUG]: Accept 127.0.0.1:57166
[2024-06-06 15:30:19][DEBUG]: Accept 127.0.0.1:57176
[2024-06-06 15:30:19][DEBUG]: Connecting store.heytapimage.com:443
[2024-06-06 15:30:19][DEBUG]: Connecting store.heytapimage.com:443
[2024-06-06 15:30:19][DEBUG]: Connected store.heytapimage.com:443
[2024-06-06 15:30:19][DEBUG]: Connected store.heytapimage.com:443
[2024-06-06 15:30:19][DEBUG]: Accept 127.0.0.1:57186
[2024-06-06 15:30:19][DEBUG]: Connecting api-cn.open.heytapmobi.com:443
[2024-06-06 15:30:19][DEBUG]: Connected api-cn.open.heytapmobi.com:443
[2024-06-06 15:30:19][DEBUG]: Accept 127.0.0.1:57198
[2024-06-06 15:30:19][DEBUG]: Connecting mdp-usertrace-cn.heytapmobi.com:443
[2024-06-06 15:30:19][DEBUG]: Connected mdp-usertrace-cn.heytapmobi.com:443
[2024-06-06 15:30:19][DEBUG]: Accept 127.0.0.1:57206
[2024-06-06 15:30:19][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:19][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Not HTTP, Hint: [22 3 1 1 96 1 0], Add LRU Relay Cache: interface.music.163.com:443, Cache Len: 3
[2024-06-06 15:30:20][DEBUG]: Accept 127.0.0.1:57218
[2024-06-06 15:30:20][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Accept 127.0.0.1:57228
[2024-06-06 15:30:20][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:20][DEBUG]: Accept 127.0.0.1:57242
[2024-06-06 15:30:20][DEBUG]: Connecting broker.mina.mi.com:443
[2024-06-06 15:30:20][DEBUG]: Connected broker.mina.mi.com:443
[2024-06-06 15:30:20][DEBUG]: Not HTTP, Hint: [22 3 1 2 0 1 0], Add LRU Relay Cache: broker.mina.mi.com:443, Cache Len: 4
[2024-06-06 15:30:20][DEBUG]: Accept 127.0.0.1:57244
[2024-06-06 15:30:20][DEBUG]: Connecting api-cn.cdo.heytapmobi.com:443
[2024-06-06 15:30:20][DEBUG]: Accept 127.0.0.1:57258
[2024-06-06 15:30:20][DEBUG]: Connected api-cn.cdo.heytapmobi.com:443
[2024-06-06 15:30:20][DEBUG]: Connecting api-cn.cdo.heytapmobi.com:443
[2024-06-06 15:30:20][DEBUG]: Connected api-cn.cdo.heytapmobi.com:443
[2024-06-06 15:30:21][DEBUG]: Accept 127.0.0.1:57264
[2024-06-06 15:30:21][DEBUG]: Connecting www.bilibili.com:443
[2024-06-06 15:30:21][DEBUG]: Connected www.bilibili.com:443
[2024-06-06 15:30:21][DEBUG]: Accept 127.0.0.1:57276
[2024-06-06 15:30:21][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:21][DEBUG]: Accept 127.0.0.1:57288
[2024-06-06 15:30:21][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:21][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:21][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:21][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:21][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57304
[2024-06-06 15:30:22][DEBUG]: Connecting 59.82.113.219:80
[2024-06-06 15:30:22][DEBUG]: Connected 59.82.113.219:80
[2024-06-06 15:30:22][DEBUG]: [59.82.113.219:80][127.0.0.1:57304] Hit User-Agent: Dalvik/2.1.0 (Linux; U; Android 13; PENM00 Build/TP1A.220905.001)
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57306
[2024-06-06 15:30:22][DEBUG]: Connecting i0.hdslb.com:443
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57312
[2024-06-06 15:30:22][DEBUG]: Connecting s1.hdslb.com:443
[2024-06-06 15:30:22][DEBUG]: Connected i0.hdslb.com:443
[2024-06-06 15:30:22][DEBUG]: Connected s1.hdslb.com:443
[2024-06-06 15:30:22][DEBUG]: [59.82.113.219:80][127.0.0.1:57304] read closed in next phase: read tcp 127.0.0.1:1080->127.0.0.1:57304: use of closed network connection
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57318
[2024-06-06 15:30:22][DEBUG]: Connecting api.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Connected api.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57320
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57332
[2024-06-06 15:30:22][DEBUG]: Connecting api.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Connecting s1.hdslb.com:443
[2024-06-06 15:30:22][DEBUG]: Connected api.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Connected s1.hdslb.com:443
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57346
[2024-06-06 15:30:22][DEBUG]: Connecting passport.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Connected passport.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57352
[2024-06-06 15:30:22][DEBUG]: Connecting cm.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Connected cm.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Accept 127.0.0.1:57364
[2024-06-06 15:30:22][DEBUG]: Connecting passport.bilibili.com:443
[2024-06-06 15:30:22][DEBUG]: Connected passport.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Accept 127.0.0.1:57372
[2024-06-06 15:30:23][DEBUG]: Connecting cm.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Accept 127.0.0.1:57386
[2024-06-06 15:30:23][DEBUG]: Connecting api.vc.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Connected cm.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Connected api.vc.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Accept 127.0.0.1:57398
[2024-06-06 15:30:23][DEBUG]: Connecting api.live.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Connected api.live.bilibili.com:443
[2024-06-06 15:30:23][DEBUG]: Accept 127.0.0.1:57404
[2024-06-06 15:30:23][DEBUG]: Connecting i0.hdslb.com:443
[2024-06-06 15:30:23][DEBUG]: Connected i0.hdslb.com:443
[2024-06-06 15:30:25][DEBUG]: Accept 127.0.0.1:57416
[2024-06-06 15:30:25][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Accept 127.0.0.1:57414
[2024-06-06 15:30:25][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Accept 127.0.0.1:57426
[2024-06-06 15:30:25][DEBUG]: Connecting ac.dun.163.com:443
[2024-06-06 15:30:25][DEBUG]: Connected ac.dun.163.com:443
[2024-06-06 15:30:25][DEBUG]: Accept 127.0.0.1:57436
[2024-06-06 15:30:25][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Accept 127.0.0.1:57438
[2024-06-06 15:30:25][DEBUG]: Connecting interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Connected interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Hit LRU Relay Cache: interface.music.163.com:443
[2024-06-06 15:30:25][DEBUG]: Accept 127.0.0.1:57442
[2024-06-06 15:30:25][DEBUG]: Connecting client.wns.windows.com:443
[2024-06-06 15:30:25][DEBUG]: Connected client.wns.windows.com:443
[2024-06-06 15:30:27][DEBUG]: Accept 127.0.0.1:57450
[2024-06-06 15:30:27][DEBUG]: Connecting clientlog.music.163.com:80
[2024-06-06 15:30:27][DEBUG]: Connected clientlog.music.163.com:80
[2024-06-06 15:30:27][DEBUG]: [clientlog.music.163.com:80][127.0.0.1:57450] Hit User-Agent: 
[2024-06-06 15:30:32][DEBUG]: Accept 127.0.0.1:44238
[2024-06-06 15:30:32][DEBUG]: Connecting securepubads.g.doubleclick.net:443
[2024-06-06 15:30:32][DEBUG]: Connected securepubads.g.doubleclick.net:443
[2024-06-06 15:30:46][DEBUG]: Accept 127.0.0.1:49408
[2024-06-06 15:30:46][DEBUG]: Connecting cm.bilibili.com:80
[2024-06-06 15:30:46][DEBUG]: Connected cm.bilibili.com:80
[2024-06-06 15:30:46][DEBUG]: [cm.bilibili.com:80][127.0.0.1:49408] Hit User-Agent: SogouIme
[2024-06-06 15:30:46][DEBUG]: Accept 127.0.0.1:49410
[2024-06-06 15:30:46][DEBUG]: Connecting api.vc.bilibili.com:80
[2024-06-06 15:30:46][DEBUG]: Connected api.vc.bilibili.com:80
[2024-06-06 15:30:46][DEBUG]: [api.vc.bilibili.com:80][127.0.0.1:49410] Hit User-Agent: SogouIMEMiniSetup_imepopup
[2024-06-06 15:30:46][DEBUG]: Accept 127.0.0.1:49426
[2024-06-06 15:30:46][DEBUG]: Connecting api.live.bilibili.com:80
[2024-06-06 15:30:46][DEBUG]: Connected api.live.bilibili.com:80
[2024-06-06 15:30:46][DEBUG]: [api.live.bilibili.com:80][127.0.0.1:49426] H
SunBK201 commented 3 weeks ago

Hi @Haocen2004, 能提供下 OpenWrt 版本和 Clash 的版本吗?

Haocen2004 commented 3 weeks ago
主机名 | N1
-- | --
型号 | Phicomm N1 (CpuMark : 19081.693500 Scores)
架构 | ARMv8 Processor : Cortex-A53 x 4
固件版本 | OpenWrt R22.9.1
内核版本 | 5.15.67
本地时间 | 2024年06月07日 星期五 00:27:04
运行时间 | 1h 13m 9s
CPU状态 | 1512Mhz / 66.0℃
平均负载 | 78.48, 100.69, 120.58
CPU 使用率 | 92%
固件编译日期 | gd772 2022.09.16

使用 openclash v0.46.011-beta 内核版本 alpha-g5c3a9b1

btw 在查询版本号期间发现clash异常占满了cpu

SunBK201 commented 3 weeks ago

执行命令 id -u nobody 会输出什么呢?

Haocen2004 commented 3 weeks ago

执行命令 id -u nobody 会输出什么呢?

65534

SunBK201 commented 3 weeks ago

还有没有装过 ShellClash? 分别尝试执行下 id -u shellclashid -u shellcrash

Haocen2004 commented 3 weeks ago

id -u shellcrash

没有

root@N1:~# id -u shellclash
id: unknown user shellclash
root@N1:~# id -u shellcrash
id: unknown user shellcrash
SunBK201 commented 3 weeks ago

麻烦使用 luci 或 service 后执行 ps | grep ua3f 看看有什么输出?

Haocen2004 commented 3 weeks ago

麻烦使用 luci 或 service 后执行 ps | grep ua3f 看看有什么输出?

使用luci启动

root@N1:~# ps | grep ua3f
12026 nobody   1198m S    /usr/bin/ua3f -b 127.0.0.1 -p 1080 -f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 -l info
12257 root      1240 S    grep ua3f
20256 nobody   1240m S    /etc/openclash/clash -d /etc/openclash -f /etc/openclash/ua3f.yaml
Haocen2004 commented 3 weeks ago

emm 发现一个问题之前没注意,我从 shell 启动的 ua3f 没加 -u nobody 是可以用的 刚刚试了一下加了-u nobody 也不认了

SunBK201 commented 3 weeks ago

从你的日志里看不出什么错误...

Haocen2004 commented 3 weeks ago

感觉就是单纯的 流量没有正确发给ua3f 但为什么和用户有关 用root就能收到流量 nobody就不行

SunBK201 commented 3 weeks ago

之所以要使用 nobody 用户是因为要避免流量回环。如果你关闭了 Clash 中的接管本机流量选项的话可以使用其他用户。

SunBK201 commented 3 weeks ago

emm 发现一个问题之前没注意,我从 shell 启动的 ua3f 没加 -u nobody 是可以用的 刚刚试了一下加了 - u nobody 也不认了

所以到底是什么状态下不能生效?

Haocen2004 commented 3 weeks ago

emm 发现一个问题之前没注意,我从 shell 启动的 ua3f 没加 -u nobody 是可以用的 刚刚试了一下加了 - u nobody 也不认了

所以到底是什么状态下不能生效?

就是在nobody用户组不生效 clash开启了代理本机流量

现在是跑在root用户下+关闭了代理本机流量(因为之前说遇到了高cpu占用 看日志发现是回环 加了processname的rule没用 或者说只能顶一会用)