-
Notifications
You must be signed in to change notification settings - Fork 5
/
Fun0818.go
66 lines (60 loc) · 1.77 KB
/
Fun0818.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* @Author: Trial
* @email: shenpan233@vip.qq.com
* @app: 令牌
* @Creat: 2021/12/4 0004 15:28
*/
package Tangent_PC
import (
"github.com/shenpan233/Tangent-PC/model"
"github.com/shenpan233/Tangent-PC/protocal/Tlv"
util "github.com/shenpan233/Tangent-PC/utils"
"github.com/shenpan233/Tangent-PC/utils/GuBuffer"
"github.com/shenpan233/Tangent-PC/utils/GuLog"
)
func (this *TangentPC) pack0818() (SsoSeq uint16, buffer []byte) {
this.teaKey.Ping0818Key = util.GetRandomBin(16)
GuLog.DebugF("BufTgtKey:%X\nPublicKey:%X\nShareKey:%X", this.teaKey.Ping0818Key, this.teaKey.PublicKey, this.teaKey.ShareKey)
return this.packetLogin(0x08_18, GuBuffer.NewGuPacketFun(func(pack *GuBuffer.GuPacket) {
pack.SetBytes(this.teaKey.Ping0818Key)
pack.SetBytes(util.Encrypt(this.teaKey.Ping0818Key, GuBuffer.NewGuPacketFun(func(pack *GuBuffer.GuPacket) {
pack.SetBytes(Tlv.GetTlv19SSOInfo(this.sdk))
pack.SetBytes(Tlv.GetTlv114DHParams(&this.teaKey.PublicKey))
pack.SetBytes(Tlv.GetTlv305())
pack.SetBytes(Tlv.GetTlv15(&this.info.Computer))
})))
}))
}
func (this *TangentPC) unpack0818(bin []byte) (ret *model.QRResp) {
pack := GuBuffer.NewGuUnPacket(util.Decrypt(this.teaKey.ShareKey, bin[3:]))
ret = new(model.QRResp)
ret.Status = pack.GetUint8()
for pack.GetLen() > 0 {
if tlv := pack.GetTlv(); tlv != nil {
GuBuffer.NewGuUnPacketFun(tlv.Value, func(pack *GuBuffer.GuUnPacket) {
switch tlv.Tag {
case 0x302:
ret.QRCode = pack.GetToken()
break
case 0x30:
ret.Sig0x30 = pack.GetAll()
break
case 0x301:
ret.SigQRSing = pack.GetAll()
break
case 0x9:
pack.Skip(2)
ret.BufQRKey = pack.GetAll()
break
}
})
}
}
//if ret.Status == model.LogicSuc {
// /*Tlv解析*/
//
//} else {
//
//}
return
}