6 Commits

Author SHA1 Message Date
lyc8503
4a365b628b fix older version sms code 2023-01-25 17:21:06 +08:00
lyc8503
a3121efaf2 Merge pull request #20 from i-Pear/main
[bugfix] use thread-local statistic vars
2023-01-25 16:53:15 +08:00
i.Pear
4097d0ae7a use thread-local statistic vars 2023-01-25 16:06:05 +08:00
lyc8503
1696b74763 Merge pull request #16 from i-Pear/main
fix unexpected EOF: Prevent client from being garbage collected
2023-01-25 13:08:53 +08:00
i.Pear
fd0217e446 Prevent client from being garbage collected 2023-01-25 04:19:40 +08:00
lyc8503
a7fa8c3656 fix sms code bug 2023-01-25 00:45:30 +08:00
3 changed files with 6 additions and 3 deletions

View File

@@ -168,7 +168,7 @@ func BlockTXStream(server string, token *[48]byte, ipRev *[4]byte, ep *EasyConne
errCh := make(chan error)
ep.OnRecv = func(buf []byte) {
n, err = conn.Write(buf)
var n, err = conn.Write(buf)
if err != nil {
errCh <- err
return

View File

@@ -104,7 +104,7 @@ func WebLogin(server string, username string, password string) (string, error) {
// log.Printf("First stage login response: %s", string(buf[:n]))
// SMS Code Process
if strings.Contains(string(buf[:n]), "<NextService>auth/sms</NextService>") {
if strings.Contains(string(buf[:n]), "<NextService>auth/sms</NextService>") || strings.Contains(string(buf[:n]), "<NextAuth>2</NextAuth>") {
log.Print("SMS code required.")
addr = server + "/por/login_sms.csp?apiversion=1"
@@ -121,7 +121,7 @@ func WebLogin(server string, username string, password string) (string, error) {
n, _ := resp.Body.Read(buf)
defer resp.Body.Close()
if !strings.Contains(string(buf[:n]), "验证码已发送到您的手机") {
if !strings.Contains(string(buf[:n]), "验证码已发送到您的手机") && !strings.Contains(string(buf[:n]), "<USER_PHONE>") {
debug.PrintStack()
return "", errors.New("unexpected sms resp: " + string(buf[:n]))
}

View File

@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"log"
"runtime"
)
func main() {
@@ -51,4 +52,6 @@ func main() {
log.Printf("Login success, your IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3])
client.ServeSocks5(socksBind, debugDump)
runtime.KeepAlive(client)
}