Skip to content

Commit

Permalink
feat: self nickname
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Apr 19, 2024
1 parent 528c6b1 commit 7327b70
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions client/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type QQClient struct {
FriendRecallEvent EventHandle[*event.FriendRecall]
}

func (c *QQClient) NickName() string {
return c.sig.Nickname
}

func (c *QQClient) SendOidbPacket(pkt *oidb.OidbPacket) error {
return c.SendUniPacket(pkt.Cmd, pkt.Data)
}
Expand Down
8 changes: 6 additions & 2 deletions info/sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package info

type SigInfo struct {
Uin uint32
Uid string
Sequence int
Tgtgt []byte
Tgt []byte
Expand All @@ -13,12 +14,16 @@ type SigInfo struct {
Cookies string
UnusualSig []byte
TempPwd []byte
Uid string
CaptchaInfo [3]string

Nickname string
Age uint8
Gender uint8
}

func NewSigInfo(seq int) *SigInfo {
return &SigInfo{
Uid: "",
Sequence: seq,
Tgtgt: make([]byte, 0),
Tgt: make([]byte, 0),
Expand All @@ -30,7 +35,6 @@ func NewSigInfo(seq int) *SigInfo {
Cookies: "",
UnusualSig: make([]byte, 0),
TempPwd: make([]byte, 0),
Uid: "",
CaptchaInfo: [3]string{"", "", ""},
}
}
10 changes: 9 additions & 1 deletion packets/wtlogin/oicq.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func DecodeLoginResponse(buf []byte, sig *info.SigInfo) (bool, error) {
if typ == 0 {
reader = binary.NewReader(qqtea.QQTeaDecrypt(tlv[0x119], sig.Tgtgt))
tlv = reader.ReadTlv()
if tgt, ok := tlv[0x10a]; ok {
if tgt, ok := tlv[0x10A]; ok {
sig.Tgt = tgt
}
if d2, ok := tlv[0x143]; ok {
Expand All @@ -164,6 +164,14 @@ func DecodeLoginResponse(buf []byte, sig *info.SigInfo) (bool, error) {
if d2Key, ok := tlv[0x305]; ok {
sig.D2Key = d2Key
}
if tlv11a, ok := tlv[0x11A]; ok {
loginLogger.Infof("tlv11a data: %x", tlv11a)
tlvReader := binary.NewReader(tlv11a)
tlvReader.ReadU16()
sig.Age = tlvReader.ReadU8()
sig.Gender = tlvReader.ReadU8()
sig.Nickname = tlvReader.ReadStringWithLength("u8", false)
}
sig.Tgtgt = utils.Md5Digest(sig.D2Key)
sig.TempPwd = tlv[0x106]

Expand Down

0 comments on commit 7327b70

Please sign in to comment.