Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
0f1328ef
Commit
0f1328ef
authored
Jan 07, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add protocol overview
parent
479cd293
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
0 deletions
+115
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/README.md
...tlin/net/mamoe/mirai/qqandroid/network/protocol/README.md
+115
-0
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/README.md
0 → 100644
View file @
0f1328ef
# QQAndroid Protocol
## Overview
Note:
`head`
and
`body`
functions does nothing. They just work as
notations
PseudoCode:
```
OutgoingPacket {
head {
int remaining.length + 4
int 0x0A
byte 0x02
int extra data size + 4
byte[] extra data // initially={}
byte 0
int uinAccount.length + 4
byte[] uinAccount // =qqNumber.toString()
}
body { // encrypted by `ByteArray(16)` when login, after which by sessionKey
SSOPacket {
int head.size + 4
head {
int sequenceId
int subAppId
int subAppId
hex "01 00 00 00 00 00 00 00 00 00 01 00" // unknown values
int extraData.size + 4
byte[] extraData
int commandName.length + 4
byte[] commandName
int 4 + 4
int 0x02B05B8B
int imei.length + 4
byte[] imei
int 0 + 4
int ksid.length + 4
byte[] ksid
int 0 + 4
}
int body.size + 4
body {
OicqRequestPacket {
head {
byte 2 // head flag
short 27 + 2 + remaining.length
ushort client.protocolVersion // const 8001
ushort 0x0001
uint client.account.id
byte 3 // const
ubyte encryptMethod.value // [EncryptMethod]
byte 0 // const
int 2 // const
int client.appClientVersion
int 0 // const
}
body {
// only write one of the following two structures!!
// if encryption method is ECDH
EncryptionMethodECDH {
head {
byte 1
byte 1
byte[] [ECDH.privateKey]
short 258
short [ECDH.publicKey].size // always 49
byte[] [ECDH.publicKey]
}
body {
// real body
}
}
// if encryption method is SessionKey
EncryptionMethodSessionKey {
head {
byte 1
byte if (currentLoginState == 2) 3 else 2
fully key
short 258
short 0
}
body {
// real body
}
}
}
tail {
byte 3 // tail flag
}
}
}
}
}
}
```
## Packet bodies
### LoginPacket - SubCommand 9
**TO BE UPDATED**
PseudoCode:
```
short 9 // subCommand
tlvList {
}
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment