mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
update
This commit is contained in:
parent
8c2511c876
commit
e1f706f76d
@ -2,16 +2,16 @@
|
||||
|
||||
## Get_tlv_0006
|
||||
|
||||
C 构建包
|
||||
C 构建包, 近 C 使用
|
||||
|
||||
### Var
|
||||
#### Var
|
||||
type | var name | value/from
|
||||
---- | ---|---
|
||||
?bytes | MD51 | md5(raw password)
|
||||
?bytes | MD51 | md5(raw password)
|
||||
?bytes | MD52 | md5((MD51 + “ 00 00 00 00 ” + g_QQ).hextobytes())
|
||||
4bytes |m_loginIP | 服务器提供(Dispose_0825)
|
||||
16bytes| m_tgtgtKey| random
|
||||
### Packet data
|
||||
4bytes |m_loginIP | 服务器提供(Dispose_0825)
|
||||
16bytes| m_tgtgtKey| |
|
||||
#### Packet data
|
||||
|
||||
type | value
|
||||
---- | ---
|
||||
|
@ -14,7 +14,7 @@ C: 发送登录`08 25 31 01`
|
||||
|
||||
S: 回复`08 25 31 01`(ID与C发送的相同), 告诉C是否需 redirect
|
||||
|
||||
**Redirection**
|
||||
**[Redirection](Redirection.md)**
|
||||
|
||||
如果需要 redirect
|
||||
C: 发送 redirect 包`08 25 31 02`到新的服务器
|
||||
@ -46,10 +46,21 @@ S: 发送 `08 36 31 03` 告知登录结果.
|
||||
- g_clientKey
|
||||
- token38
|
||||
- token88
|
||||
- encryptionKey
|
||||
- encryptionKey
|
||||
|
||||
若不成功, 理由:
|
||||
- 需要验证码:
|
||||
//todo
|
||||
- 密码错误
|
||||
- 未知(重新登录)
|
||||
- 冻结
|
||||
- 账号不存在
|
||||
- 设备锁
|
||||
- 被回收
|
||||
|
||||
C: 回复 `08 28 04 34`
|
||||
Sample
|
||||
Sample
|
||||
|
||||
```text
|
||||
02 37 13 08 28 04 34 76 E4 B8 DD 02 00 00 00 01 2E 01 00 00 68 52 00 30 00 3A 00 38 BA 24 BF EA 76 94 2C 9B 91 A8 8F 0E 7C EC F5 41 77 3C B9 D4 95 50 F2 00 FD CB E3 48 36 FB 89 13 CE E4 EA 76 A2 2F 20 86 F6 0F E0 54 55 6E D4 0B 9B EA 07 6B E1 D4 87 56 F9 99 8F FA 12 8E 22 A6 5A 9D A6 DC C9 B6 5C 5A EC BE BF CC 38 BD E1 5A 23 21 CE 02 31 F1 E1 BD FB 8E 4D E9 59 E6 BB FB B2 36 0C 47 0A C0 F7 94 63 C3 2F AB 6E AE 00 01 1F 5F 60 8E B5 79 97 EB 10 59 A0 29 B3 3B 9C BA 5D 33 C4 2A 57 CA CF 94 7A 2D DD F7 B3 9C BC 65 5D D5 62 53 A8 1D D2 F1 5B DD D7 24 32 63 60 60 DD 33 1F 3A C0 71 38 86 BC 78 D3 7C 7A E1 97 71 AB B7 59 AD 27 32 D5 AF F3 DC 1B 7B 70 3B 08 C0 91 D8 BC F1 C4 DA E3 DA 86 A1 27 8A EE C3 5F D6 25 42 A0 CB 19 7F 08 80 F8 65 2C 27 31 B7 D4 85 C3 49 BD 99 48 FE A9 63 78 6D 18 C3 4E BB F7 8A C4 80 8C 8A 17 EB 47 AF 2A 12 73 71 08 A6 E7 C3 08 2B 9A 6F 8A C2 6C 3B 1A CF 05 D8 57 63 33 AC BD 45 98 C1 85 56 08 0F 9F 36 FD 60 69 BC D0 94 1A 11 4D C6 3E 78 1D F1 67 D2 1D C4 C8 17 2F DC F4 B6 4F 5F F5 EE 8B 73 68 AA 3B BA C6 94 C8 21 1E 95 6D C2 7A BE 8B 1D 92 21 8D 2C D8 B6 86 D1 30 BB 72 34 B9 A0 D2 2E 4C 98 3C 17 E2 B2 6A AD 75 E8 B0 DE F4 1A 6F 15 93 47 B3 4D DA 6F BE A3 47 D3 9B 58 2D 4B A3 76 0E 39 ED A5 C3 0A 34 BA 78 01 AE 20 A3 38 CE BA CD F6 D7 1B C9 E7 4C 83 6E 31 34 25 16 64 BA EE 4B 8D E7 0E 2F C8 08 72 50 AE 91 16 7F 68 14 60 7E D8 3F CC 26 2D F6 BC 65 72 C8 F4 EA 55 E6 1B E0 BF F4 9F 9C FD A9 93 B6 62 78 F0 A1 19 D2 87 6E B8 B7 E3 70 13 09 95 29 C9 05 EC 99 36 5C 96 47 C1 C4 06 5C 23 5C A3 AD B0 39 BC 70 75 3D AA E9 16 03 0E 62 1B D0 78 EA F2 5C FD 9C 04 D9 AB 75 00 F8 37 F1 A8 DD 7B 65 91 D3 58 DE C5 BA 9E AC 13 DE 35 BA 17 DC D1 AB A5 96 C4 99 81 8E 21 4B 2F C1 9B 4C E1 56 A7 5D AC 26 71 EC 49 F0 A6 B1 F5 43 EA AC BE E6 9F A0 C2 E1 68 35 97 7B 81 76 AF 9E BD BC A7 D8 9E FC C0 E8 21 B0 BA 20 6A D0 BD E7 00 59 06 61 A1 DF AA 9F BA F4 5D A6 7B 5B A1 D8 6B B5 E9 72 66 51 8A D3 CE 51 A9 08 C7 11 4B FB 29 2E 6C 48 5B 8A 50 C6 5D 3A C1 9E A1 51 B6 56 DD 6B F5 D2 FD AE AB A4 4A A8 1F 99 BA 7D 4F 62 D7 64 22 31 04 62 36 62 65 96 B3 5A 35 03
|
||||
```
|
||||
|
23
document/protocol/Password Verified.md
Normal file
23
document/protocol/Password Verified.md
Normal file
@ -0,0 +1,23 @@
|
||||
# TIM Protocol
|
||||
|
||||
## Password Verified
|
||||
|
||||
### S -> `08 25 31 02`(may be another)
|
||||
|
||||
#### Var
|
||||
type | var name | value/from
|
||||
---- | ---|---
|
||||
int |g_qq | qq number
|
||||
16bytes | tgtgtKey | |
|
||||
|
||||
#### Decryption
|
||||
|
||||
//todo
|
||||
|
||||
#### Packet data - Requiring
|
||||
|
||||
//todo
|
||||
|
||||
#### Packet data - Not Requiring
|
||||
|
||||
//todo
|
@ -1,19 +0,0 @@
|
||||
# TIM Protocol
|
||||
|
||||
## Redirection
|
||||
|
||||
S -> C
|
||||
|
||||
### Var
|
||||
type | var name | value/from
|
||||
---- | ---|---
|
||||
int |g_qq | qq number
|
||||
int| g_server| server ip
|
||||
### Packet data
|
||||
|
||||
skip 14
|
||||
if (flag == "08 25 31 02")
|
||||
data = decrypt (read 14..length-1, #redirectionKey)
|
||||
else
|
||||
data = decrypt (read 14..length-1, #_0825key)
|
||||
|
124
document/protocol/Redirection.md
Normal file
124
document/protocol/Redirection.md
Normal file
@ -0,0 +1,124 @@
|
||||
# TIM Protocol
|
||||
|
||||
## Redirection
|
||||
|
||||
### S -> `08 25 31 02`(may be another)
|
||||
|
||||
#### Decryption
|
||||
|
||||
skip 14 bytes
|
||||
if (flag == "08 25 31 02")
|
||||
data = decrypt (read bytes 14..length-1, #redirectionKey)
|
||||
else data = decrypt (read bytes 14..length-1, #_0825key)
|
||||
|
||||
#### Packet data - Requiring
|
||||
|
||||
**read byte == 0xFE**
|
||||
skip 94 bytes
|
||||
String serverIp = read 4 bytes and join them with separator "."
|
||||
|
||||
#### Packet data - Not Requiring
|
||||
|
||||
**read byte == 0x00**
|
||||
skip 4 bytes
|
||||
56bytes token0825 = read 56 bytes
|
||||
skip 6 bytes
|
||||
int loginTime = read int
|
||||
skip 1 byte
|
||||
String loginIP = read 4 bytes and join them with separator "."
|
||||
16bytes tgtgtKey = random 16 bytes
|
||||
|
||||
### C -> S - Requiring `08 25 31 02`
|
||||
|
||||
#### Var
|
||||
|
||||
type | var name | value/from
|
||||
---- | ---|---
|
||||
int | qq | |
|
||||
String | server ip | from redirection packet
|
||||
|
||||
#### Packet data
|
||||
|
||||
type | value
|
||||
---- | ---
|
||||
hex |#head
|
||||
hex |#ver
|
||||
hex |08 25 31 02
|
||||
int |qq
|
||||
hex |#fixver
|
||||
hex |#redirectionKey
|
||||
bytes |[TEA encrypted data](#tea-encrypted-data)
|
||||
|
||||
##### TEA encrypted data
|
||||
Key : #redirectionKey
|
||||
|
||||
type | value
|
||||
---- | ---
|
||||
hex |#_0825data0
|
||||
hex |#_0825data2
|
||||
int |qq
|
||||
hex |00 01 00 00 03 09 00 0C 00 01
|
||||
4bytes |g_server(split with "." and convert to byte)
|
||||
hex |01 6F A1 58 22 01 00 36 00 12 00 02 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 14 00 1D 01 03 00 19
|
||||
hex | #publicKey
|
||||
|
||||
#### Note
|
||||
|
||||
Send the packet to new server via port 8000
|
||||
|
||||
|
||||
### C -> S - Not Requiring(Submitting password) `08 36 31 03`
|
||||
|
||||
#### Var
|
||||
|
||||
type | var name | value/from
|
||||
---- | ---|---
|
||||
int | qq | |
|
||||
String | password | |
|
||||
String | device name | UTF8 encoding. Sample: DESKTOP-M19QRYU
|
||||
16bytes | tgtgtKey | |
|
||||
bytes | MD5_1 | md5(password)
|
||||
bytes | MD5_2 | md5(MD5_1 + bytes{0, 0, 0, 0}} + qq.tobytes)
|
||||
|
||||
#### Packet data
|
||||
|
||||
type | value
|
||||
---- | ---
|
||||
hex |#head
|
||||
hex |#ver
|
||||
hex |08 36 31 03
|
||||
int |qq
|
||||
hex |03 00 00 00 01 01 01 00 00 68 20 00 00 00 00 00 01 01 03 00 19
|
||||
hex |#publicKey
|
||||
hex | 00 00 00 10
|
||||
hex | EF 4A 36 6A 16 A8 E6 3D 2E EA BD 1F 98 C1 3C DA
|
||||
bytes |[TEA encrypted data](#tea-encrypted--data)
|
||||
|
||||
##### TEA encrypted data
|
||||
Key : #shareKey
|
||||
|
||||
type | value
|
||||
---- | ---
|
||||
hex |01 12
|
||||
hex |00 38
|
||||
int |token0825(from [Packet data - Not Requiring](#packet-data---not-requiring))
|
||||
hex |03 0F
|
||||
int | device name length + 2
|
||||
int | device name length
|
||||
bytes | device name
|
||||
hex | 00 05 00 06 00 02
|
||||
int | qq
|
||||
hex | 00 06 00 78
|
||||
bytes | [TLV0006](Get_tlv_0006.md) Using md5 that you just calculated in
|
||||
hex | fix = 00 15 00 30 00 01 01 27 9B C7 F5 00 10 65 03 FD 8B 00 00 00 00 00 00 00 00 00 00 00 00 02 90 49 55 33 00 10 15 74 C4 89 85 7A 19 F5 5E A9 C9 A3 5E 8A 5A 9B
|
||||
hex | 00 1A 00 40
|
||||
bytes | TEAEncrypt(fix, tgtgtKey)
|
||||
hex | #_0825data0
|
||||
hex | #_0825data2
|
||||
int | qq
|
||||
hex | 00 00 00 00
|
||||
hex | 01 03 00 14 00 01 00 10 60 C9 5D A7 45 70 04 7F 21 7D 84 50 5C 66 A5 C6 03 12 00 05 01 00 00 00 01 05 08 00 05 01 00 00 00 00 03 13 00 19 01 01 02 00 10 04 EA 78 D1 A4 FF CD CC 7C B8 D4 12 7D BB 03 AA
|
||||
hex | 00 00 00 00
|
||||
hex | 01 02 00 62 00 01 04 EB B7 C1 86 F9 08 96 ED 56 84 AB 50 85 2E 48 00 38 E9 AA 2B 4D 26 4C 76 18 FE 59 D5 A9 82 6A 0C 04 B4 49 50 D7 9B B1 FE 5D 97 54 8D 82 F3 22 C2 48 B9 C9 22 69 CA 78 AD 3E 2D E9 C9 DF A8 9E 7D 8C 8D 6B DF 4C D7 34 D0 D3 00 14
|
||||
bytes | CRCKey = random 16
|
||||
bytes | getCRC(CRCKey) //do it yourself
|
@ -2,14 +2,15 @@
|
||||
|
||||
## Touch
|
||||
|
||||
C -> S
|
||||
### C -> S
|
||||
|
||||
### Var
|
||||
#### Var
|
||||
type | var name | value/from
|
||||
---- | ---|---
|
||||
int |g_qq | qq number
|
||||
int| g_server| server ip
|
||||
### Packet data
|
||||
|
||||
#### Packet data
|
||||
|
||||
type | value
|
||||
---- | ---
|
||||
@ -34,5 +35,8 @@ hex | 00 00 00 00 03 09 00 08 00 01
|
||||
int | g_server
|
||||
hex | 00 02 00 36 00 12 00 02 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 14 00 1D 01 02 00 19
|
||||
hex | #publicKey
|
||||
TEA加密以上, key=MD52
|
||||
|
||||
TEA加密以上, key=MD52
|
||||
### S -> C
|
||||
|
||||
[Redirection](Redirection.md)
|
@ -20,7 +20,7 @@ import java.net.DatagramPacket
|
||||
import java.net.InetSocketAddress
|
||||
|
||||
/**
|
||||
* [number] is a QQ number.
|
||||
* A robot account.
|
||||
*
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ -35,7 +35,7 @@ class Robot(val number: Int, private val password: String) {
|
||||
field = value
|
||||
}
|
||||
|
||||
private lateinit var serverAddress: InetSocketAddress;
|
||||
private lateinit var serverAddress: InetSocketAddress
|
||||
|
||||
private lateinit var token00BA: ByteArray
|
||||
private lateinit var token0825: ByteArray
|
||||
@ -141,7 +141,7 @@ class Robot(val number: Int, private val password: String) {
|
||||
@ExperimentalUnsignedTypes
|
||||
@Throws(InterruptedException::class)
|
||||
fun connect(ip: String) {
|
||||
this.serverIP = ip;
|
||||
this.serverIP = ip
|
||||
val group = NioEventLoopGroup()
|
||||
try {
|
||||
val b = Bootstrap()
|
||||
|
Loading…
Reference in New Issue
Block a user