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
7b12a541
Commit
7b12a541
authored
Jan 29, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loginpacket correction
parent
b2542cd6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
.gitignore
.gitignore
+1
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt
...ai/qqandroid/network/protocol/packet/login/LoginPacket.kt
+6
-5
mirai-core-qqandroid/src/jvmTest/kotlin/androidPacketTests/serverToClient.kt
...d/src/jvmTest/kotlin/androidPacketTests/serverToClient.kt
+30
-0
No files found.
.gitignore
View file @
7b12a541
...
...
@@ -42,3 +42,4 @@ local.properties
# Maven publishing credits
keys.properties
/plugins/
/mirai-core-qqandroid/src/jvmTest/kotlin/
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt
View file @
7b12a541
...
...
@@ -59,15 +59,16 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
7
)
// subCommand
writeShort
(
7
)
// count of TLVs, probably ignored by server?TODO
writeShort
(
8
)
// subCommand
writeShort
(
6
)
// count of TLVs, probably ignored by server?TODO
t8
(
2052
)
t104
(
client
.
t104
)
t116
(
150470524
,
66560
)
t174
(
t174
)
t17c
(
phoneNumber
.
toByteArray
())
t401
(
md5
(
client
.
device
.
guid
+
"1234567890123456"
.
toByteArray
()
+
t402
))
t19e
(
0
)
//==tlv408
t17a
(
9
)
t197
(
byteArrayOf
(
0
.
toByte
()))
//t401(md5(client.device.guid + "12 34567890123456".toByteArray() + t402))
//t19e(0)//==tlv408
}
}
}
...
...
mirai-core-qqandroid/src/jvmTest/kotlin/androidPacketTests/serverToClient.kt
View file @
7b12a541
...
...
@@ -68,22 +68,38 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
val
flag3
=
readByte
().
toInt
()
check
(
flag3
==
0
)
{
"Illegal flag3. Expected 0, got $flag3"
}
<<<<<<<
Updated
upstream
val
uinAccount
=
readString
(
readInt
()
-
4
)
//uin
=======
println
(
"uinAccount="
+
readString
(
readInt
()
-
4
))
//uin
>>>>>>>
Stashed
changes
//debugPrint("remaining")
(
if
(
flag2
==
2
)
{
<<<<<<<
Updated
upstream
//PacketLogger.verbose("SSO, 尝试使用 16 zero 解密.")
=======
PacketLogger
.
verbose
(
"SSO, 尝试使用 16 zero 解密."
)
>>>>>>>
Stashed
changes
kotlin
.
runCatching
{
decryptBy
(
DECRYPTER_16_ZERO
).
also
{
PacketLogger
.
verbose
(
"成功使用 16 zero 解密"
)
}
}
}
else
{
<<<<<<<
Updated
upstream
//PacketLogger.verbose("Uni, 尝试使用 d2Key 解密.")
=======
PacketLogger
.
verbose
(
"Uni, 尝试使用 d2Key 解密."
)
>>>>>>>
Stashed
changes
kotlin
.
runCatching
{
decryptBy
(
D2Key
).
also
{
PacketLogger
.
verbose
(
"成功使用 d2Key 解密"
)
}
}
}).
getOrElse
{
<<<<<<<
Updated
upstream
PacketLogger
.
verbose
(
"解密失败, 尝试其他各种key"
)
=======
PacketLogger
.
verbose
(
"失败, 尝试其他各种key"
)
>>>>>>>
Stashed
changes
this
.
readBytes
().
tryDecryptOrNull
()
?.
toReadPacket
()
}
?.
debugPrint
(
"sso/uni body="
)
?.
let
{
if
(
flag1
==
0
x0A
)
{
...
...
@@ -95,7 +111,11 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
val
bytes
=
it
.
data
.
readBytes
()
if
(
flag2
==
2
&&
it
.
packetFactory
!=
null
)
{
PacketLogger
.
debug
(
"Oicq Reuqest= "
+
bytes
.
toUHexString
())
<<<<<<<
Updated
upstream
try
{
=======
try
{
>>>>>>>
Stashed
changes
bytes
.
toReadPacket
().
parseOicqResponse
{
if
(
it
.
packetFactory
.
commandName
==
"wtlogin.login"
)
{
DebugLogger
.
info
(
"服务器发来了 wtlogin.login. 正在解析 key"
)
...
...
@@ -129,7 +149,11 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
}
}
}
<<<<<<<
Updated
upstream
}
catch
(
e
:
Exception
)
{
=======
}
catch
(
e
:
Exception
){
>>>>>>>
Stashed
changes
e
.
printStackTrace
()
}
}
else
// always discarded. 00 1C
...
...
@@ -165,9 +189,15 @@ private fun ByteReadPacket.parseOicqResponse(body: ByteReadPacket.() -> Unit) {
val
packet
=
when
(
encryptionMethod
)
{
4
->
{
// peer public key, ECDH
var
data
=
this
.
decryptBy
(
shareKeyCalculatedByConstPubKey
,
0
,
this
.
readRemaining
-
1
)
<<<<<<<
Updated
upstream
data
.
read
{
println
(
"第一层解密: ${data.toUHexString()}"
)
val
peerShareKey
=
ECDH
.
calculateShareKey
(
loadPrivateKey
(
ecdhPrivateKeyS
),
readUShortLVByteArray
().
adjustToPublicKey
())
=======
data
.
read
{
println
(
"第一层解密: ${data.toUHexString()}"
)
val
peerShareKey
=
ECDH
.
calculateShareKey
(
loadPrivateKey
(
ecdhPrivateKeyS
),
readUShortLVByteArray
().
adjustToPublicKey
())
>>>>>>>
Stashed
changes
body
(
this
.
decryptBy
(
peerShareKey
))
}
}
...
...
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