Closed michael2012z closed 5 years ago
Please hide your server address in the post.
Please read: https://github.com/shadowsocks/shadowsocks-windows/issues/1487#issuecomment-340370635
或许可以考虑取消sysproxy,改用c#实现,感觉这东西bug有点多……
@studentmain https://github.com/shadowsocks/shadowsocks-windows/issues/1662#issuecomment-363647836 sysproxy 当初参考自蓝灯的实现方式做的。wininet api调用需要binary arch与system arch一致。x86的ss-win运行在x64的系统上的话,直接嵌入pinvoke会有问题。sysproxy使用了简单粗暴的方式打破了这个限制。但由于是直接解析standard output的输出结果,特殊场景下会导致解析出错。
@celeron533 https://github.com/studentmain/SysProxyNet 还需要进一步研究,不过看上去能解决一些问题,至少是可以不用解析stdout了。
至少是可以不用解析stdout了
或者query
后还能提供其他参数做到每一行单独输出。如:
sysproxy query proxyserver
sysproxy query bypasslist
sysproxy query pac
之类的
在或者将输出结果以base64编码
sysproxy query base64
@celeron533 看了看,或许我把事情想复杂了。怀疑问题来源于sysproxy对Unicode环境的识别不稳定,某些情况会直接把Unicode(UTF16LE)输出出来。在解析失败后换个字符集再试试或者干脆直接把\0去掉再试应该可以解决问题,我等会去试试。
以下是利用Linux子系统触发bug的示例:
User@PC:/mnt/c/Apps/Shadowsocks/ss_win_temp$ ./sysproxy.exe query
1 2 7 . 0 . 0 . 1 : 1 0 8 0
< l o c a l > ; l o c a l h o s t ; 1 2 7 . * ; 1 0 . * ; 1 7 2 . 1 6 . * ; 1 7 2 . 1 7 . * ; 1 7 2 . 1 8 . * ; 1 7 2 1 9 . * ; 1 7 2 . 2 0 . * ; 1 7 2 . 2 1 . * ; 1 7 2 . 2 2 . * ; 1 7 2 . 2 3 . * ; 1 7 2 . 2 4 . * ; 1 7 2 . 2 5 . * ; 1 7 2 . 2 6 . * ; 1 7 2 . 2 7 . * ; 1 7 2 . 2 8 . * ; 1 7 2 . 2 9 . * ; 1 7 2 . 3 0 . * ; 1 7 2 . 3 1 . * ; 1 9 2 . 1 6 8 *
( n u l l ) User@PC:/mnt/c/Apps/Shadowsocks/ss_win_temp$ ./sysproxy.exe query | hd
00000000 33 00 0d 00 0a 00 31 00 32 00 37 00 2e 00 30 00 |3.....1.2.7...0.|
00000010 2e 00 30 00 2e 00 31 00 3a 00 31 00 30 00 38 00 |..0...1.:.1.0.8.|
00000020 30 00 0d 00 0a 00 3c 00 6c 00 6f 00 63 00 61 00 |0.....<.l.o.c.a.|
00000030 6c 00 3e 00 3b 00 6c 00 6f 00 63 00 61 00 6c 00 |l.>.;.l.o.c.a.l.|
00000040 68 00 6f 00 73 00 74 00 3b 00 31 00 32 00 37 00 |h.o.s.t.;.1.2.7.|
00000050 2e 00 2a 00 3b 00 31 00 30 00 2e 00 2a 00 3b 00 |..*.;.1.0...*.;.|
00000060 31 00 37 00 32 00 2e 00 31 00 36 00 2e 00 2a 00 |1.7.2...1.6...*.|
00000070 3b 00 31 00 37 00 32 00 2e 00 31 00 37 00 2e 00 |;.1.7.2...1.7...|
00000080 2a 00 3b 00 31 00 37 00 32 00 2e 00 31 00 38 00 |*.;.1.7.2...1.8.|
00000090 2e 00 2a 00 3b 00 31 00 37 00 32 00 2e 00 31 00 |..*.;.1.7.2...1.|
000000a0 39 00 2e 00 2a 00 3b 00 31 00 37 00 32 00 2e 00 |9...*.;.1.7.2...|
000000b0 32 00 30 00 2e 00 2a 00 3b 00 31 00 37 00 32 00 |2.0...*.;.1.7.2.|
000000c0 2e 00 32 00 31 00 2e 00 2a 00 3b 00 31 00 37 00 |..2.1...*.;.1.7.|
000000d0 32 00 2e 00 32 00 32 00 2e 00 2a 00 3b 00 31 00 |2...2.2...*.;.1.|
000000e0 37 00 32 00 2e 00 32 00 33 00 2e 00 2a 00 3b 00 |7.2...2.3...*.;.|
000000f0 31 00 37 00 32 00 2e 00 32 00 34 00 2e 00 2a 00 |1.7.2...2.4...*.|
00000100 3b 00 31 00 37 00 32 00 2e 00 32 00 35 00 2e 00 |;.1.7.2...2.5...|
00000110 2a 00 3b 00 31 00 37 00 32 00 2e 00 32 00 36 00 |*.;.1.7.2...2.6.|
00000120 2e 00 2a 00 3b 00 31 00 37 00 32 00 2e 00 32 00 |..*.;.1.7.2...2.|
00000130 37 00 2e 00 2a 00 3b 00 31 00 37 00 32 00 2e 00 |7...*.;.1.7.2...|
00000140 32 00 38 00 2e 00 2a 00 3b 00 31 00 37 00 32 00 |2.8...*.;.1.7.2.|
00000150 2e 00 32 00 39 00 2e 00 2a 00 3b 00 31 00 37 00 |..2.9...*.;.1.7.|
00000160 32 00 2e 00 33 00 30 00 2e 00 2a 00 3b 00 31 00 |2...3.0...*.;.1.|
00000170 37 00 32 00 2e 00 33 00 31 00 2e 00 2a 00 3b 00 |7.2...3.1...*.;.|
00000180 31 00 39 00 32 00 2e 00 31 00 36 00 38 00 2e 00 |1.9.2...1.6.8...|
00000190 2a 00 0d 00 0a 00 28 00 6e 00 75 00 6c 00 6c 00 |*.....(.n.u.l.l.|
000001a0 29 00 |).|
000001a2
@studentmain 非常感谢。但之前也有其他用户反应这个问题,然后他们清空系统代理设置后重新启用就没这个问题。不排除有些第三方代理工具也会修改proxy, bypasslist,然后在里面放入了奇怪的字符(或者是用户从网页复制bypasslist的时候带了特殊字符)
@celeron533 那我在那打个日志,如果两个字符集都解析失败,把sysproxy输出打下来,多收集点案例看看。
不过按理说特殊字符只要不出现在\r\n中间都不会影响按行切割字符串。
主要还是有其他的代理软件给系统代理设置灌入了些奇怪的字符
Shadowsocks version / 影梭版本
4.1.1
Environment(Operating system, .NET Framework, etc) / 使用环境(操作系统,.NET Framework等)
Windows 7 SP1 .NET Framework 4.6.2
Steps you have tried / 操作步骤
The error happened immediately after Windows started up. A dialog with title "Shadowsocks Non-UI Error" appeared and Shadowsocks crashed.
What did you expect to see? / 期望的结果
It worked well.
What did you see instead? / 实际结果
Crashed.
Config and error log in detail (with all sensitive info masked) / 配置文件和日志文件(请隐去敏感信息)
Log:
Config: