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
73c700b4
Commit
73c700b4
authored
May 02, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support protocol selecting
parent
91c8c717
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
19 deletions
+48
-19
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
...tlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
+5
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt
...et/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt
+1
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt
...tlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
.../net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
...qqandroid/network/protocol/packet/chat/TroopManagement.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt
...irai/qqandroid/network/protocol/packet/login/Heartbeat.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt
.../mirai/qqandroid/network/protocol/packet/login/StatSvc.kt
+1
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
.../mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
+7
-10
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
...mmonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
+29
-0
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
View file @
73c700b4
...
...
@@ -77,6 +77,10 @@ internal open class QQAndroidClient(
val
device
:
DeviceInfo
=
SystemDeviceInfo
(
context
),
bot
:
QQAndroidBot
)
{
@Suppress
(
"INVISIBLE_MEMBER"
)
val
subAppId
:
Long
get
()
=
bot
.
configuration
.
protocol
.
id
internal
val
serverList
:
MutableList
<
Pair
<
String
,
Int
>>
=
DefaultServerList
.
toMutableList
()
val
keys
:
Map
<
String
,
ByteArray
>
by
lazy
{
...
...
@@ -368,7 +372,7 @@ internal class WLoginSigInfo(
val
deviceToken
:
ByteArray
)
{
override
fun
toString
():
String
{
return
"WLoginSigInfo(uin=$uin, encryptA1=${encryptA1?.toUHexString()}, noPicSig=${noPicSig?.toUHexString()}, G=${G.toUHexString()}, dpwd=${dpwd.toUHexString()}, randSeed=${randSeed.toUHexString()}, simpleInfo=$simpleInfo, appPri=$appPri, a2ExpiryTime=$a2ExpiryTime, loginBitmap=$loginBitmap, tgt=${tgt.toUHexString()}, a2CreationTime=$a2CreationTime, tgtKey=${tgtKey.toUHexString()}, userStSig=$userStSig, userStKey=${userStKey.toUHexString()}, userStWebSig=$userStWebSig, userA5=$userA5, userA8=$userA8, lsKey=$lsKey, sKey=$sKey, userSig64=$userSig64, openId=${openId.toUHexString()}, openKey=$openKey, vKey=$vKey, accessToken=$accessToken, d2=$d2, d2Key=${d2Key.toUHexString()}, sid=$sid, aqSig=$aqSig, psKey=$
{psKeyMap.toString()}
, superKey=${superKey.toUHexString()}, payToken=${payToken.toUHexString()}, pf=${pf.toUHexString()}, pfKey=${pfKey.toUHexString()}, da2=${da2.toUHexString()}, wtSessionTicket=$wtSessionTicket, wtSessionTicketKey=${wtSessionTicketKey.toUHexString()}, deviceToken=${deviceToken.toUHexString()})"
return
"WLoginSigInfo(uin=$uin, encryptA1=${encryptA1?.toUHexString()}, noPicSig=${noPicSig?.toUHexString()}, G=${G.toUHexString()}, dpwd=${dpwd.toUHexString()}, randSeed=${randSeed.toUHexString()}, simpleInfo=$simpleInfo, appPri=$appPri, a2ExpiryTime=$a2ExpiryTime, loginBitmap=$loginBitmap, tgt=${tgt.toUHexString()}, a2CreationTime=$a2CreationTime, tgtKey=${tgtKey.toUHexString()}, userStSig=$userStSig, userStKey=${userStKey.toUHexString()}, userStWebSig=$userStWebSig, userA5=$userA5, userA8=$userA8, lsKey=$lsKey, sKey=$sKey, userSig64=$userSig64, openId=${openId.toUHexString()}, openKey=$openKey, vKey=$vKey, accessToken=$accessToken, d2=$d2, d2Key=${d2Key.toUHexString()}, sid=$sid, aqSig=$aqSig, psKey=$
psKeyMap
, superKey=${superKey.toUHexString()}, payToken=${payToken.toUHexString()}, pf=${pf.toUHexString()}, pfKey=${pfKey.toUHexString()}, da2=${da2.toUHexString()}, wtSessionTicket=$wtSessionTicket, wtSessionTicketKey=${wtSessionTicketKey.toUHexString()}, deviceToken=${deviceToken.toUHexString()})"
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt
View file @
73c700b4
...
...
@@ -159,6 +159,7 @@ internal object HighwayHelper {
socket
.
use
{
createImageDataPacketSequence
(
client
=
client
,
appId
=
client
.
subAppId
.
toInt
(),
command
=
"PicUp.DataUp"
,
commandId
=
commandId
,
ticket
=
ticket
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt
View file @
73c700b4
...
...
@@ -32,7 +32,7 @@ internal fun createImageDataPacketSequence(
// RequestDataTrans
client
:
QQAndroidClient
,
command
:
String
,
appId
:
Int
=
537062845
,
appId
:
Int
,
dataFlag
:
Int
=
4096
,
commandId
:
Int
,
localId
:
Int
=
2052
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
View file @
73c700b4
...
...
@@ -83,7 +83,7 @@ internal fun BytePacketBuilder.t18(
@OptIn
(
MiraiInternalAPI
::
class
)
internal
fun
BytePacketBuilder
.
t106
(
appId
:
Long
=
16L
,
subAppId
:
Long
=
537062845L
,
subAppId
:
Long
,
appClientVersion
:
Int
=
0
,
uin
:
Long
,
n5_always_1
:
Int
=
1
,
...
...
@@ -159,7 +159,7 @@ internal fun BytePacketBuilder.t116(
internal
fun
BytePacketBuilder
.
t100
(
appId
:
Long
=
16
,
subAppId
:
Long
=
537062845
,
subAppId
:
Long
,
appClientVersion
:
Int
)
{
writeShort
(
0
x100
)
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
View file @
73c700b4
...
...
@@ -100,7 +100,7 @@ internal class TroopManagement {
serviceType
=
7
,
result
=
0
,
bodybuffer
=
Oidb0x88d
.
ReqBody
(
appid
=
537062845
,
appid
=
client
.
subAppId
.
toInt
()
,
stzreqgroupinfo
=
listOf
(
Oidb0x88d
.
ReqGroupInfo
(
stgroupinfo
=
Oidb0x88d
.
GroupInfo
(
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt
View file @
73c700b4
...
...
@@ -25,7 +25,7 @@ internal class Heartbeat {
operator
fun
invoke
(
client
:
QQAndroidClient
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
0
,
key
=
NO_ENCRYPT
)
{
writeSsoPacket
(
client
,
537062845
,
commandName
,
sequenceId
=
it
)
{
writeSsoPacket
(
client
,
client
.
subAppId
,
commandName
,
sequenceId
=
it
)
{
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt
View file @
73c700b4
...
...
@@ -88,8 +88,6 @@ internal class StatSvc {
override
fun
toString
():
String
=
"Response(StatSvc.register)"
}
private
const
val
subAppId
=
537062845L
@OptIn
(
MiraiInternalAPI
::
class
)
operator
fun
invoke
(
client
:
QQAndroidClient
,
...
...
@@ -101,7 +99,7 @@ internal class StatSvc {
key
=
client
.
wLoginSigInfo
.
d2Key
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
=
subAppId
,
commandName
=
commandName
,
client
,
subAppId
=
client
.
subAppId
,
commandName
=
commandName
,
extraData
=
client
.
wLoginSigInfo
.
tgt
.
toReadPacket
(),
sequenceId
=
sequenceId
)
{
writeJceStruct
(
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
View file @
73c700b4
...
...
@@ -32,8 +32,6 @@ internal class WtLogin {
@Suppress
(
"FunctionName"
)
@OptIn
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
internal
object
Login
:
OutgoingPacketFactory
<
Login
.
LoginPacketResponse
>(
"wtlogin.login"
)
{
private
const
val
subAppId
=
537062845L
/**
* 提交验证码
*/
...
...
@@ -42,7 +40,7 @@ internal class WtLogin {
client
:
QQAndroidClient
,
ticket
:
String
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeSsoPacket
(
client
,
client
.
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
2
)
// subCommand
writeShort
(
4
)
// count of TLVs
...
...
@@ -59,7 +57,7 @@ internal class WtLogin {
captchaSign
:
ByteArray
,
captchaAnswer
:
String
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeSsoPacket
(
client
,
client
.
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
2
)
// subCommand
writeShort
(
4
)
// count of TLVs
...
...
@@ -78,7 +76,7 @@ internal class WtLogin {
client
:
QQAndroidClient
,
t402
:
ByteArray
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeSsoPacket
(
client
,
client
.
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
20
)
// subCommand
writeShort
(
4
)
// count of TLVs, probably ignored by server?
...
...
@@ -100,7 +98,7 @@ internal class WtLogin {
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
client
.
subAppId
,
commandName
,
sequenceId
=
sequenceId
,
unknownHex
=
"01 00 00 00 00 00 00 00 00 00 01 00"
...
...
@@ -126,13 +124,12 @@ internal class WtLogin {
*/
object
SubCommand9
{
private
const
val
appId
=
16L
private
const
val
subAppId
=
537062845L
@OptIn
(
MiraiInternalAPI
::
class
,
MiraiExperimentalAPI
::
class
)
operator
fun
invoke
(
client
:
QQAndroidClient
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeSsoPacket
(
client
,
client
.
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
9
)
// subCommand
writeShort
(
17
)
// count of TLVs, probably ignored by server?
...
...
@@ -142,7 +139,7 @@ internal class WtLogin {
t1
(
client
.
uin
,
client
.
device
.
ipAddress
)
t106
(
appId
,
subAppId
/* maybe 1*/
,
client
.
subAppId
/* maybe 1*/
,
client
.
appClientVersion
,
client
.
uin
,
1
,
...
...
@@ -166,7 +163,7 @@ internal class WtLogin {
if (ConfigManager.get_loginWithPicSt()) appIdList = longArrayOf(1600000226L)
*/
t116
(
client
.
miscBitMap
,
client
.
subSigMap
)
t100
(
appId
,
subAppId
,
client
.
appClientVersion
)
t100
(
appId
,
client
.
subAppId
,
client
.
appClientVersion
)
t107
(
0
)
// t108(byteArrayOf())
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
View file @
73c700b4
...
...
@@ -15,6 +15,7 @@ import net.mamoe.mirai.network.BotNetworkHandler
import
kotlin.coroutines.CoroutineContext
import
kotlin.coroutines.EmptyCoroutineContext
import
kotlin.coroutines.coroutineContext
import
kotlin.jvm.JvmField
import
kotlin.jvm.JvmOverloads
import
kotlin.jvm.JvmStatic
...
...
@@ -75,6 +76,34 @@ open class BotConfiguration {
*/
var
loginSolver
:
LoginSolver
=
LoginSolver
.
Default
/**
* 使用协议类型
*/
@SinceMirai
(
"1.0.0"
)
val
protocol
:
MiraiProtocol
=
MiraiProtocol
.
ANDROID_PAD
@SinceMirai
(
"1.0.0"
)
enum
class
MiraiProtocol
(
/** 协议模块使用的 ID */
@JvmField
internal
val
id
:
Long
)
{
/**
* Android 手机.
*
* - 与手机冲突
* - 与平板和电脑不冲突
*/
ANDROID_PHONE
(
537062845
),
/**
* Android 平板.
*
* - 与平板冲突
* - 与手机和电脑不冲突
*/
ANDROID_PAD
(
537062409
)
}
companion
object
{
/**
* 默认的配置实例
...
...
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