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
1ba96b78
Commit
1ba96b78
authored
Sep 04, 2019
by
Him188moe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated robot & network structure
parent
99cf7e2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
76 deletions
+11
-76
mirai-core/src/main/java/net/mamoe/mirai/network/RobotNetworkHandler.kt
.../main/java/net/mamoe/mirai/network/RobotNetworkHandler.kt
+4
-1
mirai-core/src/main/java/net/mamoe/mirai/network/packet/ServerEvent.kt
...c/main/java/net/mamoe/mirai/network/packet/ServerEvent.kt
+1
-1
mirai-core/src/main/java/net/mamoe/mirai/network/packet/Session.kt
...e/src/main/java/net/mamoe/mirai/network/packet/Session.kt
+2
-4
mirai-core/src/main/java/net/mamoe/mirai/network/packet/login/ServerLoginResponsePasswordVerifiedPacket.kt
...packet/login/ServerLoginResponsePasswordVerifiedPacket.kt
+4
-70
No files found.
mirai-core/src/main/java/net/mamoe/mirai/network/RobotNetworkHandler.kt
View file @
1ba96b78
...
...
@@ -48,6 +48,9 @@ internal class RobotNetworkHandler(private val robot: Robot) : Closeable {
private
lateinit
var
loginIP
:
String
private
var
tgtgtKey
:
ByteArray
?
=
null
private
var
tlv0105
:
ByteArray
/**
* 0828_decr_key
*/
private
lateinit
var
sessionResponseDecryptionKey
:
ByteArray
private
var
verificationCodeSequence
:
Int
=
0
//这两个验证码使用
...
...
@@ -214,7 +217,7 @@ internal class RobotNetworkHandler(private val robot: Robot) : Closeable {
}
is
ServerLoginResponseSuccessPacket
->
{
this
.
sessionResponseDecryptionKey
=
packet
.
_0828_rec_decr_k
ey
this
.
sessionResponseDecryptionKey
=
packet
.
sessionResponseDecryptionK
ey
sendPacket
(
ClientSessionRequestPacket
(
this
.
robot
.
account
.
qqNumber
,
this
.
serverIP
,
packet
.
token38
,
packet
.
token88
,
packet
.
encryptionKey
,
this
.
tlv0105
))
}
...
...
mirai-core/src/main/java/net/mamoe/mirai/network/packet/ServerEvent.kt
View file @
1ba96b78
...
...
@@ -60,7 +60,7 @@ class UnknownServerEventPacket(input: DataInputStream, packetId: ByteArray, even
class
ServerAndroidOnlineEventPacket
(
input
:
DataInputStream
,
packetId
:
ByteArray
,
eventIdentity
:
ByteArray
)
:
ServerEventPacket
(
input
,
packetId
,
eventIdentity
)
/**
* Android 客户端
上
线
* Android 客户端
下
线
*/
class
ServerAndroidOfflineEventPacket
(
input
:
DataInputStream
,
packetId
:
ByteArray
,
eventIdentity
:
ByteArray
)
:
ServerEventPacket
(
input
,
packetId
,
eventIdentity
)
...
...
mirai-core/src/main/java/net/mamoe/mirai/network/packet/Session.kt
View file @
1ba96b78
...
...
@@ -62,8 +62,6 @@ class ClientSessionRequestPacket(
}
/**
* Dispose_0828
*
* @author Him188moe
*/
class
ServerSessionKeyResponsePacket
(
inputStream
:
DataInputStream
,
private
val
dataLength
:
Int
)
:
ServerPacket
(
inputStream
)
{
...
...
@@ -106,10 +104,10 @@ class ServerSessionKeyResponsePacket(inputStream: DataInputStream, private val d
}
class
Encrypted
(
inputStream
:
DataInputStream
)
:
ServerPacket
(
inputStream
)
{
fun
decrypt
(
_0828_rec_decr_k
ey
:
ByteArray
):
ServerSessionKeyResponsePacket
{
fun
decrypt
(
sessionResponseDecryptionK
ey
:
ByteArray
):
ServerSessionKeyResponsePacket
{
this
.
input
goto
14
val
data
=
this
.
input
.
readAllBytes
().
let
{
it
.
copyOfRange
(
0
,
it
.
size
-
1
)
}
return
ServerSessionKeyResponsePacket
(
TEA
.
decrypt
(
data
,
_0828_rec_decr_key
).
dataInputStream
(),
data
.
size
);
return
ServerSessionKeyResponsePacket
(
TEA
.
decrypt
(
data
,
sessionResponseDecryptionKey
).
dataInputStream
(),
data
.
size
)
}
}
}
\ No newline at end of file
mirai-core/src/main/java/net/mamoe/mirai/network/packet/login/ServerLoginResponsePasswordVerifiedPacket.kt
View file @
1ba96b78
...
...
@@ -11,8 +11,8 @@ import java.io.DataInputStream
* @author NaturalHG
*/
class
ServerLoginResponseSuccessPacket
(
input
:
DataInputStream
)
:
ServerPacket
(
input
)
{
lateinit
var
_0828_rec_decr_k
ey
:
ByteArray
//16 bytes|
lateinit
var
nick
:
String
lateinit
var
sessionResponseDecryptionK
ey
:
ByteArray
//16 bytes|
lateinit
var
nick
name
:
String
lateinit
var
token38
:
ByteArray
lateinit
var
token88
:
ByteArray
...
...
@@ -22,72 +22,6 @@ class ServerLoginResponseSuccessPacket(input: DataInputStream) : ServerPacket(in
@TestedSuccessfully
@ExperimentalUnsignedTypes
override
fun
decode
()
{
//测试完成 @NaturalHG
/**
* Version 1 @Deprecated
this.input.skip(7)//8
encryptionKey = this.input.readNBytesAt(16)//24
this.input.skip(2)//25->26
token38 = this.input.readNBytesAt(56)//81->82
this.input.skip(60L)//142
//??
var b = this.input.readNBytesAt(2)
val msgLength = when (b.toUByteArray().toUHexString()) {
"01 07" -> 0
"00 33" -> 28
"01 10" -> 65
else -> throw IllegalStateException()
}//144
System.out.println(msgLength)
this.input.skip(17L + msgLength)//161+msgLength
this.input.skip(10)//171+msgLength
_0828_rec_decr_key = this.input.readNBytesAt(16)//187+msgLength
this.input.skip(2)
token88 = this.input.readNBytesAt(136)//325+ // msgLength
this.input.skip(299L)//624+msgLength
//varString (nickLength bytes)
val nickLength = this.input.readByteAt().toInt()//625+msgLength
System.out.println(nickLength)
nick = this.input.readVarString(nickLength)//625+msgLength+nickLength
val dataIndex = packetDataLength - 31
/*
this.input.skip((dataIndex - (625 + msgLength + nickLength)) + 0L)//-31
gender = this.input.readByteAt().toUByte().toInt()//-30
this.input.skip(9)//-27
age = this.input.readShortAt()//-25
*/
age = 0
gender = 0
/*
age = HexToDec(取文本中间(data, 取文本长度(data) - 82, 5))
gender = 取文本中间(data, 取文本长度(data) - 94, 2)
*/
* **/
/** version 2 */
this
.
input
.
skip
(
7
)
//8
this
.
encryptionKey
=
this
.
input
.
readNBytes
(
16
)
//24
...
...
@@ -102,12 +36,12 @@ class ServerLoginResponseSuccessPacket(input: DataInputStream) : ServerPacket(in
else
->
throw
IllegalStateException
(
id
)
}
this
.
_0828_rec_decr_k
ey
=
this
.
input
.
readNBytesAt
(
171
+
msgLength
,
16
)
this
.
sessionResponseDecryptionK
ey
=
this
.
input
.
readNBytesAt
(
171
+
msgLength
,
16
)
this
.
token88
=
this
.
input
.
readNBytesAt
(
189
+
msgLength
,
136
)
val
nickLength
=
this
.
input
.
goto
(
624
+
msgLength
).
readByte
().
toInt
()
this
.
nick
=
this
.
input
.
readVarString
(
nickLength
)
this
.
nick
name
=
this
.
input
.
readVarString
(
nickLength
)
//this.age = this.input.goto(packetDataLength - 28).readShortAt()
...
...
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