Improved MS security

This commit is contained in:
ceikry
2021-08-10 22:16:48 -05:00
parent b4b26cb583
commit cdc3d65fe8
10 changed files with 42 additions and 54 deletions
@@ -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"
}
}
}