From 1ab07c81abe0026f3129af8c50459ff0e01fdb2c Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Wed, 19 Sep 2018 15:45:15 +0800 Subject: [PATCH 1/6] a --- utils/functions.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/functions.go b/utils/functions.go index 56f91be..58ba7da 100755 --- a/utils/functions.go +++ b/utils/functions.go @@ -371,11 +371,20 @@ func RandInt(strLen int) int64 { return i } func ReadBytes(r io.Reader) (data []byte, err error) { + defer func() { + if e := recover(); e != nil { + err = fmt.Errorf("read bytes fail ,err : %s", e) + } + }() var len uint64 err = binary.Read(r, binary.LittleEndian, &len) if err != nil { return } + if len == 0 || len > ^uint64(0) { + err = fmt.Errorf("data len out of range, %d", len) + return + } var n int data = make([]byte, len) n, err = r.Read(data) From 20761d2183c978cdfd2c73b64b1f0b5f1be01a93 Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Fri, 21 Sep 2018 12:01:13 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dencrypt.Conn=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E5=86=85=E5=AD=98,=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E6=BD=9C=E5=9C=A8panic=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/transport/encrypt/conn.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/core/lib/transport/encrypt/conn.go b/core/lib/transport/encrypt/conn.go index 9080da2..a9ed308 100644 --- a/core/lib/transport/encrypt/conn.go +++ b/core/lib/transport/encrypt/conn.go @@ -2,6 +2,7 @@ package encrypt import ( "crypto/cipher" + "fmt" "io" "net" @@ -33,15 +34,23 @@ func NewConn(c net.Conn, method, password string) (conn net.Conn, err error) { return } func (s *Conn) Read(b []byte) (n int, err error) { + if s.r == nil { + return 0, fmt.Errorf("use of closed connection") + } return s.r.Read(b) } func (s *Conn) Write(b []byte) (n int, err error) { + if s.w == nil { + return 0, fmt.Errorf("use of closed connection") + } return s.w.Write(b) } func (s *Conn) Close() (err error) { - err = s.Conn.Close() - s.Cipher = nil - s.r = nil - s.w = nil - return err + if s.Cipher != nil { + err = s.Conn.Close() + s.Cipher = nil + s.r = nil + s.w = nil + } + return } From b9afc982307204b6cb312b2d4572e1737b638048 Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Fri, 21 Sep 2018 12:01:46 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dencrypt.Conn=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E5=86=85=E5=AD=98,=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E6=BD=9C=E5=9C=A8panic=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b5c3541..50a3bad 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ proxy更新日志 +v6.2 +1.修复encrypt.Conn释放内存,导致的潜在panic问题. + v6.1 1.黑白名单支持设置顶级域了,比如:com,匹配所有的.com域名 2.优化TCPS内存释放. From 1b29112a2ce8253ee103a88ec85cbec716beae5a Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Fri, 21 Sep 2018 12:02:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dencrypt.Conn=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E5=86=85=E5=AD=98,=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E6=BD=9C=E5=9C=A8panic=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/transport/encrypt/conn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/transport/encrypt/conn.go b/core/lib/transport/encrypt/conn.go index a9ed308..a4c0295 100644 --- a/core/lib/transport/encrypt/conn.go +++ b/core/lib/transport/encrypt/conn.go @@ -35,13 +35,13 @@ func NewConn(c net.Conn, method, password string) (conn net.Conn, err error) { } func (s *Conn) Read(b []byte) (n int, err error) { if s.r == nil { - return 0, fmt.Errorf("use of closed connection") + return 0, fmt.Errorf("use of closed network connection") } return s.r.Read(b) } func (s *Conn) Write(b []byte) (n int, err error) { if s.w == nil { - return 0, fmt.Errorf("use of closed connection") + return 0, fmt.Errorf("use of closed network connection") } return s.w.Write(b) } From 284bb83d649e9747659e3d5b6df33b8200e5adda Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Fri, 21 Sep 2018 13:57:46 +0800 Subject: [PATCH 5/6] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8Dencrypt.Conn=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E5=86=85=E5=AD=98,=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E6=BD=9C=E5=9C=A8panic=E9=97=AE=E9=A2=98.=202.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BA=86basic=E8=AE=A4=E8=AF=81,=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=96=87=E4=BB=B6=E6=B2=A1=E6=9C=89=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E5=A4=84=E7=90=86=E6=B3=A8=E9=87=8A=E7=9A=84bug.=203.?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86ssh=E4=B8=AD=E8=BD=AC=E6=89=8B?= =?UTF-8?q?=E5=86=8C=E5=8F=82=E6=95=B0-A=E8=B0=83=E6=95=B4=E4=B8=BA-D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 2 ++ README_ZH.md | 4 ++-- utils/structs.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 50a3bad..2b514f0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,8 @@ proxy更新日志 v6.2 1.修复encrypt.Conn释放内存,导致的潜在panic问题. +2.修复了basic认证,处理认证文件没有正确处理注释的bug. +3.修正了ssh中转手册参数-A调整为-D. v6.1 1.黑白名单支持设置顶级域了,比如:com,匹配所有的.com域名 diff --git a/README_ZH.md b/README_ZH.md index 86c687e..c583f60 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -380,7 +380,7 @@ target:用户访问的URL,比如:http://demo.com:80/1.html或https://www.baidu.c ##### ***1.7.1 ssh用户名和密码的方式*** 本地HTTP(S)代理28080端口,执行: -`./proxy http -T ssh -P "2.2.2.2:22" -u user -A demo -t tcp -p ":28080"` +`./proxy http -T ssh -P "2.2.2.2:22" -u user -D demo -t tcp -p ":28080"` ##### ***1.7.2 ssh用户名和密钥的方式*** 本地HTTP(S)代理28080端口,执行: `./proxy http -T ssh -P "2.2.2.2:22" -u user -S user.key -t tcp -p ":28080"` @@ -879,7 +879,7 @@ SOCKS5代理,支持CONNECT,UDP协议,不支持BIND,支持用户名密码认证. ##### ***5.6.1 ssh用户名和密码的方式*** 本地SOCKS5代理28080端口,执行: -`./proxy socks -T ssh -P "2.2.2.2:22" -u user -A demo -t tcp -p ":28080"` +`./proxy socks -T ssh -P "2.2.2.2:22" -u user -D demo -t tcp -p ":28080"` ##### ***5.6.2 ssh用户名和密钥的方式*** 本地SOCKS5代理28080端口,执行: `./proxy socks -T ssh -P "2.2.2.2:22" -u user -S user.key -t tcp -p ":28080"` diff --git a/utils/structs.go b/utils/structs.go index 24fd8e0..64f8b5e 100644 --- a/utils/structs.go +++ b/utils/structs.go @@ -235,7 +235,7 @@ func (ba *BasicAuth) AddFromFile(file string) (n int, err error) { } userpassArr := strings.Split(strings.Replace(string(_content), "\r", "", -1), "\n") for _, userpass := range userpassArr { - if strings.HasPrefix("#", userpass) { + if strings.HasPrefix(userpass, "#") { continue } u := strings.Split(strings.Trim(userpass, " "), ":") From 6917ff334717d7648533cfa35b6d59a650d0bc1a Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Fri, 21 Sep 2018 18:01:58 +0800 Subject: [PATCH 6/6] a --- README_ZH.md | 2 +- VERSION | 2 +- install_auto.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README_ZH.md b/README_ZH.md index c583f60..c2b00e7 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -183,7 +183,7 @@ curl -L https://raw.githubusercontent.com/snail007/goproxy/master/install_auto.s 下载地址:https://github.com/snail007/goproxy/releases ```shell cd /root/proxy/ -wget https://github.com/snail007/goproxy/releases/download/v6.1/proxy-linux-amd64.tar.gz +wget https://github.com/snail007/goproxy/releases/download/v6.2/proxy-linux-amd64.tar.gz ``` #### **2.下载自动安装脚本** ```shell diff --git a/VERSION b/VERSION index e8f1734..913671c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1 \ No newline at end of file +6.2 \ No newline at end of file diff --git a/install_auto.sh b/install_auto.sh index 5202b6b..2823213 100755 --- a/install_auto.sh +++ b/install_auto.sh @@ -5,7 +5,7 @@ if [ -e /tmp/proxy ]; then fi mkdir /tmp/proxy cd /tmp/proxy -wget https://github.com/snail007/goproxy/releases/download/v6.1/proxy-linux-amd64.tar.gz +wget https://github.com/snail007/goproxy/releases/download/v6.2/proxy-linux-amd64.tar.gz # #install proxy tar zxvf proxy-linux-amd64.tar.gz