first commit

This commit is contained in:
2026-02-17 13:06:23 +08:00
commit 7cbd3d061d
349 changed files with 126558 additions and 0 deletions
+116
View File
@@ -0,0 +1,116 @@
package extinfo
import (
"bytes"
"compress/zlib"
"github.com/golang/protobuf/proto"
"hash/crc32"
"math/rand"
"time"
"xiawan/wx/clientsdk/android"
"xiawan/wx/clientsdk/android/mmproto"
"xiawan/wx/clientsdk/baseinfo"
"xiawan/wx/protobuf/wechat"
)
// 安卓23算法
func AndroidCcData(DeviceId string, info *baseinfo.AndroidDeviceInfo, DeviceToken *wechat.TrustResp, T int64) *wechat.ZTData {
microseconds3 := time.Now().UnixNano()%1000 + time.Now().Unix()%1000*1000
tvSec := time.Now().Unix() / 1000
tvUsec := time.Now().UnixNano()%1000 + time.Now().Unix()%1000*1000
//microseconds4:=time.Now().UnixNano()%1000+time.Now().Unix()%1000*1000
defaultUid := 10200 + rand.Int63n(2000)
ccd3body := &wechat.SpamAndroidBody{
Loc: proto.Uint32(0),
Root: proto.Uint32(0),
Debug: proto.Uint32(0),
PackageSign: proto.String(info.AndriodPackageSign(DeviceId)),
RadioVersion: proto.String(info.AndroidRadioVersion(DeviceId)),
BuildVersion: proto.String(info.AndroidVersion()),
DeviceId: proto.String(info.AndriodImei(DeviceId)),
AndroidId: proto.String(info.AndriodID(DeviceId)),
SerialId: proto.String(info.AndriodPhoneSerial(DeviceId)),
Model: proto.String(info.AndroidPhoneModel(DeviceId)),
CpuCount: proto.Uint32(6),
CpuBrand: proto.String(info.AndroidHardware(DeviceId)),
CpuExt: proto.String(info.AndroidFeatures()),
WlanAddress: proto.String(info.AndriodWLanAddress(DeviceId)),
Ssid: proto.String(info.AndriodSsid(DeviceId)),
Bssid: proto.String(info.AndriodBssid(DeviceId)),
SimOperator: proto.String(""),
WifiName: proto.String(info.AndroidWifiName(DeviceId)),
BuildFP: proto.String(info.AndroidBuildFP(DeviceId)),
BuildBoard: proto.String("bullhead"),
BuildBootLoader: proto.String(info.AndroidBuildBoard(DeviceId)),
BuildBrand: proto.String("google"),
BuildDevice: proto.String("bullhead"),
DataDir: proto.String("/data/user/0/com.tencent.mm/"),
NetType: proto.String("wifi"),
PackageName: proto.String("com.tencent.mm"),
Task: proto.Uint64(0),
GsmSimOperatorNumber: proto.String(""),
SoterId: proto.String(""),
KernelReleaseNumber: proto.String(info.AndroidKernelReleaseNumber(DeviceId)),
UsbState: proto.Uint64(0),
Sign: proto.String(info.AndriodPackageSign(DeviceId)),
PackageFlag: proto.Uint64(14),
AccessFlag: proto.Uint64(uint64(info.AndriodAccessFlag(DeviceId))),
Unkonwn: proto.Uint64(3),
TbVersionCrc: proto.Uint64(uint64(info.AndriodTbVersionCrc(DeviceId))),
SfMD5: proto.String(info.AndriodSfMD5(DeviceId)),
SfArmMD5: proto.String(info.AndriodSfArmMD5(DeviceId)),
SfArm64MD5: proto.String(info.AndriodSfArm64MD5(DeviceId)),
SbMD5: proto.String(info.AndriodSbMD5(DeviceId)),
SoterId2: proto.String(""),
WidevineDeviceID: proto.String(info.AndriodWidevineDeviceID(DeviceId)),
FSID: proto.String(info.AndriodFSID(DeviceId)),
Oaid: proto.String(""),
TimeCheck: proto.Uint64(0),
NanoTime: proto.Uint64(uint64(info.AndriodNanoTime(DeviceId))),
Refreshtime: proto.Uint64(DeviceToken.GetTrustResponseData().GetTimestamp()),
SoftConfig: proto.String(DeviceToken.GetTrustResponseData().GetSoftData().GetSoftConfig()),
SoftData: DeviceToken.GetTrustResponseData().GetSoftData().GetSoftData(),
DebugFlags: proto.Uint64(uint64(microseconds3)),
RouteIFace: proto.String("eth0"), //this.disableWifi ? "eth0" : "wlan0"
TvSec: proto.Uint64(uint64(tvSec)),
TvUsec: proto.Uint64(uint64(tvUsec)),
//TvCheck: proto.Uint64(0), //???
//PkgHash3Encrypted: proto.EncodeVarint(0),
Uid: proto.Uint64(uint64(defaultUid)),
}
//
pb, _ := proto.Marshal(ccd3body)
crc := crc32.ChecksumIEEE(pb)
curtime := uint32(T)
ccd3 := &mmproto.Ccd3{
Crc: &crc,
TimeStamp: &curtime,
Body: ccd3body,
}
pb, _ = proto.Marshal(ccd3)
var b bytes.Buffer
w := zlib.NewWriter(&b)
_, _ = w.Write(pb)
_ = w.Close()
zt := new(android.ZT)
zt.Init()
encData := zt.Encrypt(b.Bytes())
Ztdata := &wechat.ZTData{
Version: []byte("00000003"),
Encrypted: proto.Uint64(1),
Data: encData,
TimeStamp: &T,
OpType: proto.Uint64(5),
Uin: proto.Uint64(0),
}
return Ztdata
}
+912
View File
@@ -0,0 +1,912 @@
package extinfo
import (
"bytes"
"fmt"
"hash/crc32"
"math/rand"
"strings"
"time"
"xiawan/wx/clientsdk/android"
"xiawan/wx/clientsdk/android/mmproto"
"xiawan/wx/clientsdk/baseinfo"
"xiawan/wx/clientsdk/baseutils"
"xiawan/wx/clientsdk/ccdata"
"xiawan/wx/protobuf/wechat"
"github.com/gogf/guuid"
"github.com/gogo/protobuf/proto"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
// 获取CCD
func GetCCDPbLibLogin(iosVersion, deviceType, uuid1, uuid2, deviceName string, deviceToken *wechat.TrustResp, deviceId, userName, guid2 string) ([]byte, error) {
// ccData1, err := GetNewSpamData(iosVersion, deviceType, uuid1, uuid2, deviceName, deviceToken, deviceId, userName, guid2)
ccData1, err := GetNew07SpamData(iosVersion, deviceType, uuid1, uuid2, deviceName, deviceToken, deviceId, userName, guid2)
if err != nil {
return nil, err
}
wcstf, _ := proto.Marshal(android.IphoneWcstf(userName))
wcste, _ := proto.Marshal(android.IphoneWcste(0, 0))
wcExtInfo := &wechat.WCExtInfoNew{
Wcstf: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(wcstf))),
Buffer: wcstf,
},
Wcste: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(wcste))),
Buffer: wcste,
},
CcData: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(ccData1))),
Buffer: ccData1,
},
}
return proto.Marshal(wcExtInfo)
}
// 获取CCD
func GetCCDPbLib(iosVersion, deviceType, uuid1, uuid2, deviceName string, deviceToken *wechat.TrustResp, deviceId, userName, guid2 string) ([]byte, error) {
ccData1, _ := GetNewIPadSpamData(iosVersion, deviceType, uuid1, uuid2, deviceName, deviceToken, deviceId, userName, guid2)
wcstf, _ := proto.Marshal(android.IphoneWcstf(userName))
wcste, _ := proto.Marshal(android.IphoneWcste(0, 0))
// wcstf, err := GetWcstfIpad(userName)
// if err != nil {
// return nil, err
// }
// wcste, err := GetWcsteIpad()
// if err != nil {
// return nil, err
// }
DeviceTokenCCD := GetDeviceToken(deviceToken.GetTrustResponseData().GetDeviceToken())
DeviceTokenCCDPB, _ := proto.Marshal(DeviceTokenCCD)
wcExtInfo := &wechat.WCExtInfoNew{
Wcstf: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(wcstf))),
Buffer: wcstf,
},
Wcste: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(wcste))),
Buffer: wcste,
},
CcData: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(ccData1))),
Buffer: ccData1,
},
DeviceToken: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(DeviceTokenCCDPB))),
Buffer: DeviceTokenCCDPB,
},
}
return proto.Marshal(wcExtInfo)
}
// 获取CCD
func GetCCDPbLibIPhone(iosVersion, deviceType, uuid1, uuid2, deviceName string, deviceToken *wechat.TrustResp, deviceId, userName, guid2 string) ([]byte, error) {
ccData1, err := GetNew07SpamData(iosVersion, deviceType, uuid1, uuid2, deviceName, deviceToken, deviceId, userName, guid2)
if err != nil {
return nil, err
}
wcstf, _ := proto.Marshal(android.IphoneWcstf(userName))
wcste, _ := proto.Marshal(android.IphoneWcste(0, 0))
DeviceTokenCCD := GetDeviceToken(deviceToken.GetTrustResponseData().GetDeviceToken())
DeviceTokenCCDPB, _ := proto.Marshal(DeviceTokenCCD)
wcExtInfo := &wechat.WCExtInfoNew{
Wcstf: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(wcstf))),
Buffer: wcstf,
},
Wcste: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(wcste))),
Buffer: wcste,
},
CcData: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(ccData1))),
Buffer: ccData1,
},
DeviceToken: &wechat.BufferT{
ILen: proto.Uint32(uint32(len(DeviceTokenCCDPB))),
Buffer: DeviceTokenCCDPB,
},
}
return proto.Marshal(wcExtInfo)
}
func GetWcstfIpad(userName string) ([]byte, error) {
curtime := time.Now().UnixNano() / 1000000
contentLen := len(userName)
ct := make([]uint64, 0)
ut := curtime
for i := 0; i < contentLen; i++ {
ut += rand.Int63n(10000)
ct = append(ct, uint64(ut))
}
wcstf := &wechat.WCSTF{
StartTime: proto.Uint64(uint64(curtime)),
CheckTime: proto.Uint64(uint64(curtime)),
Count: proto.Uint32(uint32(contentLen)),
EndTime: ct,
}
ccData, err := proto.Marshal(wcstf)
if err != nil {
return nil, err
}
afterCompressionCCData := baseutils.CompressByteArray(ccData)
afterEnData, err := ccdata.EncodeZipData(afterCompressionCCData, 0x3060)
if err != nil {
return nil, err
}
deviceRunningInfo := &wechat.DeviceRunningInfoNew{
Version: []byte("00000003"),
Type: proto.Uint32(1),
EncryptData: afterEnData,
Timestamp: proto.Uint32(uint32(curtime)),
Unknown5: proto.Uint32(5),
Unknown6: proto.Uint32(0),
}
return proto.Marshal(deviceRunningInfo)
}
func GetWcsteIpad() ([]byte, error) {
curtime := time.Now().Unix()
curNanoTime := time.Now().UnixNano() / 1000000
wcste := &wechat.WCSTE{
CheckId: proto.String("<LoginByID>"),
StartTime: proto.Uint32(uint32(curtime)),
CheckTime: proto.Uint32(uint32(curtime)),
Count1: proto.Uint32(0),
Count2: proto.Uint32(1),
Count3: proto.Uint32(0),
Const1: proto.Uint64(384214787666497617),
Const2: proto.Uint64(uint64(curNanoTime)),
Const3: proto.Uint64(uint64(curNanoTime)),
Const4: proto.Uint64(uint64(curNanoTime)),
Const5: proto.Uint64(uint64(curNanoTime)),
Const6: proto.Uint64(384002236977512448),
}
ccData, err := proto.Marshal(wcste)
if err != nil {
return nil, err
}
afterCompressionCCData := baseutils.CompressByteArray(ccData)
afterEnData, err := ccdata.EncodeZipData(afterCompressionCCData, 0x3060)
if err != nil {
return nil, err
}
deviceRunningInfo := &wechat.DeviceRunningInfoNew{
Version: []byte("00000003"),
Type: proto.Uint32(1),
EncryptData: afterEnData,
Timestamp: proto.Uint32(uint32(curtime)),
Unknown5: proto.Uint32(5),
Unknown6: proto.Uint32(0),
}
return proto.Marshal(deviceRunningInfo)
}
// 705以上版本的计算extinfo
func GetNewSpamData(iosVersion string, deviceType, uuid1, uuid2, deviceName string, deviceToken *wechat.TrustResp, deviceId, userName, guid2 string) ([]byte, error) {
dateTimeSramp := time.Now().Unix()
timeStamp := time.Now().Unix()
xorKey := MakeXorKey(timeStamp)
//xorKey := byte((dateTimeSramp * 0xffffffed) + 7)
guid1 := guuid.New().String()
if guid2 == "" {
guid2 = guuid.New().String()
}
//guid2 := guuid.New().String()
//24算法
spamDataBody := wechat.SpamDataBody{
UnKnown1: proto.Int32(1),
TimeStamp: proto.Uint32(uint32(dateTimeSramp)),
KeyHash: proto.Int32(int32(MakeKeyHash(xorKey))),
Yes1: proto.String(XorEncrypt("yes", xorKey)),
Yes2: proto.String(XorEncrypt("yes", xorKey)),
IosVersion: proto.String(XorEncrypt(iosVersion, xorKey)),
DeviceType: proto.String(XorEncrypt(deviceType, xorKey)),
UnKnown2: proto.Int32(4), //cpu核数
IdentifierForVendor: proto.String(XorEncrypt(uuid1, xorKey)),
AdvertisingIdentifier: proto.String(XorEncrypt(uuid2, xorKey)),
Carrier: proto.String(XorEncrypt("中国联通", xorKey)),
BatteryInfo: proto.Int32(1),
NetworkName: proto.String(XorEncrypt("en0", xorKey)),
NetType: proto.Int32(1),
AppBundleId: proto.String(XorEncrypt("com.tencent.xin", xorKey)),
DeviceName: proto.String(XorEncrypt(deviceName, xorKey)),
UserName: proto.String(XorEncrypt(userName, xorKey)),
Unknown3: proto.Int64(DeviceNumber(deviceId[:29] + "FFF")), //基带版本 77968568550229002
Unknown4: proto.Int64(DeviceNumber(deviceId[:29] + "OOO")), //基带通讯版本 77968568550228991
Unknown5: proto.Int32(0), //IsJailbreak
Unknown6: proto.Int32(4),
Lang: proto.String(XorEncrypt("zh", xorKey)),
Country: proto.String(XorEncrypt("CN", xorKey)),
Unknown7: proto.Int32(4),
DocumentDir: proto.String(XorEncrypt(fmt.Sprintf("/var/mobile/Containers/Data/Application/%s/Documents", guid1), xorKey)),
Unknown8: proto.Int32(0),
Unknown9: proto.Int32(0),
HeadMD5: proto.String(XorEncrypt(GetCidMd5(deviceId, GetCid(0x0262626262626)), xorKey)), //XorEncrypt("d13610700984cf481b7d3f5fa2011c30", xorKey)
AppUUID: proto.String(XorEncrypt(uuid1, xorKey)),
SyslogUUID: proto.String(XorEncrypt(uuid2, xorKey)),
Unknown10: proto.String(XorEncrypt(BuildRandomWifiSsid(), xorKey)),
Unknown11: proto.String(XorEncrypt(baseutils.BuildRandomMac(), xorKey)),
AppName: proto.String(XorEncrypt("微信", xorKey)),
SshPath: proto.String(XorEncrypt("/usr/bin/ssh", xorKey)),
TempTest: proto.String(XorEncrypt("/tmp/test.txt", xorKey)), //XorEncrypt("/tmp/test.txt", xorKey)
DevMD5: proto.String(""),
DevUser: proto.String(""),
DevPrefix: proto.String(""),
AppFileInfo: GetFileInfo(deviceId, xorKey, guid2),
Unknown12: proto.String(""),
IsModify: proto.Int32(0),
ModifyMD5: proto.String(baseutils.Md5Value("modify")),
//RqtHash: proto.Int64(baseutils.EncInt(int64(baseutils.CalcMsgCrc([]byte(XorEncrypt(baseutils.Md5Value("modify"), xorKey)))))), //288529533794259264
RqtHash: proto.Int64(baseutils.EncInt(int64(SignRqtBufByAutoChosenKey(baseutils.Md5Value("modify" + deviceId))))),
Unknown53: proto.Uint64(1586355322), //微信安装时间
Unknown54: proto.Uint64(uint64(dateTimeSramp)), //微信启动时间 1586355519000
Unknown55: proto.Uint64(0), //固定值0
Unknown56: proto.Int64(baseutils.EncInt(int64(SignRqtBufByAutoChosenKey(baseutils.Md5Value("modify" + deviceId))))),
//Unknown46: proto.Int64(baseutils.EncInt(int64(baseutils.CalcMsgCrc([]byte(XorEncrypt(baseutils.Md5Value("modify"), xorKey)))))), //288529533794259264
Unknown57: proto.Uint64(0), //固定值0
Unknown58: proto.String(XorEncrypt(deviceId, xorKey)),
//Unknown49: proto.String(strconv.FormatInt(baseutils.EncInt(int64(crc32.ChecksumIEEE([]byte(XorEncrypt(deviceId, xorKey))))), 10)),
Unknown59: proto.String(fmt.Sprintf("%v", baseutils.EncInt(int64(crc32.ChecksumIEEE([]byte(XorEncrypt(deviceId, xorKey))))))),
Unknown61: proto.String(XorEncrypt("2FFC7F6DFEEFFF2B3FFCA029", xorKey)),
Unknown62: proto.Uint64(1175744137544159509),
Unknown63: proto.String(XorEncrypt(baseutils.Md5Value(deviceId+"imsi"), xorKey)), //device + "imsi" md5
}
appFileInfo := new(bytes.Buffer)
appFile := make([]string, 0)
filePath := []string{
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/WeChat",
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/Frameworks/mars.framework/mars",
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/Frameworks/andromeda.framework/andromeda",
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/Frameworks/OpenSSL.framework/OpenSSL",
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/Frameworks/ProtobufLite.framework/ProtobufLite",
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/Frameworks/marsbridgenetwork.framework/marsbridgenetwork",
"/var/containers/Bundle/Application/" + GenGUId(deviceId, GetCid(0x098521236654)) + "/WeChat.app/Frameworks/matrixreport.framework/matrixreport",
}
fileUUid := []string{
"3A1D0388-6BDB-350C-8706-80E3D15AA7C7",
"A7DA401B-3FF6-3920-A30A-1B0FA8258202",
"10F1245A-68FD-310D-98B3-0CFD51760BDE",
"8FAE149B-602B-3B9D-A620-88EA75CE153F",
"05BD590C-4DF6-3EDB-8316-0C9783928DD0",
"CFED9A03-C881-3D50-B014-732D0A09879F",
"1E7F06D2-DD36-31A8-AF3B-00D62054E1F9",
}
for i := 0; i < 7; i++ {
appFile = append(appFile, filePath[i])
appFile = append(appFile, fileUUid[i])
}
appFileInfo.WriteString(strings.Join(appFile, ""))
encInt := baseutils.EncInt(int64(crc32.ChecksumIEEE(appFileInfo.Bytes())))
spamDataBody.Unknown60 = proto.String(fmt.Sprintf("%v", encInt))
spamDataBody.Unknown64 = proto.String(XorEncrypt(deviceToken.GetTrustResponseData().GetDeviceToken(), xorKey))
data, err := proto.Marshal(&spamDataBody)
if err != nil {
return nil, err
}
newClientCheckData := &wechat.NewClientCheckData{
C32CData: proto.Int64(int64(crc32.ChecksumIEEE(data))),
TimeStamp: proto.Int64(time.Now().Unix()),
DataBody: data,
}
ccData, err := proto.Marshal(newClientCheckData)
if err != nil {
return nil, err
}
// afterCompressionCCData := baseutils.CompressByteArray(ccData)
// afterEnData, err := ccdata.EncodeZipData(afterCompressionCCData, 0x3060)
// if err != nil {
// return nil, err
// }
//压缩数据
compressdata := baseutils.AE(ccData)
// Zero: 03加密改07加密
// zt := new(ZT)
// zt.Init()
// encData := zt.Encrypt(compressdata)
afterEnData := android.SaeEncrypt07(compressdata)
deviceRunningInfo := &wechat.DeviceRunningInfoNew{
Version: []byte("00000007"),
Type: proto.Uint32(1),
EncryptData: afterEnData,
Timestamp: proto.Uint32(uint32(dateTimeSramp)),
Unknown5: proto.Uint32(5),
Unknown6: proto.Uint32(0),
}
return proto.Marshal(deviceRunningInfo)
}
// 获取FilePathCrc
func GetFileInfo(deviceId string, xorKey byte, guid2 string) []*wechat.FileInfo {
return []*wechat.FileInfo{
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/WeChat", xorKey)),
Fileuuid: proto.String(XorEncrypt("3A1D0388-6BDB-350C-8706-80E3D15AA7C7", xorKey)),
},
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/Frameworks/mars.framework/mars", xorKey)),
Fileuuid: proto.String(XorEncrypt("A7DA401B-3FF6-3920-A30A-1B0FA8258202", xorKey)),
},
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/Frameworks/andromeda.framework/andromeda", xorKey)),
Fileuuid: proto.String(XorEncrypt("10F1245A-68FD-310D-98B3-0CFD51760BDE", xorKey)),
},
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/Frameworks/OpenSSL.framework/OpenSSL", xorKey)),
Fileuuid: proto.String(XorEncrypt("8FAE149B-602B-3B9D-A620-88EA75CE153F", xorKey)),
},
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/Frameworks/ProtobufLite.framework/ProtobufLite", xorKey)),
Fileuuid: proto.String(XorEncrypt("05BD590C-4DF6-3EDB-8316-0C9783928DD0", xorKey)),
},
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/Frameworks/marsbridgenetwork.framework/marsbridgenetwork", xorKey)),
Fileuuid: proto.String(XorEncrypt("CFED9A03-C881-3D50-B014-732D0A09879F", xorKey)),
},
{
Filepath: proto.String(XorEncrypt("/var/containers/Bundle/Application/"+GenGUId(deviceId, GetCid(0x098521236654))+"/WeChat.app/Frameworks/matrixreport.framework/matrixreport", xorKey)),
Fileuuid: proto.String(XorEncrypt("1E7F06D2-DD36-31A8-AF3B-00D62054E1F9", xorKey)),
},
}
}
func DeviceNumber(DeviceId string) int64 {
/*ssss := strings.ToLower(baseutils.Md5Value(DeviceId))
ccc, _ := strconv.ParseInt(ssss, 16, 8)
ddd := ccc + 60000000000000000
if ddd > 80000000000000000 {
ddd = ddd - (80000000000000000 - ddd)
}
return int64(ddd)*/
ssss := []byte(baseutils.Md5Value(DeviceId))
ccc := Hex2int(&ssss) >> 8
ddd := ccc + 60000000000000000
if ddd > 80000000000000000 {
ddd = ddd - (80000000000000000 - ddd)
}
return int64(ddd)
}
func IOSDeviceNumber(DeviceId string) int64 {
ssss := []byte(baseutils.MD5ToLower(DeviceId))
ccc := Hex2int(&ssss) >> 8
ddd := ccc + 60000000000000000
if ddd > 80000000000000000 {
ddd = ddd - (80000000000000000 - ddd)
}
return int64(ddd)
}
func Hex2int(hexB *[]byte) uint64 {
var retInt uint64
hexLen := len(*hexB)
for k, v := range *hexB {
retInt += b2m_map[v] * exponent(16, uint64(2*(hexLen-k-1)))
}
return retInt
}
func exponent(a, n uint64) uint64 {
result := uint64(1)
for i := n; i > 0; i >>= 1 {
if i&1 != 0 {
result *= a
}
a *= a
}
return result
}
func GenGUId(DeviceId, Cid string) string {
Md5Data := baseutils.Md5Value(DeviceId + Cid)
return fmt.Sprintf("%x-%x-%x-%x-%x", Md5Data[0:8], Md5Data[2:6], Md5Data[3:7], Md5Data[1:5], Md5Data[20:32])
}
// IphoneWcstf
func GetWcstf(userName string) ([]byte, error) {
deviceRunningInfo := android.IphoneWcstf(userName)
return proto.Marshal(deviceRunningInfo)
}
func MakeXorKey(key int64) uint8 {
var un int64 = int64(0xffffffed)
xorKey := (uint8)(key*un + 7)
return xorKey
}
// /IphoneWcste
func GetWcste() ([]byte, error) {
deviceRunningInfo := android.IphoneWcste(0, 0)
// deviceRunningInfo := android.IphoneWcste(384214787666497617, 384002236977512448)
return proto.Marshal(deviceRunningInfo)
}
// 获取DeviceToken
func GetDeviceToken(deviceToken string) *mmproto.DeviceToken {
curtime := uint32(time.Now().Unix())
return &mmproto.DeviceToken{
Version: proto.String(""),
Encrypted: proto.Uint32(1),
Data: &mmproto.SKBuiltinStringt{
String_: proto.String(deviceToken),
},
TimeStamp: &curtime,
Optype: proto.Uint32(2),
Uin: proto.Uint32(0),
}
}
// 获取dt的数据
func GetZTData(DeviceId, DeviceType, OsVersion, DeviceName string, Version uint64) ([]byte, error) {
uuid1, uuid2 := baseutils.IOSUuid(DeviceId)
td := &wechat.TrustReq{
Td: &wechat.TrustData{
Tdi: []*wechat.TrustDeviceInfo{
{Key: proto.String("deviceid"), Val: proto.String(DeviceId)},
{Key: proto.String("sdi"), Val: proto.String(baseutils.IOSGetCidMd5(DeviceId, baseutils.IOSGetCid(0x0262626262626)))},
{Key: proto.String("idfv"), Val: proto.String(uuid1)},
{Key: proto.String("idfa"), Val: proto.String(uuid2)},
{Key: proto.String("device_model"), Val: proto.String(DeviceType)},
{Key: proto.String("os_version"), Val: proto.String(OsVersion)},
{Key: proto.String("core_count"), Val: proto.String("6")},
{Key: proto.String("carrier_name"), Val: proto.String("")},
{Key: proto.String("is_jailbreak"), Val: proto.String("0")},
{Key: proto.String("device_name"), Val: proto.String(DeviceName)},
{Key: proto.String("client_version"), Val: proto.String(fmt.Sprintf("%v", Version))},
{Key: proto.String("plist_version"), Val: proto.String(fmt.Sprintf("%v", Version))},
{Key: proto.String("language"), Val: proto.String("zh")},
{Key: proto.String("locale_country"), Val: proto.String("CN")},
{Key: proto.String("screen_width"), Val: proto.String("834")},
{Key: proto.String("screen_height"), Val: proto.String("1112")},
{Key: proto.String("install_time"), Val: proto.String("1586355322")},
{Key: proto.String("kern_boottime"), Val: proto.String("1586355519000")},
},
},
}
// 压缩
pbReq, _ := proto.Marshal(td)
zipData := baseutils.CompressByteArray(pbReq)
// retData, err := ccdata.EncodeZipData(zipData, 0x3060)
retData := android.SaeEncrypt07(zipData)
//fmt.Println(hex.EncodeToString(pbReq))
ztd := &wechat.ZTData{
Data: retData,
Version: []byte("00000007"),
Encrypted: proto.Uint64(1),
OpType: proto.Uint64(5),
TimeStamp: proto.Int64(time.Now().Unix()),
Uin: proto.Uint64(0),
}
return proto.Marshal(ztd)
}
// / <summary>
// / 获取UUid
// / </summary>
// / <param name="data"></param>
// / <returns></returns>
func GetUUID(data string) string {
data = data[:8] + "-" + data[8:]
data = data[:13] + "-" + data[13:]
data = data[:18] + "-" + data[18:]
data = data[:23] + "-" + data[23:]
return data
}
var wifiPrefix = []string{"TP_", "360_", "ChinaNet-", "MERCURY_", "DL-", "VF_", "HUAW-"}
func BuildRandomWifiSsid() string {
s := rand.NewSource(time.Now().UnixNano())
r := rand.New(s)
i := r.Intn(len(wifiPrefix))
randChar := make([]byte, 6)
for x := 0; x < 6; x++ {
randChar[x] = byte(r.Intn(26) + 65)
}
return wifiPrefix[i] + string(randChar)
}
// RqtKey 计算RQT用到到Key
var RqtKey = []byte{0x6a, 0x66, 0x4d, 0x5d, 0x53, 0x7c, 0x25, 0x3f, 0x73, 0x6e, 0x48, 0x27, 0x3a, 0x29, 0x5e, 0x4f}
// SignRqtBufByAutoChosenKey 计算RQT值
func SignRqtBufByAutoChosenKey(md5Value string) uint32 {
// tmpRqtKeyOne
rqtLen := len(RqtKey)
totalLength := 48 + rqtLen
blockOne := make([]byte, totalLength)
for index := 0; index < totalLength; index++ {
blockOne[index] = 0
if index < rqtLen {
blockOne[index] = RqtKey[index]
}
blockOne[index] = blockOne[index] ^ 0x36
}
// tmpRqtKeyTwo
blockTwo := make([]byte, totalLength)
for index := 0; index < totalLength; index++ {
blockTwo[index] = 0
if index < rqtLen {
blockTwo[index] = RqtKey[index]
}
blockTwo[index] = blockTwo[index] ^ 0x5c
}
// 计算Hash值
tmpData := append(blockOne, []byte(md5Value)[0:]...)
shaValue := baseutils.Sha1(tmpData)
tmpData = append(blockTwo, shaValue[0:]...)
shaValue = baseutils.Sha1(tmpData)
// 计算key1key2, key3
key1 := 0
key2 := 0
key3 := 0
tmpLen := len(shaValue) - 2
for index := 0; index < tmpLen; index++ {
tmpValue1 := shaValue[index] & 0xff
tmpValue2 := shaValue[index+1] & 0xff
tmpValue3 := shaValue[index+2] & 0xff
key1 = key1*0x83 + int(tmpValue1)
key2 = key2*0x83 + int(tmpValue2)
key3 = key3*0x83 + int(tmpValue3)
}
// 计算RQT值
key1 = key1 & 0x7f
key2 = (key2 << 8) & 0x7f00
key3 = (key3 << 16) & 0x7f0000
retValue := key1 | key3 | key2
retValue = retValue | 0x21000000
return uint32(retValue)
}
// 新 rqtx 07算法 版本24算法的计算extinfo
func GetNew07SpamData(iosVersion string, deviceType, uuid1, uuid2, deviceName string, deviceToken *wechat.TrustResp, deviceId, userName, guid2 string) ([]byte, error) {
timeStamp := time.Now().Unix()
afterEnData := GetiPhoneNewSpamData(iosVersion, uuid1, uuid2, deviceId, deviceName, deviceToken)
deviceRunningInfo := &wechat.DeviceRunningInfoNew{
EncryptData: afterEnData,
Version: []byte("00000007"),
Type: proto.Uint32(1),
Timestamp: proto.Uint32(uint32(timeStamp)),
Unknown5: proto.Uint32(5),
Unknown6: proto.Uint32(0),
}
return proto.Marshal(deviceRunningInfo)
}
// iphone生成ccd, 使用07加密
func GetiPhoneNewSpamData(iosVersion, uuid1, uuid2, Deviceid, DeviceName string, DeviceToken *wechat.TrustResp) []byte {
timeStamp := int(time.Now().Unix())
xorKey := uint8((timeStamp * 0xffffffed) + 7)
if len(Deviceid) < 32 {
Dlen := 32 - len(Deviceid)
Fill := "ff95DODUJ4EysYiogKZSmajWCUKUg9RX"
Deviceid = Deviceid + Fill[:Dlen]
}
spamDataBody := &wechat.SpamDataIosBody{
UnKnown1: proto.Int32(1),
TimeStamp: proto.Uint32(uint32(timeStamp)),
KeyHash: proto.Int32(int32(MakeKeyHash(xorKey))),
Yes1: proto.String(XorEncodeStr("yes", xorKey)),
Yes2: proto.String(XorEncodeStr("yes", xorKey)),
IosVersion: proto.String(XorEncodeStr(baseinfo.IPadOsVersion, xorKey)),
DeviceType: proto.String(XorEncodeStr("iPad", xorKey)),
UnKnown2: proto.Int32(2),
IdentifierForVendor: proto.String(XorEncodeStr(uuid1, xorKey)),
AdvertisingIdentifier: proto.String(XorEncodeStr(uuid2, xorKey)),
Carrier: proto.String(XorEncodeStr("中国移动", xorKey)),
BatteryInfo: proto.Int32(1),
NetworkName: proto.String(XorEncodeStr("en0", xorKey)),
NetType: proto.Int32(1),
AppBundleId: proto.String(XorEncodeStr("com.tencent.xin", xorKey)),
DeviceName: proto.String(XorEncodeStr(DeviceName, xorKey)),
UserName: proto.String(XorEncodeStr(baseinfo.IPhoneModel, xorKey)),
Unknown3: proto.Int64(IOSDeviceNumber(Deviceid[:29] + "FFF")),
Unknown4: proto.Int64(IOSDeviceNumber(Deviceid[:29] + "OOO")),
Unknown5: proto.Int32(1),
Unknown6: proto.Int32(4),
Lang: proto.String(XorEncodeStr("zh", xorKey)),
Country: proto.String(XorEncodeStr("CN", xorKey)),
Unknown7: proto.Int32(4),
DocumentDir: proto.String(XorEncodeStr("/var/mobile/Containers/Data/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x10101201))+"/Documents", xorKey)),
Unknown8: proto.Int32(0),
Unknown9: proto.Int32(0),
HeadMD5: proto.String(XorEncodeStr(IOSGetCidMd5(Deviceid, IOSGetCid(0x0262626262626)), xorKey)),
AppUUID: proto.String(XorEncodeStr(uuid1, xorKey)),
SyslogUUID: proto.String(XorEncodeStr(uuid2, xorKey)),
Unknown10: proto.String(""),
Unknown11: proto.String(""),
AppName: proto.String(XorEncodeStr("微信", xorKey)),
SshPath: proto.String(""),
TempTest: proto.String(""),
DevMD5: proto.String(""),
DevUser: proto.String(""),
Unknown12: proto.String(""),
IsModify: proto.Int32(0),
ModifyMD5: proto.String(""),
RqtHash: proto.Int64(288529533794259264),
Unknown43: proto.Uint64(1586355322),
Unknown44: proto.Uint64(1586355519000),
Unknown45: proto.Uint64(0),
Unknown46: proto.Uint64(288529533794259264),
Unknown47: proto.Uint64(0),
Unknown48: proto.String(Deviceid),
Unknown49: proto.String(""),
Unknown50: proto.String(""),
Unknown51: proto.String(XorEncodeStr(DeviceToken.GetTrustResponseData().GetSoftData().GetSoftConfig(), xorKey)),
Unknown52: proto.Uint64(0),
Unknown53: proto.String(""),
Unknown54: proto.String(XorEncodeStr(DeviceToken.GetTrustResponseData().GetDeviceToken(), xorKey)),
}
wxFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/WeChat", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000001)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, wxFile)
opensslFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/Frameworks/OpenSSL.framework/OpenSSL", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000002)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, opensslFile)
protoFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/Frameworks/ProtobufLite.framework/ProtobufLite", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000003)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, protoFile)
marsbridgenetworkFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/Frameworks/marsbridgenetwork.framework/marsbridgenetwork", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000004)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, marsbridgenetworkFile)
matrixreportFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/Frameworks/matrixreport.framework/matrixreport", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000005)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, matrixreportFile)
andromedaFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/Frameworks/andromeda.framework/andromeda", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000006)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, andromedaFile)
marsFile := &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/"+IOSGetCidUUid(Deviceid, IOSGetCid(0x098521236654))+"/WeChat.app/Frameworks/mars.framework/mars", xorKey)),
Filepath: proto.String(XorEncodeStr(IOSGetCidUUid(Deviceid, IOSGetCid(0x30000007)), xorKey)),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, marsFile)
srcdata, _ := proto.Marshal(spamDataBody)
newClientCheckData := &wechat.NewClientCheckData{
C32CData: proto.Int64(int64(crc32.ChecksumIEEE([]byte(srcdata)))),
TimeStamp: proto.Int64(int64(timeStamp)),
DataBody: srcdata,
}
ccddata, _ := proto.Marshal(newClientCheckData)
//压缩数据
compressdata := baseutils.AE(ccddata)
// Zero: 03加密改07加密
// zt := new(ZT)
// zt.Init()
// encData := zt.Encrypt(compressdata)
encData := android.SaeEncrypt07(compressdata)
return encData
}
func GetNewIPadSpamData(iosVersion string, deviceType, uuid1, uuid2, deviceName string, deviceToken *wechat.TrustResp, deviceId, userName, guid2 string) ([]byte, error) {
timeStamp := time.Now().Unix()
afterEnData := GetiPadNewSpamData(iosVersion, uuid1, uuid2, deviceId, deviceName, deviceToken)
deviceRunningInfo := &wechat.DeviceRunningInfoNew{
EncryptData: afterEnData,
Version: []byte("00000007"),
Type: proto.Uint32(1),
Timestamp: proto.Uint32(uint32(timeStamp)),
Unknown5: proto.Uint32(5),
Unknown6: proto.Uint32(0),
}
return proto.Marshal(deviceRunningInfo)
}
// ipad生成ccd, 使用03加密
func GetiPadNewSpamData(iosVersion, uuid1, uuid2, Deviceid, DeviceName string, DeviceToken *wechat.TrustResp) []byte {
T := uint32(time.Now().Unix())
timeStamp := int(T)
xorKey := uint8((timeStamp * 0xffffffed) + 7)
if len(Deviceid) < 32 {
Dlen := 32 - len(Deviceid)
Fill := "ff95DODUJ4EysYiogKZSmajWCUKUg9RX"
Deviceid = Deviceid + Fill[:Dlen]
}
spamDataBody := &wechat.SpamDataIosBody{
UnKnown1: proto.Int32(1),
TimeStamp: proto.Uint32(uint32(timeStamp)),
KeyHash: proto.Int32(int32(MakeKeyHash(xorKey))),
Yes1: proto.String(XorEncodeStr("yes", xorKey)),
Yes2: proto.String(XorEncodeStr("yes", xorKey)),
IosVersion: proto.String(XorEncodeStr(baseinfo.IPadOsVersion, xorKey)),
DeviceType: proto.String(XorEncodeStr("iPad", xorKey)),
UnKnown2: proto.Int32(6),
IdentifierForVendor: proto.String(XorEncodeStr(uuid1, xorKey)),
AdvertisingIdentifier: proto.String(XorEncodeStr(uuid2, xorKey)),
Carrier: proto.String(XorEncodeStr("中国移动", xorKey)),
BatteryInfo: proto.Int32(1),
NetworkName: proto.String(XorEncodeStr("en0", xorKey)),
NetType: proto.Int32(0),
AppBundleId: proto.String(XorEncodeStr("com.tencent.xin", xorKey)),
DeviceName: proto.String(XorEncodeStr(DeviceName, xorKey)),
UserName: proto.String(XorEncodeStr(baseinfo.IPadModel, xorKey)),
Unknown3: proto.Int64(77968568554095637),
Unknown4: proto.Int64(77968568554095617),
Unknown5: proto.Int32(5),
Unknown6: proto.Int32(4),
Lang: proto.String(XorEncodeStr("zh", xorKey)),
Country: proto.String(XorEncodeStr("CN", xorKey)),
Unknown7: proto.Int32(4),
DocumentDir: proto.String(XorEncodeStr("/var/mobile/Containers/Data/Application/94E41585-A27E-4933-AF06-5ABF7C774A6F/Documents", xorKey)),
Unknown8: proto.Int32(0),
Unknown9: proto.Int32(1),
HeadMD5: proto.String(XorEncodeStr("901bf05e51e2cb5585760f7e0116d0ba", xorKey)),
AppUUID: proto.String(XorEncodeStr(uuid1, xorKey)),
SyslogUUID: proto.String(""),
Unknown10: proto.String(""),
Unknown11: proto.String(""),
AppName: proto.String(XorEncodeStr("微信", xorKey)),
SshPath: proto.String(""),
TempTest: proto.String(""),
DevMD5: proto.String(""),
DevUser: proto.String(""),
Unknown12: proto.String(""),
IsModify: proto.Int32(0),
ModifyMD5: proto.String(""),
RqtHash: proto.Int64(288530629010980929),
Unknown43: proto.Uint64(1586355322),
Unknown44: proto.Uint64(1586355519000),
Unknown45: proto.Uint64(0),
Unknown46: proto.Uint64(288530629010980929),
Unknown47: proto.Uint64(1),
Unknown48: proto.String(XorEncodeStr(Deviceid, xorKey)),
Unknown49: proto.String(""),
Unknown50: proto.String(""),
Unknown51: proto.String(XorEncodeStr(DeviceToken.GetTrustResponseData().GetSoftData().GetSoftConfig(), xorKey)),
Unknown52: proto.Uint64(0),
Unknown53: proto.String(""),
Unknown54: proto.String(XorEncodeStr(DeviceToken.GetTrustResponseData().GetDeviceToken(), xorKey)),
AppFileInfo: make([]*wechat.FileInfo, 0),
}
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/WeChat", xorKey)),
Filepath: proto.String(XorEncodeStr("7195B97E-9078-3119-9110-8BDA959283F0", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/Library/MobileSubstrate/MobileSubstrate.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("3134CFB2-F722-310E-A2C7-42AE4DC131AB", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/mars.framework/mars", xorKey)),
Filepath: proto.String(XorEncodeStr("A87DAD8E-E356-3E1E-9925-D63EA1614A95", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/andromeda.framework/andromeda", xorKey)),
Filepath: proto.String(XorEncodeStr("EB5B920E-3AE6-3534-9DA4-C32DF72E33BD", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/OpenSSL.framework/OpenSSL", xorKey)),
Filepath: proto.String(XorEncodeStr("8FAE149B-602B-3B9D-A620-88EA75CE153F", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/ProtobufLite.framework/ProtobufLite", xorKey)),
Filepath: proto.String(XorEncodeStr("6F0D3077-4301-3D8F-8579-E34902547580", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/marsbridgenetwork.framework/marsbridgenetwork", xorKey)),
Filepath: proto.String(XorEncodeStr("CFED9A03-C881-3D50-B014-732D0A09879F", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/matrixreport.framework/matrixreport", xorKey)),
Filepath: proto.String(XorEncodeStr("1E7F06D2-DD36-31A8-AF3B-00D62054E1F9", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftCore.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("AD0CAD3B-1B51-3327-8644-8BE1FF1F0AE9", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftDispatch.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("9FCBA8ED-D8FD-3C16-9740-5E2A31F3E959", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftFoundation.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("9702769F-1F06-3001-AB75-5AD38E1F7D66", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftObjectiveC.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("1180AC10-0A92-39DB-8497-2B6D4217B8EB", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftDarwin.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("999C2967-8A06-3CD5-82D7-D156E9440A0C", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftCoreGraphics.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("DC548EF9-00F9-3A15-B5DB-05E39D9B5C5B", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/private/var/containers/Bundle/Application/2F493AE2-C0EB-4B4E-A86C-CE9BA3C0FA14/WeChat.app/Frameworks/libswiftCoreFoundation.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("25114AE1-4AE9-3DBC-B3DE-7F9F9A5B45D2", xorKey)),
})
spamDataBody.AppFileInfo = append(spamDataBody.AppFileInfo, &wechat.FileInfo{
Fileuuid: proto.String(XorEncodeStr("/Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLoader.dylib", xorKey)),
Filepath: proto.String(XorEncodeStr("54645DC0-3212-31D8-8A02-2FD67A793278", xorKey)),
})
srcdata, _ := proto.Marshal(spamDataBody)
newClientCheckData := &wechat.NewClientCheckData{
C32CData: proto.Int64(int64(crc32.ChecksumIEEE([]byte(srcdata)))),
TimeStamp: proto.Int64(time.Now().Unix()),
DataBody: srcdata,
}
ccddata, _ := proto.Marshal(newClientCheckData)
//压缩数据
compressdata := baseutils.AE(ccddata)
// Zero: 03加密改07加密
// zt := new(ZT)
// zt.Init()
// encData := zt.Encrypt(compressdata)
afterEnData := android.SaeEncrypt07(compressdata)
// afterCompressionCCData := baseutils.CompressByteArray(ccddata)
// afterEnData, _ := ccdata.EncodeZipData(afterCompressionCCData, 0x3060)
return afterEnData
}
+348
View File
@@ -0,0 +1,348 @@
package extinfo
import (
"bytes"
"crypto/md5"
"encoding/binary"
"encoding/hex"
"fmt"
)
func MakeKeyHash(key byte) int {
a, b := int(0), int(0)
aResult, bResult := int(0), int(0)
for i := 0; i < 16; i++ {
a = 1 << (2 * i)
b = 1 << (2*i + 1)
a &= int(key)
b &= int(key)
a <<= 2 * i
b <<= 2*i + 1
aResult |= a
bResult |= b
}
return aResult | bResult
}
func XorEncrypt(msg string, key uint8) (output string) {
/*chars := make([]byte, len(input))
for i, v := range input {
chars[i] = key ^ uint8(v)
}
return string(chars)*/
ml := len(msg)
pwd := ""
for i := 0; i < ml; i++ {
pwd += string(rune(key ^ uint8(msg[i])))
}
return pwd
}
func XorEncodeStr(msg string, key uint8) string {
ml := len(msg)
pwd := ""
for i := 0; i < ml; i++ {
pwd += string(rune(key ^ uint8(msg[i])))
//pwd += string(key ^ uint8(msg[i]))
}
return pwd
}
var b2m_map map[byte]uint64 = map[byte]uint64{
0x00: 0,
0x01: 1,
0x02: 2,
0x03: 3,
0x04: 4,
0x05: 5,
0x06: 6,
0x07: 7,
0x08: 8,
0x09: 9,
0x0A: 10,
0x0B: 11,
0x0C: 12,
0x0D: 13,
0x0E: 14,
0x0F: 15,
0x10: 16,
0x11: 17,
0x12: 18,
0x13: 19,
0x14: 20,
0x15: 21,
0x16: 22,
0x17: 23,
0x18: 24,
0x19: 25,
0x1A: 26,
0x1B: 27,
0x1C: 28,
0x1D: 29,
0x1E: 30,
0x1F: 31,
0x20: 32,
0x21: 33,
0x22: 34,
0x23: 35,
0x24: 36,
0x25: 37,
0x26: 38,
0x27: 39,
0x28: 40,
0x29: 41,
0x2A: 42,
0x2B: 43,
0x2C: 44,
0x2D: 45,
0x2E: 46,
0x2F: 47,
0x30: 48,
0x31: 49,
0x32: 50,
0x33: 51,
0x34: 52,
0x35: 53,
0x36: 54,
0x37: 55,
0x38: 56,
0x39: 57,
0x3A: 58,
0x3B: 59,
0x3C: 60,
0x3D: 61,
0x3E: 62,
0x3F: 63,
0x40: 64,
0x41: 65,
0x42: 66,
0x43: 67,
0x44: 68,
0x45: 69,
0x46: 70,
0x47: 71,
0x48: 72,
0x49: 73,
0x4A: 74,
0x4B: 75,
0x4C: 76,
0x4D: 77,
0x4E: 78,
0x4F: 79,
0x50: 80,
0x51: 81,
0x52: 82,
0x53: 83,
0x54: 84,
0x55: 85,
0x56: 86,
0x57: 87,
0x58: 88,
0x59: 89,
0x5A: 90,
0x5B: 91,
0x5C: 92,
0x5D: 93,
0x5E: 94,
0x5F: 95,
0x60: 96,
0x61: 97,
0x62: 98,
0x63: 99,
0x64: 100,
0x65: 101,
0x66: 102,
0x67: 103,
0x68: 104,
0x69: 105,
0x6A: 106,
0x6B: 107,
0x6C: 108,
0x6D: 109,
0x6E: 110,
0x6F: 111,
0x70: 112,
0x71: 113,
0x72: 114,
0x73: 115,
0x74: 116,
0x75: 117,
0x76: 118,
0x77: 119,
0x78: 120,
0x79: 121,
0x7A: 122,
0x7B: 123,
0x7C: 124,
0x7D: 125,
0x7E: 126,
0x7F: 127,
0x80: 128,
0x81: 129,
0x82: 130,
0x83: 131,
0x84: 132,
0x85: 133,
0x86: 134,
0x87: 135,
0x88: 136,
0x89: 137,
0x8A: 138,
0x8B: 139,
0x8C: 140,
0x8D: 141,
0x8E: 142,
0x8F: 143,
0x90: 144,
0x91: 145,
0x92: 146,
0x93: 147,
0x94: 148,
0x95: 149,
0x96: 150,
0x97: 151,
0x98: 152,
0x99: 153,
0x9A: 154,
0x9B: 155,
0x9C: 156,
0x9D: 157,
0x9E: 158,
0x9F: 159,
0xA0: 160,
0xA1: 161,
0xA2: 162,
0xA3: 163,
0xA4: 164,
0xA5: 165,
0xA6: 166,
0xA7: 167,
0xA8: 168,
0xA9: 169,
0xAA: 170,
0xAB: 171,
0xAC: 172,
0xAD: 173,
0xAE: 174,
0xAF: 175,
0xB0: 176,
0xB1: 177,
0xB2: 178,
0xB3: 179,
0xB4: 180,
0xB5: 181,
0xB6: 182,
0xB7: 183,
0xB8: 184,
0xB9: 185,
0xBA: 186,
0xBB: 187,
0xBC: 188,
0xBD: 189,
0xBE: 190,
0xBF: 191,
0xC0: 192,
0xC1: 193,
0xC2: 194,
0xC3: 195,
0xC4: 196,
0xC5: 197,
0xC6: 198,
0xC7: 199,
0xC8: 200,
0xC9: 201,
0xCA: 202,
0xCB: 203,
0xCC: 204,
0xCD: 205,
0xCE: 206,
0xCF: 207,
0xD0: 208,
0xD1: 209,
0xD2: 210,
0xD3: 211,
0xD4: 212,
0xD5: 213,
0xD6: 214,
0xD7: 215,
0xD8: 216,
0xD9: 217,
0xDA: 218,
0xDB: 219,
0xDC: 220,
0xDD: 221,
0xDE: 222,
0xDF: 223,
0xE0: 224,
0xE1: 225,
0xE2: 226,
0xE3: 227,
0xE4: 228,
0xE5: 229,
0xE6: 230,
0xE7: 231,
0xE8: 232,
0xE9: 233,
0xEA: 234,
0xEB: 235,
0xEC: 236,
0xED: 237,
0xEE: 238,
0xEF: 239,
0xF0: 240,
0xF1: 241,
0xF2: 242,
0xF3: 243,
0xF4: 244,
0xF5: 245,
0xF6: 246,
0xF7: 247,
0xF8: 248,
0xF9: 249,
0xFA: 250,
0xFB: 251,
0xFC: 252,
0xFD: 253,
0xFE: 254,
0xFF: 255,
}
func GetCidMd5(DeviceId, Cid string) string {
Md5Data := MD5ToLower(DeviceId + Cid)
return "A136" + Md5Data[5:]
}
func IOSGetCidMd5(DeviceId, Cid string) string {
Md5Data := MD5ToLower(DeviceId + Cid)
return "A136" + Md5Data[5:]
}
func IOSGetCidUUid(DeviceId, Cid string) string {
Md5Data := MD5ToLower(DeviceId + Cid)
return fmt.Sprintf("%x-%x-%x-%x-%x", Md5Data[0:8], Md5Data[2:6], Md5Data[3:7], Md5Data[1:5], Md5Data[20:32])
}
func IOSGetCid(s int) string {
M := inttobytes(s >> 12)
return hex.EncodeToString(M)
}
func MD5ToLower(str string) string {
h := md5.New()
h.Write([]byte(str))
return hex.EncodeToString(h.Sum(nil))
}
func GetCid(s int) string {
M := inttobytes(s >> 12)
return hex.EncodeToString(M)
}
func inttobytes(n int) []byte {
x := int32(n)
bytesBuffer := bytes.NewBuffer([]byte{})
binary.Write(bytesBuffer, binary.BigEndian, x)
return bytesBuffer.Bytes()
}