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
Hide 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
...
@@ -42,3 +42,4 @@ local.properties
# Maven publishing credits
# Maven publishing credits
keys.properties
keys.properties
/plugins/
/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
...
@@ -59,15 +59,16 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
7
)
// subCommand
writeShort
(
8
)
// subCommand
writeShort
(
7
)
// count of TLVs, probably ignored by server?TODO
writeShort
(
6
)
// count of TLVs, probably ignored by server?TODO
t8
(
2052
)
t8
(
2052
)
t104
(
client
.
t104
)
t104
(
client
.
t104
)
t116
(
150470524
,
66560
)
t116
(
150470524
,
66560
)
t174
(
t174
)
t174
(
t174
)
t17c
(
phoneNumber
.
toByteArray
())
t17a
(
9
)
t401
(
md5
(
client
.
device
.
guid
+
"1234567890123456"
.
toByteArray
()
+
t402
))
t197
(
byteArrayOf
(
0
.
toByte
()))
t19e
(
0
)
//==tlv408
//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) {
...
@@ -68,22 +68,38 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
val
flag3
=
readByte
().
toInt
()
val
flag3
=
readByte
().
toInt
()
check
(
flag3
==
0
)
{
"Illegal flag3. Expected 0, got $flag3"
}
check
(
flag3
==
0
)
{
"Illegal flag3. Expected 0, got $flag3"
}
<<<<<<<
Updated
upstream
val
uinAccount
=
readString
(
readInt
()
-
4
)
//uin
val
uinAccount
=
readString
(
readInt
()
-
4
)
//uin
=======
println
(
"uinAccount="
+
readString
(
readInt
()
-
4
))
//uin
>>>>>>>
Stashed
changes
//debugPrint("remaining")
//debugPrint("remaining")
(
if
(
flag2
==
2
)
{
(
if
(
flag2
==
2
)
{
<<<<<<<
Updated
upstream
//PacketLogger.verbose("SSO, 尝试使用 16 zero 解密.")
//PacketLogger.verbose("SSO, 尝试使用 16 zero 解密.")
=======
PacketLogger
.
verbose
(
"SSO, 尝试使用 16 zero 解密."
)
>>>>>>>
Stashed
changes
kotlin
.
runCatching
{
kotlin
.
runCatching
{
decryptBy
(
DECRYPTER_16_ZERO
).
also
{
PacketLogger
.
verbose
(
"成功使用 16 zero 解密"
)
}
decryptBy
(
DECRYPTER_16_ZERO
).
also
{
PacketLogger
.
verbose
(
"成功使用 16 zero 解密"
)
}
}
}
}
else
{
}
else
{
<<<<<<<
Updated
upstream
//PacketLogger.verbose("Uni, 尝试使用 d2Key 解密.")
//PacketLogger.verbose("Uni, 尝试使用 d2Key 解密.")
=======
PacketLogger
.
verbose
(
"Uni, 尝试使用 d2Key 解密."
)
>>>>>>>
Stashed
changes
kotlin
.
runCatching
{
kotlin
.
runCatching
{
decryptBy
(
D2Key
).
also
{
PacketLogger
.
verbose
(
"成功使用 d2Key 解密"
)
}
decryptBy
(
D2Key
).
also
{
PacketLogger
.
verbose
(
"成功使用 d2Key 解密"
)
}
}
}
}).
getOrElse
{
}).
getOrElse
{
<<<<<<<
Updated
upstream
PacketLogger
.
verbose
(
"解密失败, 尝试其他各种key"
)
PacketLogger
.
verbose
(
"解密失败, 尝试其他各种key"
)
=======
PacketLogger
.
verbose
(
"失败, 尝试其他各种key"
)
>>>>>>>
Stashed
changes
this
.
readBytes
().
tryDecryptOrNull
()
?.
toReadPacket
()
this
.
readBytes
().
tryDecryptOrNull
()
?.
toReadPacket
()
}
?.
debugPrint
(
"sso/uni body="
)
?.
let
{
}
?.
debugPrint
(
"sso/uni body="
)
?.
let
{
if
(
flag1
==
0
x0A
)
{
if
(
flag1
==
0
x0A
)
{
...
@@ -95,7 +111,11 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
...
@@ -95,7 +111,11 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
val
bytes
=
it
.
data
.
readBytes
()
val
bytes
=
it
.
data
.
readBytes
()
if
(
flag2
==
2
&&
it
.
packetFactory
!=
null
)
{
if
(
flag2
==
2
&&
it
.
packetFactory
!=
null
)
{
PacketLogger
.
debug
(
"Oicq Reuqest= "
+
bytes
.
toUHexString
())
PacketLogger
.
debug
(
"Oicq Reuqest= "
+
bytes
.
toUHexString
())
<<<<<<<
Updated
upstream
try
{
try
{
=======
try
{
>>>>>>>
Stashed
changes
bytes
.
toReadPacket
().
parseOicqResponse
{
bytes
.
toReadPacket
().
parseOicqResponse
{
if
(
it
.
packetFactory
.
commandName
==
"wtlogin.login"
)
{
if
(
it
.
packetFactory
.
commandName
==
"wtlogin.login"
)
{
DebugLogger
.
info
(
"服务器发来了 wtlogin.login. 正在解析 key"
)
DebugLogger
.
info
(
"服务器发来了 wtlogin.login. 正在解析 key"
)
...
@@ -129,7 +149,11 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
...
@@ -129,7 +149,11 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
}
}
}
}
}
}
<<<<<<<
Updated
upstream
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
=======
}
catch
(
e
:
Exception
){
>>>>>>>
Stashed
changes
e
.
printStackTrace
()
e
.
printStackTrace
()
}
}
}
else
// always discarded. 00 1C
}
else
// always discarded. 00 1C
...
@@ -165,9 +189,15 @@ private fun ByteReadPacket.parseOicqResponse(body: ByteReadPacket.() -> Unit) {
...
@@ -165,9 +189,15 @@ private fun ByteReadPacket.parseOicqResponse(body: ByteReadPacket.() -> Unit) {
val
packet
=
when
(
encryptionMethod
)
{
val
packet
=
when
(
encryptionMethod
)
{
4
->
{
// peer public key, ECDH
4
->
{
// peer public key, ECDH
var
data
=
this
.
decryptBy
(
shareKeyCalculatedByConstPubKey
,
0
,
this
.
readRemaining
-
1
)
var
data
=
this
.
decryptBy
(
shareKeyCalculatedByConstPubKey
,
0
,
this
.
readRemaining
-
1
)
<<<<<<<
Updated
upstream
data
.
read
{
data
.
read
{
println
(
"第一层解密: ${data.toUHexString()}"
)
println
(
"第一层解密: ${data.toUHexString()}"
)
val
peerShareKey
=
ECDH
.
calculateShareKey
(
loadPrivateKey
(
ecdhPrivateKeyS
),
readUShortLVByteArray
().
adjustToPublicKey
())
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
))
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