1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

Merge branch 'Mrs4s:master' into master

This commit is contained in:
A lucky guy 2023-03-19 17:18:05 +08:00 committed by GitHub
commit fdfb1e2816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 37 deletions

View File

@ -103,16 +103,7 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
tlv.T525(tlv.T536([]byte{0x01, 0x00})), tlv.T525(tlv.T536([]byte{0x01, 0x00})),
) )
if wrapper.DandelionEnergy != nil { if wrapper.DandelionEnergy != nil {
salt := binary.NewWriterF(func(w *binary.Writer) { if t544 := tlv.T544v2(uint64(c.Uin), "810_9", 9, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy); t544 != nil {
// util.int64_to_buf(bArr42, 0, (int) uin2);
// util.int16_to_buf(bArr42, 4, u.guid.length); // 故意的还是不小心的
w.Write(binary.NewWriterF(func(w *binary.Writer) { w.WriteUInt64(uint64(c.Uin)) })[:4])
w.WriteBytesShort(c.Device().Guid)
w.WriteBytesShort([]byte(c.version().SdkVersion))
w.WriteUInt32(9) // sub command
w.WriteUInt32(0) // 被演了
})
if t544 := tlv.T544Custom(uint64(c.Uin), "810_9", salt, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544) t.Append(t544)
} }
} }
@ -317,6 +308,11 @@ func (c *QQClient) buildCaptchaPacket(result string, sign []byte) (uint16, []byt
if c.sig.T547 != nil { if c.sig.T547 != nil {
t.Append(tlv.T(0x547, c.sig.T547)) t.Append(tlv.T(0x547, c.sig.T547))
} }
if wrapper.DandelionEnergy != nil {
if t544 := tlv.T544(uint64(c.Uin), "810_2", 2, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544)
}
}
req := c.buildOicqRequestPacket(c.Uin, 0x0810, t) req := c.buildOicqRequestPacket(c.Uin, 0x0810, t)
r := network.Request{ r := network.Request{
Type: network.RequestTypeLogin, Type: network.RequestTypeLogin,
@ -463,6 +459,13 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) {
tlv.T525(tlv.T536([]byte{0x01, 0x00})), tlv.T525(tlv.T536([]byte{0x01, 0x00})),
}, },
} }
if wrapper.DandelionEnergy != nil {
if t544 := tlv.T544v2(uint64(c.Uin), "810_f", 15, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544)
}
}
if c.Device().QImei16 != "" { if c.Device().QImei16 != "" {
t.Append(tlv.T545([]byte(c.Device().QImei16))) t.Append(tlv.T545([]byte(c.Device().QImei16)))
} else { } else {
@ -545,6 +548,11 @@ func (c *QQClient) buildRequestChangeSigPacket(changeD2 bool) (uint16, []byte) {
}), }),
tlv.T202(c.Device().WifiBSSID, c.Device().WifiSSID), tlv.T202(c.Device().WifiBSSID, c.Device().WifiSSID),
) )
if wrapper.DandelionEnergy != nil && t.Command == 10 {
if t544 := tlv.T544v2(uint64(c.Uin), "810_a", 10, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544)
}
}
req := c.buildOicqRequestPacket(c.Uin, 0x0810, t) req := c.buildOicqRequestPacket(c.Uin, 0x0810, t)
req2 := network.Request{ req2 := network.Request{
Type: network.RequestTypeLogin, Type: network.RequestTypeLogin,

View File

@ -92,14 +92,14 @@ func GenIMEI() string {
randGen := rand.New(rand.NewSource(time.Now().UnixNano())) randGen := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < 14; i++ { // generating all the base digits for i := 0; i < 14; i++ { // generating all the base digits
toAdd := randGen.Intn(10) toAdd := randGen.Intn(10)
if (i+1)%2 == 0 { // special proc for every 2nd one fmt.Fprintf(&final, "%d", toAdd) // printing them here!
if (i+1)%2 == 0 { // special proc for every 2nd one
toAdd *= 2 toAdd *= 2
if toAdd >= 10 { if toAdd >= 10 {
toAdd = (toAdd % 10) + 1 toAdd = (toAdd % 10) + 1
} }
} }
sum += toAdd sum += toAdd // and even add them here!
fmt.Fprintf(&final, "%d", toAdd) // and even printing them here!
} }
ctrlDigit := (sum * 9) % 10 // calculating the control digit ctrlDigit := (sum * 9) % 10 // calculating the control digit
fmt.Fprintf(&final, "%d", ctrlDigit) fmt.Fprintf(&final, "%d", ctrlDigit)

View File

@ -59,17 +59,19 @@ var (
}, },
AndroidWatch: { AndroidWatch: {
ApkId: "com.tencent.qqlite", ApkId: "com.tencent.qqlite",
AppId: 537064446, AppId: 537065138,
SubAppId: 537064446, SubAppId: 537065138,
SortVersionName: "2.0.5", SortVersionName: "2.0.8",
BuildTime: 1559564731, BuildTime: 1559564731,
ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D}, ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D},
SdkVersion: "6.0.0.236", SdkVersion: "6.0.0.2365",
SSOVersion: 5, SSOVersion: 5,
MiscBitmap: 16252796, MiscBitmap: 16252796,
SubSigmap: 0x10400, SubSigmap: 0x10400,
MainSigMap: WLOGIN_STWEB | WLOGIN_A2 | WLOGIN_ST | WLOGIN_SKEY | WLOGIN_D2 | WLOGIN_PSKEY | WLOGIN_DA2, // 34869472 MainSigMap: WLOGIN_A5 | WLOGIN_RESERVED | WLOGIN_STWEB | WLOGIN_A2 | WLOGIN_ST |
Protocol: AndroidWatch, WLOGIN_LSKEY | WLOGIN_SKEY | WLOGIN_SIG64 | 1<<16 | WLOGIN_VKEY | WLOGIN_D2 |
WLOGIN_SID | WLOGIN_PSKEY | WLOGIN_AQSIG | WLOGIN_LHSIG | WLOGIN_PAYTOKEN, // 16724722
Protocol: AndroidWatch,
}, },
IPad: { IPad: {
ApkId: "com.tencent.minihd.qq", ApkId: "com.tencent.minihd.qq",
@ -165,7 +167,7 @@ type AppVersion struct {
} }
func (v *AppVersion) String() string { func (v *AppVersion) String() string {
return fmt.Sprintf("%s %s - %v", v.Protocol.String(), v.SortVersionName, v.BuildTime) return fmt.Sprintf("%s %s", v.Protocol.String(), v.SortVersionName)
} }
func (v *AppVersion) UpdateFromJson(d []byte) error { func (v *AppVersion) UpdateFromJson(d []byte) error {

View File

@ -63,6 +63,9 @@ func (info *Device) RequestQImei() {
return return
} }
encryptedResponse, _ := base64.StdEncoding.DecodeString(gjson.GetBytes(resp, "data").String()) encryptedResponse, _ := base64.StdEncoding.DecodeString(gjson.GetBytes(resp, "data").String())
if len(encryptedResponse) == 0 {
return
}
decryptedResponse := aesDecrypt(encryptedResponse, []byte(cryptKey)) decryptedResponse := aesDecrypt(encryptedResponse, []byte(cryptKey))
info.QImei16 = gjson.GetBytes(decryptedResponse, "q16").String() info.QImei16 = gjson.GetBytes(decryptedResponse, "q16").String()
info.QImei36 = gjson.GetBytes(decryptedResponse, "q36").String() info.QImei36 = gjson.GetBytes(decryptedResponse, "q36").String()
@ -115,14 +118,7 @@ func genRandomPayloadByDevice(info *Device) map[string]any {
seed += int64(b) seed += int64(b)
} }
fixedRand := rand.New(rand.NewSource(seed)) fixedRand := rand.New(rand.NewSource(seed))
years := now.Year()
month := now.Month()
if month == 1 {
years--
month = 12
} else {
month--
}
reserved := map[string]string{ reserved := map[string]string{
"harmony": "0", "harmony": "0",
"clone": "0", "clone": "0",
@ -130,7 +126,7 @@ func genRandomPayloadByDevice(info *Device) map[string]any {
"oz": "UhYmelwouA+V2nPWbOvLTgN2/m8jwGB+yUB5v9tysQg=", "oz": "UhYmelwouA+V2nPWbOvLTgN2/m8jwGB+yUB5v9tysQg=",
"oo": "Xecjt+9S1+f8Pz2VLSxgpw==", "oo": "Xecjt+9S1+f8Pz2VLSxgpw==",
"kelong": "0", "kelong": "0",
"uptimes": time.Date(years, month, fixedRand.Intn(27)+1, fixedRand.Intn(60), fixedRand.Intn(60), fixedRand.Intn(60), fixedRand.Intn(1e9), now.Location()).Format("2006-01-02 15:04:05"), "uptimes": time.Unix(now.Unix()-fixedRand.Int63n(14400), 0).Format(time.DateTime),
"multiUser": "0", "multiUser": "0",
"bod": string(info.Board), "bod": string(info.Board),
"brd": string(info.Brand), "brd": string(info.Brand),

View File

@ -42,7 +42,10 @@ func (t *Transport) packBody(req *Request, w *binary.Writer) {
w.WriteUInt16(uint16(len(t.Sig.Ksid)) + 2) w.WriteUInt16(uint16(len(t.Sig.Ksid)) + 2)
w.Write(t.Sig.Ksid) w.Write(t.Sig.Ksid)
} }
w.WriteUInt32(0x04)
w.WriteUInt32(0x04 + uint32(len(t.Device.QImei16)))
w.Write([]byte(t.Device.QImei16))
w.WriteUInt32At(pos, uint32(w.Len()-pos)) w.WriteUInt32At(pos, uint32(w.Len()-pos))
w.WriteUInt32(uint32(len(req.Body) + 4)) w.WriteUInt32(uint32(len(req.Body) + 4))

View File

@ -11,14 +11,19 @@ func T544(userId uint64, moduleId string, subCmd uint32, sdkVersion string, guid
w.WriteBytesShort([]byte(sdkVersion)) w.WriteBytesShort([]byte(sdkVersion))
w.WriteUInt32(subCmd) w.WriteUInt32(subCmd)
}) })
sign, err := signer(userId, moduleId, salt) return T544Custom(userId, moduleId, salt, signer)
if err != nil { }
return nil
} func T544v2(userId uint64, moduleId string, subCmd uint32, sdkVersion string, guid []byte, signer func(uint64, string, []byte) ([]byte, error)) []byte {
return binary.NewWriterF(func(w *binary.Writer) { salt := binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x544) // w.Write(binary.NewWriterF(func(w *binary.Writer) { w.WriteUInt64(userId) })[:4])
w.WriteBytesShort(sign) w.WriteUInt32(0)
w.WriteBytesShort(guid)
w.WriteBytesShort([]byte(sdkVersion))
w.WriteUInt32(subCmd)
w.WriteUInt32(0)
}) })
return T544Custom(userId, moduleId, salt, signer)
} }
func T544Custom(userId uint64, moduleId string, salt []byte, signer func(uint64, string, []byte) ([]byte, error)) []byte { func T544Custom(userId uint64, moduleId string, salt []byte, signer func(uint64, string, []byte) ([]byte, error)) []byte {