Skip to content

Commit

Permalink
fix: password login
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Nov 11, 2024
1 parent d6a2fc2 commit 2a0fb69
Show file tree
Hide file tree
Showing 14 changed files with 491 additions and 237 deletions.
19 changes: 12 additions & 7 deletions client/auth/sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ var (
)

type SigInfo struct {
Uin uint32
Sequence uint32
UID string
Tgtgt []byte
Tgt []byte
D2 []byte
D2Key []byte
Uin uint32
Sequence uint32
UID string

Tgtgt []byte
Tgt []byte
D2 []byte
D2Key []byte

Qrsig []byte
ExchangeKey []byte
KeySig []byte
Expand All @@ -29,6 +31,9 @@ type SigInfo struct {
TempPwd []byte
CaptchaInfo [3]string

CaptchaURL string
NewDeviceVerifyURL string

Nickname string
Age uint8
Gender uint8
Expand Down
17 changes: 12 additions & 5 deletions client/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
// 部分借鉴 https://github.com/Mrs4s/MiraiGo/blob/master/client/client.go

import (
"crypto/md5"
"errors"
"net/http"
"net/http/cookiejar"
Expand Down Expand Up @@ -30,11 +31,16 @@ import (
)

// NewClient 创建一个新的 QQ Client
func NewClient(uin uint32, appInfo *auth.AppInfo, signURL ...string) *QQClient {
func NewClient(uin uint32, password string, appInfo *auth.AppInfo, signURL ...string) *QQClient {
return NewClientMD5(uin, md5.Sum([]byte(password)), appInfo, signURL...)
}

func NewClientMD5(uin uint32, passwordMD5 [16]byte, appInfo *auth.AppInfo, signURL ...string) *QQClient {
cookieContainer, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
client := &QQClient{
Uin: uin,
oicq: oicq.NewCodec(int64(uin)),
Uin: uin,
oicq: oicq.NewCodec(int64(uin)),
passwordMD5: passwordMD5,
highwaySession: highway.Session{
AppID: uint32(appInfo.AppID),
SubAppID: uint32(appInfo.SubAppID),
Expand Down Expand Up @@ -65,8 +71,9 @@ type QQClient struct {

Online atomic.Bool

t106 []byte
t16a []byte
t106 []byte
t16a []byte
passwordMD5 [16]byte

UA string

Expand Down
Loading

0 comments on commit 2a0fb69

Please sign in to comment.