oicq-icalingua-plus-plus 1.23.26 → 1.23.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -167,8 +167,8 @@ class Client extends EventEmitter {
167
167
  this.logger.level = config.log_level;
168
168
 
169
169
  this.logger.mark("----------");
170
- this.logger.mark(`Package Version: oicq@${version.version} (Released on ${version.upday})`);
171
- this.logger.mark("View Changelogs:https://github.com/takayama-lily/oicq/releases");
170
+ this.logger.mark(`Package Version: oicq-icalingua-plus-plus@${version.version} (Released on ${version.upday})`);
171
+ this.logger.mark("View Changelogs:https://github.com/Icalingua-plus-plus/oicq-icalingua-plus-plus/commits");
172
172
  this.logger.mark("----------");
173
173
 
174
174
  const filepath = path.join(this.dir, `device-${uin}.json`);
package/lib/device.js CHANGED
@@ -121,6 +121,7 @@ function getDeviceInfo(filepath, uin) {
121
121
  device.guid = md5(Buffer.concat([Buffer.from(device.imei), Buffer.from(device.mac_address)]));
122
122
  device.qimei16 = "";
123
123
  device.qimei36 = "";
124
+ device.mtime = Math.floor(fs.statSync(filepath).mtimeMs || Date.now());
124
125
  return device;
125
126
  }
126
127
 
@@ -131,7 +132,7 @@ const apk = {
131
132
  //android phone
132
133
  1: {
133
134
  id: "com.tencent.mobileqq",
134
- name: "A8.9.33.10335",
135
+ name: "A8.9.33.2045045f",
135
136
  version: "8.9.33.10335",
136
137
  ver: "8.9.33",
137
138
  sign: Buffer.from([166, 183, 69, 191, 36, 162, 194, 119, 82, 119, 22, 246, 243, 110, 182, 141]),
@@ -147,16 +148,16 @@ const apk = {
147
148
  //android watch
148
149
  3: {
149
150
  id: "com.tencent.qqlite",
150
- name: "A2.0.5",
151
- version: "2.0.5",
152
- ver: "2.0.5",
151
+ name: "A2.0.8",
152
+ version: "2.0.8",
153
+ ver: "2.0.8",
153
154
  sign: Buffer.from([166, 183, 69, 191, 36, 162, 194, 119, 82, 119, 22, 246, 243, 110, 182, 141]),
154
155
  buildtime: 1559564731,
155
156
  appid: 16,
156
- subid: 537064446,
157
+ subid: 537065138,
157
158
  bitmap: 16252796,
158
159
  sigmap: 16724722,
159
- sdkver: "6.0.0.2534",
160
+ sdkver: "6.0.0.2365",
160
161
  ssover: 5,
161
162
  },
162
163
 
package/lib/qimei.js CHANGED
@@ -52,8 +52,8 @@ function genRandomPayloadByDevice(info, apk) {
52
52
  "harmony": "0",
53
53
  "clone": "0",
54
54
  "containe": "",
55
- "oz": "UhYmelwouA+V2nPWbOvLTgN2/m8jwGB+yUB5v9tysQg=",
56
- "oo": "Xecjt+9S1+f8Pz2VLSxgpw==",
55
+ "oz": "",
56
+ "oo": "",
57
57
  "kelong": "0",
58
58
  "uptimes": dateFormat(),
59
59
  "multiUser": "0",
@@ -67,23 +67,48 @@ function genRandomPayloadByDevice(info, apk) {
67
67
  "kernel": info.fingerprint
68
68
  };
69
69
  let beaconId = "";
70
- const timeMonth = dateFormat().slice(0, 7) + "-01";
71
- const rand1 = rangeRand(900000, 100000)
72
- const rand2 = rangeRand(900000000, 100000000);
70
+ const timestamp = Date.now();
71
+ const mtime1 = new Date(info.mtime);
72
+ const mtimeStr1 = dateFormat("YYYY-mm-ddHHMMSS", mtime1) + "." + info.imei.slice(2, 11);
73
+ const mtime2 = new Date(info.mtime - parseInt(info.imei.slice(2, 4)));
74
+ const mtimeStr2 = dateFormat("YYYY-mm-ddHHMMSS", mtime2) + "." + info.imei.slice(5, 14);
73
75
  for (let i = 1; i <= 40; i++) {
74
- if ([1, 2, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30, 33, 34, 37, 38].includes(i)) {
75
- beaconId += `k${i}:${timeMonth}${rand1}.${rand2}`;
76
+ if ([1, 13, 14, 17, 18, 21, 33, 34, 37, 38].includes(i)) {
77
+ beaconId += `k${i}:${dateFormat("YYYY-mm-ddHHMMSS", new Date(timestamp + rangeRand(60, 0)))}.${String(rangeRand(99, 0)).padStart(2, '0')}0000000`;
78
+ } else if ([25, 26, 29, 30].includes(i)) {
79
+ const fixed = ((i === 25 ? 10 : 11) + parseInt(info.imei.slice(5, 7))) % 100;
80
+ const fixed_str = String(fixed).padStart(2, "0");
81
+ beaconId += `k${i}:${dateFormat("YYYY-mm-ddHHMMSS")}.${fixed_str}0000000`;
82
+ } else if (i === 2) {
83
+ beaconId += `k2:${mtimeStr1}`;
76
84
  } else if (i === 3) {
77
85
  beaconId += "k3:0000000000000000";
78
86
  } else if (i === 4) {
79
- beaconId += `k4:${randomBytes(8).toString("hex")}`;
87
+ beaconId += `k4:${md5(info.android_id + info.imei).toString("hex").slice(0, 16)}`;
88
+ } else if (i === 5) {
89
+ beaconId += `k5:${rangeRand(10000000, 1000000)}`;
90
+ } else if ([6, 7, 8].includes(i)) {
91
+ beaconId += `k${i}:${rangeRand(1000000, 100000)}`;
92
+ } else if (i === 9) {
93
+ beaconId += `k9:${info.boot_id}`;
94
+ } else if (i === 10) {
95
+ break;
96
+ } else if (i === 19) {
97
+ beaconId += `k19:${rangeRand(50000, 10000)}`;
98
+ } else if (i === 22) {
99
+ beaconId += `k22:${mtimeStr2}`;
100
+ } else if ([16, 20, 28, 36].includes(i)) {
101
+ beaconId += `k${i}:${rangeRand(100, 10)}`;
102
+ } else if ([23, 27, 31].includes(i)) {
103
+ beaconId += `k${i}:${rangeRand(10000, 1000)}`;
80
104
  } else {
81
- beaconId += `k${i}:${rangeRand(10000)}`;
105
+ beaconId += `k${i}:${rangeRand(5, 0)}`;
82
106
  }
83
107
  beaconId += ";";
84
108
  }
109
+ beaconId += "k10:1";
85
110
  return {
86
- "androidId": '',
111
+ "androidId": "",
87
112
  "platformId": 1,
88
113
  "appKey": "0S200MNJT807V3GE",
89
114
  "appVersion": apk.version,
@@ -92,8 +117,8 @@ function genRandomPayloadByDevice(info, apk) {
92
117
  "channelId": "2017",
93
118
  "cid": "",
94
119
  "imei": info.imei,
95
- "imsi": '',
96
- "mac": '',
120
+ "imsi": "",
121
+ "mac": info.mac_address,
97
122
  "model": info.model,
98
123
  "networkType": "unknown",
99
124
  "oaid": "",
@@ -123,7 +148,7 @@ async function getQIMEI(client) {
123
148
  const nonce = randomBytes(8).toString("hex");
124
149
  const payload = genRandomPayloadByDevice(client.device, client.apk);
125
150
  const str = JSON.stringify(payload);
126
- const params = aes.encrypt(str, k).toString('base64');
151
+ const params = aes.encrypt(str, k).toString("base64");
127
152
 
128
153
  const postData = {
129
154
  "key": key,
@@ -135,8 +160,8 @@ async function getQIMEI(client) {
135
160
  }
136
161
  const { data } = await axios.post("https://snowflake.qq.com/ola/android", postData, {
137
162
  headers: {
138
- 'User-Agent': `Dalvik/2.1.0 (Linux; U; Android ${client.device.version.release}; ${client.device.product} Build/${client.device.android_id.slice(0, 6)})`,
139
- 'Content-Type': "application/json"
163
+ "User-Agent": `Dalvik/2.1.0 (Linux; U; Android ${client.device.version.release}; ${client.device.product} Build/${client.device.android_id.slice(0, 6)})`,
164
+ "Content-Type": "application/json"
140
165
  }
141
166
  });
142
167
  if (data.code !== 0) {
package/lib/ref.d.ts CHANGED
@@ -39,6 +39,7 @@ export interface Device {
39
39
  guid: Buffer;
40
40
  qimei16: string;
41
41
  qimei36: string;
42
+ mtime: number;
42
43
  }
43
44
 
44
45
  export interface ApkInfo {
@@ -20,7 +20,7 @@ const Readable = require("stream").Readable;
20
20
  const { getQIMEI } = require("../qimei");
21
21
 
22
22
  WtLogin.prototype.passwordLogin = async function () {
23
- if (this.apk.ssover > 12 && (!this.device.qimei16 || !this.device.qimei36)) {
23
+ if (this.c.config.platform !== 5 && this.apk.ssover > 12 && (!this.device.qimei16 || !this.device.qimei36)) {
24
24
  const qimei = await getQIMEI(this);
25
25
  // 缓存一下,理论上每次获取是一样的
26
26
  this.device.qimei16 = qimei.q16;
@@ -58,7 +58,7 @@ WtLogin.prototype.passwordLogin = async function () {
58
58
  if (!this.password_md5)
59
59
  return this.fetchQrcode();
60
60
  const t = this.tlvPacker;
61
- let tlv_count = this.device.qimei16 ? 24 : 25;
61
+ let tlv_count = this.device.qimei16 ? 25 : 26;
62
62
  if (this.apk.ssover <= 12) tlv_count--;
63
63
  let writer = new Writer()
64
64
  .writeU16(9)
@@ -93,13 +93,13 @@ WtLogin.prototype.passwordLogin = async function () {
93
93
  .writeBytes(t(0x521))
94
94
  .writeBytes(t(0x525))
95
95
  if (this.apk.ssover > 12) {
96
- writer.writeBytes(t(0x544, 9)) // TODO: native t544
96
+ writer.writeBytes(t(0x544, "810_9")) // TODO: native t544
97
97
  }
98
98
  if (this.device.qimei16) {
99
99
  writer.writeBytes(t(0x545, this.device.qimei16))
100
100
  }
101
101
  writer
102
- //.writeBytes(t(0x548)) // TODO: PoW test data
102
+ .writeBytes(t(0x548))
103
103
  .writeBytes(t(0x542))
104
104
  const body = writer.read();
105
105
  this.sendLogin("wtlogin.login", body);
@@ -121,7 +121,7 @@ WtLogin.prototype.sliderLogin = function (ticket) {
121
121
  .writeBytes(t(0x116));
122
122
  if (this.sig.t547.length) writer.writeBytes(t(0x547));
123
123
  if (this.apk.ssover > 12) {
124
- writer.writeBytes(t(0x544, 2)) // TODO: native t544
124
+ writer.writeBytes(t(0x544, "810_2")) // TODO: native t544
125
125
  }
126
126
  const body = writer.read();
127
127
  this.sendLogin("wtlogin.login", body);
@@ -178,7 +178,7 @@ WtLogin.prototype.submitSMSCode = function (code) {
178
178
  .writeBytes(t(0x401))
179
179
  .writeBytes(t(0x198))
180
180
  if (this.apk.ssover > 12) {
181
- writer.writeBytes(t(0x544, 7)) // TODO: native t544
181
+ writer.writeBytes(t(0x544, "810_7")) // TODO: native t544
182
182
  }
183
183
  const body = writer.read();
184
184
  this.sendLogin("wtlogin.login", body);
@@ -326,7 +326,7 @@ const tlv_map = {
326
326
  0x542: function () {
327
327
  return new Writer().writeBytes(Buffer.from([0x4A, 0x02, 0x60, 0x01]));
328
328
  },
329
- 0x544: function (code = 9) {
329
+ 0x544: function (code = "810_9") {
330
330
  // TODO: native generate t544, login error 45
331
331
  if (this.sig.t544[code]) return new Writer().writeBytes(this.sig.t544[code]);
332
332
  return new Writer()
@@ -348,8 +348,28 @@ const tlv_map = {
348
348
  return new Writer().writeBytes(this.sig.t547);
349
349
  },
350
350
  0x548: function () {
351
- // TODO: PoW test data
352
- return new Writer().writeU8(0x01);
351
+ const src = crypto.randomBytes(128);
352
+ const srcNum = BigInt('0x' + src.toString("hex"));
353
+ const cnt = 10000;
354
+ const dstNum = srcNum + BigInt(cnt);
355
+ const dst = Buffer.from(dstNum.toString(16), "hex");
356
+ const tgt = crypto.createHash("sha256").update(dst).digest();
357
+ const writer = new Writer()
358
+ .writeU8(1) //version
359
+ .writeU8(2) //typ
360
+ .writeU8(1) //hashType
361
+ .writeU8(2) //ok
362
+ .writeU16(10) //maxIndex
363
+ .writeBytes(Buffer.from([0, 0])) //reserveBytes
364
+ .writeTlv(src)
365
+ .writeTlv(tgt)
366
+ const cpy = writer.read();
367
+ const t546 = writer
368
+ .writeBytes(cpy)
369
+ .writeTlv(cpy)
370
+ .read();
371
+ const t548 = this.calcPoW(t546);
372
+ return new Writer().writeBytes(t548);
353
373
  }
354
374
  };
355
375
 
package/lib/wtlogin/wt.js CHANGED
@@ -397,7 +397,7 @@ class WtLogin {
397
397
  .writeU32(4)
398
398
  .writeU16(this.ksid.length + 2)
399
399
  .writeBytes(this.ksid)
400
- .writeU32(4)
400
+ .writeWithLength(this.device.qimei16 || BUF0)
401
401
  .read();
402
402
  sso = new Writer().writeWithLength(sso).writeWithLength(body).read();
403
403
  if (type === 1)
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "oicq-icalingua-plus-plus",
3
3
  "app_name": "oicq-icalingua-plus-plus",
4
- "version": "1.23.26",
5
- "app_version": "1.23.26",
6
- "upday": "2023/03/14",
4
+ "version": "1.23.28",
5
+ "app_version": "1.23.28",
6
+ "upday": "2023/03/29",
7
7
  "protocol_version": "v11",
8
8
  "description": "oicq(https://github.com/takayama-lily/oicq) v1 for Icalingua++",
9
9
  "main": "index.js",