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
8c2511c8
Commit
8c2511c8
authored
Aug 20, 2019
by
Him188moe
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1e127732
83de4b4c
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
311 additions
and
88 deletions
+311
-88
mirai-core/pom.xml
mirai-core/pom.xml
+10
-0
mirai-core/src/main/java/net/mamoe/mirai/MiraiServer.java
mirai-core/src/main/java/net/mamoe/mirai/MiraiServer.java
+53
-11
mirai-core/src/main/java/net/mamoe/mirai/utils/MiraiLogger.kt
...i-core/src/main/java/net/mamoe/mirai/utils/MiraiLogger.kt
+1
-0
mirai-core/src/main/java/net/mamoe/mirai/utils/Utils.java
mirai-core/src/main/java/net/mamoe/mirai/utils/Utils.java
+73
-0
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfig.java
...c/main/java/net/mamoe/mirai/utils/config/MiraiConfig.java
+46
-66
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java
...java/net/mamoe/mirai/utils/config/MiraiConfigSection.java
+15
-6
mirai-core/src/main/java/net/mamoe/mirai/utils/setting/MiraiSetting.java
...main/java/net/mamoe/mirai/utils/setting/MiraiSetting.java
+92
-0
mirai-core/src/main/java/net/mamoe/mirai/utils/setting/MiraiSettingListSection.java
...et/mamoe/mirai/utils/setting/MiraiSettingListSection.java
+2
-3
mirai-core/src/main/java/net/mamoe/mirai/utils/setting/MiraiSettingMapSection.java
...net/mamoe/mirai/utils/setting/MiraiSettingMapSection.java
+2
-2
mirai-core/src/main/java/net/mamoe/mirai/utils/setting/MiraiSettingSection.java
...va/net/mamoe/mirai/utils/setting/MiraiSettingSection.java
+11
-0
mirai-core/src/test/java/PacketTest.kt
mirai-core/src/test/java/PacketTest.kt
+6
-0
No files found.
mirai-core/pom.xml
View file @
8c2511c8
...
...
@@ -40,6 +40,16 @@
<artifactId>
log4j-core
</artifactId>
<version>
2.12.1
</version>
</dependency>
<dependency>
<groupId>
org.yaml
</groupId>
<artifactId>
snakeyaml
</artifactId>
<version>
1.18
</version>
</dependency>
<dependency>
<groupId>
org.yaml
</groupId>
<artifactId>
snakeyaml
</artifactId>
<version>
1.18
</version>
</dependency>
</dependencies>
...
...
mirai-core/src/main/java/net/mamoe/mirai/MiraiServer.java
View file @
8c2511c8
...
...
@@ -10,7 +10,10 @@ import net.mamoe.mirai.task.MiraiTaskManager;
import
net.mamoe.mirai.utils.LoggerTextFormat
;
import
net.mamoe.mirai.utils.MiraiLogger
;
import
net.mamoe.mirai.utils.config.MiraiConfig
;
import
net.mamoe.mirai.utils.config.MiraiMapSection
;
import
net.mamoe.mirai.utils.config.MiraiConfigSection
;
import
net.mamoe.mirai.utils.setting.MiraiSetting
;
import
net.mamoe.mirai.utils.setting.MiraiSettingListSection
;
import
net.mamoe.mirai.utils.setting.MiraiSettingMapSection
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -41,7 +44,9 @@ public class MiraiServer {
@Getter
MiraiLogger
logger
;
MiraiConfig
setting
;
MiraiSetting
setting
;
MiraiConfig
qqs
;
protected
MiraiServer
(){
...
...
@@ -74,16 +79,27 @@ public class MiraiServer {
getLogger
().
info
(
"Loading data under "
+
LoggerTextFormat
.
GREEN
+
this
.
parentFolder
);
File
setting
=
new
File
(
this
.
parentFolder
+
"/Mirai.ini"
);
getLogger
().
info
(
"Selecting setting from "
+
LoggerTextFormat
.
GREEN
+
setting
);
if
(!
setting
.
exists
()){
this
.
initSetting
(
setting
);
}
else
{
this
.
setting
=
new
MiraiConfig
(
setting
);
this
.
setting
=
new
MiraiSetting
(
setting
);
}
File
qqs
=
new
File
(
this
.
parentFolder
+
"/QQ.yml"
);
getLogger
().
info
(
"Reading QQ accounts from "
+
LoggerTextFormat
.
GREEN
+
qqs
);
if
(!
qqs
.
exists
()){
this
.
initQQConfig
(
qqs
);
}
else
{
this
.
qqs
=
new
MiraiConfig
(
qqs
);
}
if
(
this
.
qqs
.
isEmpty
()){
this
.
initQQConfig
(
qqs
);
}
getLogger
().
info
(
"Success"
);
/*
MiraiMapSection qqs = this.setting.getMapSection("qq");
Mirai
Setting
MapSection qqs = this.setting.getMapSection("qq");
qqs.forEach((a,p) -> {
this.getLogger().info(LoggerTextFormat.SKY_BLUE + "Finding available ports between " + "1-65536");
try {
...
...
@@ -96,6 +112,8 @@ public class MiraiServer {
});
*/
getLogger
().
info
(
"ready to connect"
);
Robot
robot
=
new
Robot
(
1994701021
,
"xiaoqqq"
);
try
{
System
.
out
.
println
(
Protocol
.
Companion
.
getSERVER_IP
().
get
(
3
));
...
...
@@ -136,10 +154,30 @@ public class MiraiServer {
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
this
.
setting
=
new
MiraiConfig
(
setting
);
MiraiMapSection
network
=
this
.
setting
.
getMapSection
(
"network"
);
this
.
setting
=
new
MiraiSetting
(
setting
);
MiraiSettingMapSection
network
=
this
.
setting
.
getMapSection
(
"network"
);
network
.
set
(
"enable_proxy"
,
"not supporting yet"
);
MiraiSettingListSection
proxy
=
this
.
setting
.
getListSection
(
"proxy"
);
proxy
.
add
(
"1.2.3.4:95"
);
proxy
.
add
(
"1.2.3.4:100"
);
MiraiSettingMapSection
worker
=
this
.
setting
.
getMapSection
(
"worker"
);
worker
.
set
(
"core_task_pool_worker_amount"
,
5
);
MiraiSettingMapSection
plugin
=
this
.
setting
.
getMapSection
(
"plugin"
);
plugin
.
set
(
"debug"
,
false
);
MiraiMapSection
qqs
=
this
.
setting
.
getMapSection
(
"qq"
);
this
.
setting
.
save
();
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"initialized; changing can be made in setting file: "
+
setting
.
toString
());
}
private
void
initQQConfig
(
File
qqConfig
){
this
.
qqs
=
new
MiraiConfig
(
qqConfig
);
MiraiConfigSection
<
Object
>
section
=
new
MiraiConfigSection
<>();
System
.
out
.
println
(
"/"
);
Scanner
scanner
=
new
Scanner
(
System
.
in
);
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"input one "
+
LoggerTextFormat
.
RED
+
" QQ number "
+
LoggerTextFormat
.
SKY_BLUE
+
"for default robot"
);
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"输入用于默认机器人的QQ号"
);
...
...
@@ -147,9 +185,13 @@ public class MiraiServer {
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"input the password for that QQ account"
);
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"输入该QQ号对应密码"
);
String
qqPassword
=
scanner
.
next
();
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"initialized; changing can be made in config file: "
+
setting
.
toString
());
qqs
.
put
(
String
.
valueOf
(
qqNumber
),
qqPassword
);
this
.
setting
.
save
();
section
.
put
(
"password"
,
qqPassword
);
section
.
put
(
"owner"
,
"default"
);
this
.
qqs
.
put
(
String
.
valueOf
(
qqNumber
),
section
);
this
.
qqs
.
save
();
getLogger
().
info
(
LoggerTextFormat
.
SKY_BLUE
+
"QQ account initialized; changing can be made in Config file: "
+
qqConfig
.
toString
());
}
private
void
onEnable
(){
...
...
mirai-core/src/main/java/net/mamoe/mirai/utils/MiraiLogger.kt
View file @
8c2511c8
...
...
@@ -34,4 +34,5 @@ object MiraiLogger {
}
fun
log
(
any
:
Any
?)
=
MiraiLogger
.
info
(
any
)
\ No newline at end of file
mirai-core/src/main/java/net/mamoe/mirai/utils/Utils.java
0 → 100644
View file @
8c2511c8
package
net.mamoe.mirai.utils
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
public
class
Utils
{
/**
* File supporting from Nukkit
* */
public
static
void
writeFile
(
String
fileName
,
String
content
)
throws
IOException
{
writeFile
(
fileName
,
new
ByteArrayInputStream
(
content
.
getBytes
(
StandardCharsets
.
UTF_8
)));
}
public
static
void
writeFile
(
String
fileName
,
InputStream
content
)
throws
IOException
{
writeFile
(
new
File
(
fileName
),
content
);
}
public
static
void
writeFile
(
File
file
,
String
content
)
throws
IOException
{
writeFile
(
file
,
new
ByteArrayInputStream
(
content
.
getBytes
(
StandardCharsets
.
UTF_8
)));
}
public
static
void
writeFile
(
File
file
,
InputStream
content
)
throws
IOException
{
if
(
content
==
null
)
{
throw
new
IllegalArgumentException
(
"content must not be null"
);
}
if
(!
file
.
exists
())
{
file
.
createNewFile
();
}
try
(
FileOutputStream
stream
=
new
FileOutputStream
(
file
))
{
byte
[]
buffer
=
new
byte
[
1024
];
int
length
;
while
((
length
=
content
.
read
(
buffer
))
!=
-
1
)
{
stream
.
write
(
buffer
,
0
,
length
);
}
}
content
.
close
();
}
public
static
String
readFile
(
File
file
)
throws
IOException
{
if
(!
file
.
exists
()
||
file
.
isDirectory
())
{
throw
new
FileNotFoundException
();
}
return
readFile
(
new
FileInputStream
(
file
));
}
public
static
String
readFile
(
String
filename
)
throws
IOException
{
File
file
=
new
File
(
filename
);
if
(!
file
.
exists
()
||
file
.
isDirectory
())
{
throw
new
FileNotFoundException
();
}
return
readFile
(
new
FileInputStream
(
file
));
}
public
static
String
readFile
(
InputStream
inputStream
)
throws
IOException
{
return
readFile
(
new
InputStreamReader
(
inputStream
,
StandardCharsets
.
UTF_8
));
}
private
static
String
readFile
(
Reader
reader
)
throws
IOException
{
try
(
BufferedReader
br
=
new
BufferedReader
(
reader
))
{
String
temp
;
StringBuilder
stringBuilder
=
new
StringBuilder
();
temp
=
br
.
readLine
();
while
(
temp
!=
null
)
{
if
(
stringBuilder
.
length
()
!=
0
)
{
stringBuilder
.
append
(
"\n"
);
}
stringBuilder
.
append
(
temp
);
temp
=
br
.
readLine
();
}
return
stringBuilder
.
toString
();
}
}
}
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfig.java
View file @
8c2511c8
package
net.mamoe.mirai.utils.config
;
import
org.ini4j.Config
;
import
org.ini4j.Ini
;
import
org.ini4j.Profile
;
import
net.mamoe.mirai.MiraiServer
;
import
net.mamoe.mirai.utils.Utils
;
import
org.yaml.snakeyaml.DumperOptions
;
import
org.yaml.snakeyaml.Yaml
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Vector
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Mirai Config
* Only support {INI} format
* Support MAP and LIST
* Thread safe
* YAML-TYPE CONFIG
* Thread SAFE
* @author NaturalHG
*/
public
class
MiraiConfig
{
public
class
MiraiConfig
extends
MiraiConfigSection
<
Object
>
{
private
File
file
;
private
Ini
ini
;
private
volatile
Map
<
String
,
MiraiConfigSection
>
cacheSection
=
new
ConcurrentHashMap
<>();
private
volatile
File
root
;
public
MiraiConfig
(
File
file
){
if
(!
file
.
getName
().
contains
(
"."
)){
file
=
new
File
(
file
.
getParent
()
+
file
.
getName
()
+
".ini"
);
super
();
if
(!
file
.
toURI
().
getPath
().
contains
(
MiraiServer
.
getInstance
().
getParentFolder
().
getPath
())){
file
=
new
File
((
MiraiServer
.
getInstance
().
getParentFolder
().
getPath
()
+
"/"
+
file
).
replace
(
"//"
,
"/"
));
}
this
.
file
=
file
;
this
.
root
=
file
;
if
(!
file
.
exists
()){
try
{
if
(
file
.
exists
()){
file
.
createNewFile
()
;
if
(!
file
.
createNewFile
()){
return
;
}
Config
config
=
new
Config
();
config
.
setMultiSection
(
true
);
ini
=
new
Ini
();
ini
.
setConfig
(
config
);
ini
.
load
(
this
.
file
.
toURI
().
toURL
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
setSection
(
String
key
,
MiraiConfigSection
section
){
cacheSection
.
put
(
key
,
section
);
this
.
parse
();
}
private
MiraiConfig
(){
public
MiraiMapSection
getMapSection
(
String
key
){
if
(!
cacheSection
.
containsKey
(
key
))
{
MiraiMapSection
section
=
new
MiraiMapSection
();
if
(
ini
.
containsKey
(
key
)){
section
.
putAll
(
ini
.
get
(
key
));
}
cacheSection
.
put
(
key
,
section
);
}
return
(
MiraiMapSection
)
cacheSection
.
get
(
key
);
}
public
MiraiListSection
getListSection
(
String
key
){
if
(!
cacheSection
.
containsKey
(
key
))
{
MiraiListSection
section
=
new
MiraiListSection
();
if
(
ini
.
containsKey
(
key
)){
section
.
addAll
(
ini
.
get
(
key
).
values
());
}
cacheSection
.
put
(
key
,
section
);
public
synchronized
void
save
(){
DumperOptions
dumperOptions
=
new
DumperOptions
();
dumperOptions
.
setDefaultFlowStyle
(
DumperOptions
.
FlowStyle
.
BLOCK
);
Yaml
yaml
=
new
Yaml
(
dumperOptions
);
String
content
=
yaml
.
dump
(
this
);
try
{
Utils
.
writeFile
(
this
.
root
,
content
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
(
MiraiListSection
)
cacheSection
.
get
(
key
);
}
public
synchronized
void
save
(){
cacheSection
.
forEach
((
k
,
a
)
->
{
if
(!
ini
.
containsKey
(
k
))
{
ini
.
put
(
k
,
""
,
new
HashMap
<>());
}
a
.
saveAsSection
(
ini
.
get
(
k
));
});
this
.
clearCache
();
@SuppressWarnings
(
"unchecked"
)
private
void
parse
(){
DumperOptions
dumperOptions
=
new
DumperOptions
();
dumperOptions
.
setDefaultFlowStyle
(
DumperOptions
.
FlowStyle
.
BLOCK
);
Yaml
yaml
=
new
Yaml
(
dumperOptions
);
this
.
clear
();
try
{
ini
.
store
(
file
);
Map
<
String
,
Object
>
content
=
yaml
.
loadAs
(
Utils
.
readFile
(
this
.
root
),
LinkedHashMap
.
class
);
if
(
content
!=
null
)
{
this
.
putAll
(
content
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
clearCache
(){
cacheSection
.
clear
();
}
}
}
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java
View file @
8c2511c8
package
net.mamoe.mirai.utils.config
;
import
org.
ini4j.Profile
;
import
org.
jetbrains.annotations.NotNull
;
import
java.io.Closeable
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentSkipListMap
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.ReentrantLock
;
public
interface
MiraiConfigSection
extends
Closeable
{
void
saveAsSection
(
Profile
.
Section
section
);
}
public
class
MiraiConfigSection
<
T
>
extends
ConcurrentSkipListMap
<
String
,
T
>
{
public
MiraiConfigSection
(){
/*
* Ensure the key will be in order
* */
super
((
a
,
b
)
->
1
);
}
}
mirai-core/src/main/java/net/mamoe/mirai/utils/setting/MiraiSetting.java
0 → 100644
View file @
8c2511c8
package
net.mamoe.mirai.utils.setting
;
import
org.ini4j.Config
;
import
org.ini4j.Ini
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Mirai Config
* Only support {INI} format
* Support MAP and LIST
* Thread safe
*/
public
class
MiraiSetting
{
private
File
file
;
private
Ini
ini
;
private
volatile
Map
<
String
,
MiraiSettingSection
>
cacheSection
=
new
ConcurrentHashMap
<>();
public
MiraiSetting
(
File
file
){
if
(!
file
.
getName
().
contains
(
"."
)){
file
=
new
File
(
file
.
getParent
()
+
file
.
getName
()
+
".ini"
);
}
this
.
file
=
file
;
try
{
if
(
file
.
exists
()){
file
.
createNewFile
();
}
Config
config
=
new
Config
();
config
.
setMultiSection
(
true
);
ini
=
new
Ini
();
ini
.
setConfig
(
config
);
ini
.
load
(
this
.
file
.
toURI
().
toURL
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
setSection
(
String
key
,
MiraiSettingSection
section
){
cacheSection
.
put
(
key
,
section
);
}
public
MiraiSettingMapSection
getMapSection
(
String
key
){
if
(!
cacheSection
.
containsKey
(
key
))
{
MiraiSettingMapSection
section
=
new
MiraiSettingMapSection
();
if
(
ini
.
containsKey
(
key
)){
section
.
putAll
(
ini
.
get
(
key
));
}
cacheSection
.
put
(
key
,
section
);
}
return
(
MiraiSettingMapSection
)
cacheSection
.
get
(
key
);
}
public
MiraiSettingListSection
getListSection
(
String
key
){
if
(!
cacheSection
.
containsKey
(
key
))
{
MiraiSettingListSection
section
=
new
MiraiSettingListSection
();
if
(
ini
.
containsKey
(
key
)){
section
.
addAll
(
ini
.
get
(
key
).
values
());
}
cacheSection
.
put
(
key
,
section
);
}
return
(
MiraiSettingListSection
)
cacheSection
.
get
(
key
);
}
public
synchronized
void
save
(){
cacheSection
.
forEach
((
k
,
a
)
->
{
if
(!
ini
.
containsKey
(
k
))
{
ini
.
put
(
k
,
""
,
new
HashMap
<>());
}
a
.
saveAsSection
(
ini
.
get
(
k
));
});
this
.
clearCache
();
try
{
ini
.
store
(
file
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
clearCache
(){
cacheSection
.
clear
();
}
}
mirai-core/src/main/java/net/mamoe/mirai/utils/
config/Mirai
ListSection.java
→
mirai-core/src/main/java/net/mamoe/mirai/utils/
setting/MiraiSetting
ListSection.java
View file @
8c2511c8
package
net.mamoe.mirai.utils.
confi
g
;
package
net.mamoe.mirai.utils.
settin
g
;
import
org.ini4j.Profile
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.Vector
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.ReentrantLock
;
public
class
Mirai
ListSection
extends
Vector
<
Object
>
implements
MiraiConfigSection
{
public
class
Mirai
SettingListSection
extends
Vector
<
Object
>
implements
MiraiSettingSection
{
private
Lock
lock
=
new
ReentrantLock
();
@SuppressWarnings
(
"unchecked"
)
...
...
mirai-core/src/main/java/net/mamoe/mirai/utils/
config/Mirai
MapSection.java
→
mirai-core/src/main/java/net/mamoe/mirai/utils/
setting/MiraiSetting
MapSection.java
View file @
8c2511c8
package
net.mamoe.mirai.utils.
confi
g
;
package
net.mamoe.mirai.utils.
settin
g
;
import
org.ini4j.Profile
;
...
...
@@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.stream.Collectors
;
public
class
Mirai
MapSection
extends
ConcurrentHashMap
<
String
,
Object
>
implements
MiraiConfi
gSection
{
public
class
Mirai
SettingMapSection
extends
ConcurrentHashMap
<
String
,
Object
>
implements
MiraiSettin
gSection
{
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
get
(
String
key
,
T
defaultValue
)
{
...
...
mirai-core/src/main/java/net/mamoe/mirai/utils/setting/MiraiSettingSection.java
0 → 100644
View file @
8c2511c8
package
net.mamoe.mirai.utils.setting
;
import
org.ini4j.Profile
;
import
java.io.Closeable
;
public
interface
MiraiSettingSection
extends
Closeable
{
void
saveAsSection
(
Profile
.
Section
section
);
}
mirai-core/src/test/java/PacketTest.kt
View file @
8c2511c8
import
net.mamoe.mirai.network.packet.client.login.ClientPasswordSubmissionPacket
import
net.mamoe.mirai.network.packet.server.login.ServerLoginResponseVerificationCodePacket
import
net.mamoe.mirai.util.hexToBytes
import
net.mamoe.mirai.util.toHexString
...
...
@@ -33,6 +34,7 @@ fun main(){
System.out.println("gender: " + packet.gender)
*/
/*
val data = "FB 01 04 03 33 00 01 00 BA 02 03 2C 13 00 05 01 00 00 01 23 00 38 F5 C3 CF F4 B4 27 C5 8F 9B D3 ED 18 73 7D E9 CB 43 1F 57 43 BE D3 1B 9A F5 26 2B F4 D9 43 14 9A ED 3B C3 6C E5 7F 4E B0 0C BA 55 57 18 06 78 E1 13 A7 B2 A8 7F 47 E1 1C 02 BC 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 00 00 00 82 00 00 00 35 08 03 00 00 00 BA 12 C3 02 00 00 00 04 67 41 4D 41 00 00 B1 8F 0B FC 61 05 00 00 00 01 73 52 47 42 00 AE CE 1C E9 00 00 00 6C 50 4C 54 45 F6 F8 F4 E3 EE FD E5 FD FF EE FD F0 F6 F9 E7 F7 F9 EC F4 FE FF F7 F7 F9 F5 F4 FF EC F7 FF E6 F4 E0 F5 FC F8 49 5B 8F CB DB FA BB C9 F5 2B 40 7C D6 E6 FF FD FB FF ED F1 F0 2A 43 B3 D6 F6 FF FC F1 FC 1C 38 91 A7 BD F6 63 74 BD 70 8B CC 34 4F A5 DE F3 F1 75 88 E7 A4 B7 D3 73 82 A1 8C A3 DC F3 FB D8 4D 68 B9 94 A8 FB 8D 9C B6 CB 42 B0 8E 00 00 0A 6F 49 44 41 54 58 C3 B4 57 89 76 EB 2A 12 14 20 B1 09 10 42 68 DF 2C FB FF FF 71 0A 79 49 E2 E4 CE CC 79 37 8F 13 59 B6 72 EC 2E AA BB AB 9A 2C FB 61 89 8F 95 E5 79 A9 70 CB B2 22 C7 2A 65 DB 5E 72 21 F1 A9 90 B2 28 C4 F9 AF 5F 5F 05 30 9C 28 D2 4B C6 58 F9 8C 92 17 39 13 6D 9B FF EB 10 8A 3B 0F 2F 10 52 64 45 51 64 42 A6 37 79 21 DA FC F2 6F 40 08 9F AE B7 9C A4 C8 27 31 F2 C4 50 A4 D4 9C F9 01 BC A2 90 0F 08 E1 2F AE 1F E3 7E 7D 24 52 F4 67 2C 91 02 E3 CA 13 2F 78 97 00 86 DF 4E C4 23 56 F1 F8 7B 10 90 42 3D D2 93 EE 27 04 F1 80 F0 4B 99 10 4F 62 5E D9 2D EE 57 8A F1 A0 E1 64 20 2B 55 F9 C8 C3 67 08 F8 81 7F F2 F7 BE FD 67 1D 9E 9B 4F EB 89 25 21 28 19 63 09 5D A9 94 2A 59 AA 87 B3 32 4E 84 FF 3C 13 8F AF 06 F1 29 FD E2 C1 02 54 E0 8C 5E 5C 2E A5 72 43 65 F4 E5 72 61 5C 4A 45 81 41 97 79 0A 9E FF 62 22 C2 EB 7E 42 48 45 80 2B 0F 58 B9 66 D6 1C 63 75 D3 97 BC F4 08 0F 08 5C 6B 8D CC 14 1F 10 C4 5F B4 C3 37 66 EE E5 78 CF 42 12 05 CD F5 4D 29 EB 36 AD 19 82 CF 76 35 C6 86 B2 94 A7 36 FC 62 39 BE A8 B8 D7 02 78 08 8F 66 E4 44 45 DF BB AB A3 34 92 14 DF 54 C6 32 1D 00 21 7F 41 08 7F C9 7F F8 28 88 4F B5 90 89 3A 21 90 9E DF E8 DE 34 4D 8C D1 EF C6 AC 6B 7F 74 8E B1 FA 84 90 7F B0 F0 CF 5A E2 27 4C AF 8E 28 EF 24 48 B2 AF B1 9A 96 3E F6 43 75 38 6F 29 5D 1A C7 59 78 87 F0 1B B2 F0 95 05 3C 93 B2 26 B6 9F BA 18 AB AE 59 EC 88 17 17 A9 8F 4B B3 CE 60 A1 CD F2 CB 03 42 10 7F D9 06 1F 76 80 8E 4F 6D 9F 56 99 05 25 A5 DD AA EB 62 7A 6F 87 E6 B8 0E 5D 33 C6 99 C6 C4 02 24 EB 74 8C 87 98 64 F8 5E A9 9E 1E F7 72 FB FF B3 21 8A A4 00 01 00 28 F9 59 C5 E6 34 43 53 95 C8 17 2E 62 78 BF E8 27 BF 20 BA 11 5A 74 D1 7C D0 95 6C F6 A3 41 D2 84 BD 7D F6 64 BC 27 40 50 01 15 00 10 44 98 EB B8 30 3B DE 7D 2B CC 4C 41 B3 1C 92 86"
val s = DataInputStream(data.hexToBytes().inputStream())
val packet = ServerLoginResponseVerificationCodePacket(s,(data.length+1)/3)
...
...
@@ -43,4 +45,8 @@ fun main(){
File(System.getProperty("user.dir") + "/5.png").createNewFile()
packet.verifyCode.inputStream().transferTo(FileOutputStream(System.getProperty("user.dir") + "/5.png"))
*/
val
packet
=
ClientPasswordSubmissionPacket
(
1994701021
,
"xiaoqqq"
,
131513
,
"123.123.123.123"
,
"tgtgtKey"
.
toByteArray
(),
""
.
toByteArray
())
packet
.
encodeToByteArray
().
toUByteArray
().
toHexString
(
" "
)
}
\ No newline at end of file
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