Improved MS security
This commit is contained in:
@@ -3,6 +3,8 @@ package core.net.event;
|
||||
import core.cache.misc.buffer.ByteBufferUtils;
|
||||
import core.net.IoSession;
|
||||
import core.net.IoWriteEvent;
|
||||
import rs09.Server;
|
||||
import rs09.ServerConstants;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -12,11 +14,6 @@ import java.nio.ByteBuffer;
|
||||
*/
|
||||
public final class MSHSWriteEvent extends IoWriteEvent {
|
||||
|
||||
/**
|
||||
* The password used to verify
|
||||
*/
|
||||
private static final String PASSWORD = "0x14ari0SSbh98989910";
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MSHSWriteEvent} {@code Object}
|
||||
* @param session The session.
|
||||
@@ -28,9 +25,9 @@ public final class MSHSWriteEvent extends IoWriteEvent {
|
||||
|
||||
@Override
|
||||
public void write(IoSession session, Object context) {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(2 + PASSWORD.length());
|
||||
ByteBuffer buffer = ByteBuffer.allocate(2 + ServerConstants.MS_SECRET_KEY.length());
|
||||
buffer.put((byte) 88);
|
||||
ByteBufferUtils.putString(PASSWORD, buffer);
|
||||
ByteBufferUtils.putString(ServerConstants.MS_SECRET_KEY, buffer);
|
||||
session.queue((ByteBuffer) buffer.flip());
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,9 @@ class ServerConstants {
|
||||
@JvmField
|
||||
var GE_AUTOSTOCK_ENABLED = false
|
||||
|
||||
@JvmField
|
||||
var MS_SECRET_KEY = ""
|
||||
|
||||
//location names for the ::to command.
|
||||
val TELEPORT_DESTINATIONS = arrayOf(
|
||||
arrayOf(Location.create(2974, 4383, 2), "corp", "corporal", "corporeal"),
|
||||
@@ -218,6 +221,9 @@ class ServerConstants {
|
||||
if(data.containsKey("daily_restart")){
|
||||
DAILY_RESTART = data["daily_restart"] as Boolean
|
||||
}
|
||||
|
||||
if(data.containsKey("ms_secret_key")) MS_SECRET_KEY = data["ms_secret_key"].toString()
|
||||
else MS_SECRET_KEY = "2009scape_development"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,8 @@
|
||||
"database_username": "root",
|
||||
"database_password": "",
|
||||
"database_address": "127.0.0.1",
|
||||
"database_port": "3306"
|
||||
"database_port": "3306",
|
||||
"ms_secret_key": "2009scape_development"
|
||||
},
|
||||
|
||||
"PluginToggles": {
|
||||
|
||||
Reference in New Issue
Block a user