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
2c108b17
Commit
2c108b17
authored
Sep 07, 2019
by
Him188moe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhanced output
parent
09495c0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
mirai-core/src/main/java/net/mamoe/mirai/network/RobotNetworkHandler.kt
.../main/java/net/mamoe/mirai/network/RobotNetworkHandler.kt
+1
-1
mirai-core/src/main/java/net/mamoe/mirai/network/packet/VerificationCode.kt
...n/java/net/mamoe/mirai/network/packet/VerificationCode.kt
+17
-11
mirai-core/src/main/java/net/mamoe/mirai/network/packet/login/ClientChangeOnlineStatusPacket.kt
...ai/network/packet/login/ClientChangeOnlineStatusPacket.kt
+5
-0
No files found.
mirai-core/src/main/java/net/mamoe/mirai/network/RobotNetworkHandler.kt
View file @
2c108b17
...
...
@@ -279,7 +279,7 @@ class RobotNetworkHandler(private val robot: Robot) : Closeable {
*/
inner
class
DebugHandler
:
PacketHandler
()
{
override
fun
onPacketReceived
(
packet
:
ServerPacket
)
{
if
(!
packet
.
javaClass
.
name
.
endsWith
(
"Encrypted"
))
{
if
(!
packet
.
javaClass
.
name
.
endsWith
(
"Encrypted"
)
&&
!
packet
.
javaClass
.
name
.
endsWith
(
"Raw"
)
)
{
robot
notice
"Packet received: $packet"
}
if
(
packet
is
ServerEventPacket
)
{
...
...
mirai-core/src/main/java/net/mamoe/mirai/network/packet/VerificationCode.kt
View file @
2c108b17
...
...
@@ -49,7 +49,7 @@ class ClientVerificationCodeTransmissionRequestPacket(
@PacketId
(
"00 BA 32"
)
@ExperimentalUnsignedTypes
class
ClientVerificationCodeSubmitPacket
(
private
val
packetId
:
Int
,
private
val
packetId
Last
:
Int
,
private
val
qq
:
Long
,
private
val
token0825
:
ByteArray
,
private
val
verificationCode
:
String
,
...
...
@@ -60,7 +60,7 @@ class ClientVerificationCodeSubmitPacket(
}
override
fun
encode
()
{
this
.
writeByte
(
packetId
)
//part of packet id
this
.
writeByte
(
packetId
Last
)
//part of packet id
this
.
writeQQ
(
qq
)
this
.
writeHex
(
Protocol
.
fixVer
)
...
...
@@ -84,6 +84,10 @@ class ClientVerificationCodeSubmitPacket(
it
.
writeHex
(
Protocol
.
key00BAFix
)
}
}
override
fun
getFixedId
():
String
{
return
this
.
idHex
+
" "
+
packetIdLast
}
}
@ExperimentalUnsignedTypes
...
...
@@ -120,12 +124,12 @@ fun main() {
@PacketId
(
"00 BA 31"
)
@ExperimentalUnsignedTypes
class
ClientVerificationCodeRefreshPacket
(
private
val
packetId
:
Int
,
private
val
packetId
Last
:
Int
,
private
val
qq
:
Long
,
private
val
token0825
:
ByteArray
)
:
ClientPacket
()
{
override
fun
encode
()
{
this
.
writeByte
(
packetId
)
//part of packet id
this
.
writeByte
(
packetId
Last
)
//part of packet id
this
.
writeQQ
(
qq
)
this
.
writeHex
(
Protocol
.
fixVer
)
...
...
@@ -141,19 +145,17 @@ class ClientVerificationCodeRefreshPacket(
it
.
writeHex
(
Protocol
.
key00BAFix
)
}
}
override
fun
getFixedId
():
String
{
return
this
.
idHex
+
" "
+
packetIdLast
}
}
/**
* 验证码输入错误
*/
@PacketId
(
"00 BA 32"
)
class
ServerVerificationCodeWrongPacket
(
input
:
DataInputStream
,
val
dataSize
:
Int
,
packetId
:
ByteArray
)
:
ServerVerificationCodeTransmissionPacket
(
input
,
dataSize
,
packetId
)
{
override
fun
decode
()
{
MiraiLogger
debug
dataSize
super
.
decode
()
}
}
class
ServerVerificationCodeWrongPacket
(
input
:
DataInputStream
,
dataSize
:
Int
,
packetId
:
ByteArray
)
:
ServerVerificationCodeTransmissionPacket
(
input
,
dataSize
,
packetId
)
/**
* 服务器发送验证码图片文件一部分过来
...
...
@@ -183,6 +185,10 @@ open class ServerVerificationCodeTransmissionPacket(input: DataInputStream, priv
this
.
token00BA
=
this
.
input
.
readNBytesAt
(
dataSize
-
56
-
2
,
40
)
this
.
packetIdLast
=
packetId
[
3
].
toInt
()
}
override
fun
getFixedId
():
String
{
return
this
.
idHex
+
" "
+
packetIdLast
}
}
/*
...
...
mirai-core/src/main/java/net/mamoe/mirai/network/packet/login/ClientChangeOnlineStatusPacket.kt
View file @
2c108b17
...
...
@@ -17,8 +17,13 @@ class ClientChangeOnlineStatusPacket(
private
val
loginStatus
:
ClientLoginStatus
)
:
ClientPacket
()
{
override
fun
getFixedId
():
String
{
return
this
.
idHex
+
" ?? ??"
;
}
override
fun
encode
()
{
this
.
writeRandom
(
2
)
//part of packet id
this
.
writeQQ
(
qq
)
this
.
writeHex
(
Protocol
.
fixVer2
)
this
.
encryptAndWrite
(
sessionKey
)
{
...
...
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