fix: Removes razor negotiations since they arent maintained (#1090)

This commit is contained in:
Kamron Batman 2022-06-26 08:33:53 -07:00 committed by GitHub
parent 4f28e1e3c4
commit 8d3aaaeb2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 188 deletions

View file

@ -16,7 +16,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Server.Assistants;
using CV = Server.ClientVersion;
namespace Server.Network;
@ -70,32 +69,9 @@ public static class IncomingAccountPackets
var flags = reader.ReadInt32();
reader.Seek(8, SeekOrigin.Current);
int prof = reader.ReadByte();
reader.Seek(15, SeekOrigin.Current);
int genderRace;
if (AssistantConfiguration.Enabled && AssistantConfiguration.Settings.DisallowedFeatures != AssistantFeatures.None)
{
var razorFeatures = (AssistantFeatures)reader.ReadUInt64();
var key = reader.ReadUInt64();
var authOk = razorFeatures == AssistantConfiguration.Settings.DisallowedFeatures &&
// Highly recommend a shard changes these here, in razor and redistribute the assistant.
(key & 0xFFFFFFFFFFFFFF00ul) == 0x0911832B04178300ul;
EventSink.InvokeAssistantAuth(new AssistantAuthEventArgs(state, state.Account, authOk));
if (!state.Running)
{
return;
}
genderRace = (int)(key & 0xFF);
}
else
{
reader.Seek(15, SeekOrigin.Current);
genderRace = reader.ReadByte();
}
var genderRace = reader.ReadByte();
var stats = new StatNameValue[]
{
@ -246,41 +222,9 @@ public static class IncomingAccountPackets
public static void PlayCharacter(NetState state, CircularBufferReader reader, int packetLength)
{
reader.Seek(4, SeekOrigin.Current); // 0xEDEDEDED
reader.Seek(30, SeekOrigin.Current); // var name = reader.ReadAscii(30);
reader.Seek(2, SeekOrigin.Current);
reader.Seek(36, SeekOrigin.Current); // 4 = 0xEDEDEDED, 30 = Name, 2 = unknown
var flags = reader.ReadInt32();
if (AssistantConfiguration.Enabled && AssistantConfiguration.Settings.DisallowedFeatures != AssistantFeatures.None)
{
var razorFeatures = (AssistantFeatures)reader.ReadUInt64();
var key1 = reader.ReadUInt64();
var key2 = reader.ReadUInt64();
var authOk = razorFeatures == AssistantConfiguration.Settings.DisallowedFeatures &&
// Highly recommend a shard changes these here, in razor and redistribute the assistant.
key1 == 0x0911832B04178305ul && key2 == 0x2485071787061988ul;
EventSink.InvokeAssistantAuth(new AssistantAuthEventArgs(state, state.Account, authOk));
}
else
{
reader.Seek(22, SeekOrigin.Current);
if (reader.ReadUInt16() == 0xDEAD)
{
EventSink.InvokeAssistantAuth(new AssistantAuthEventArgs(state, state.Account, false));
}
}
if (!state.Running)
{
return;
}
reader.Seek(24, SeekOrigin.Current);
var charSlot = reader.ReadInt32();
reader.Seek(4, SeekOrigin.Current); // var clientIP = reader.ReadInt32();

View file

@ -17,9 +17,7 @@ using System;
using System.IO;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using Server.Accounting;
using Server.Assistants;
namespace Server.Network;
@ -286,8 +284,6 @@ public static class OutgoingAccountPackets
ns.Send(writer.Span);
}
private static MD5 _md5Provider;
/**
* Packet: 0xA9
* Length: 1410 or more bytes
@ -334,11 +330,6 @@ public static class OutgoingAccountPackets
writer.Write((ushort)length);
writer.Write((byte)count); // TODO: It is probably more proper to use count.
var enforceRazor = AssistantConfiguration.Enabled &&
AssistantConfiguration.Settings.DisallowedFeatures != AssistantFeatures.None;
Span<byte> hashBuffer = enforceRazor ? stackalloc byte[16] : null;
for (int i = 0; i < count; i++)
{
var m = acct[i];
@ -351,35 +342,6 @@ public static class OutgoingAccountPackets
{
var name = (m.RawName?.Trim()).DefaultIfNullOrEmpty("-no name-");
writer.WriteAscii(name, 30);
}
if (enforceRazor)
{
writer.Write((byte)0);
var pos = writer.Position;
if (i == 0)
{
writer.Write((ulong)AssistantConfiguration.Settings.DisallowedFeatures);
}
if (count > 1 && i == 2 || count == 1 && i == 0)
{
_md5Provider ??= MD5.Create();
if (_md5Provider.TryComputeHash(writer.Span, hashBuffer, out var bytesWritten) && bytesWritten == 16)
{
writer.Write(hashBuffer);
}
}
var remaining = 28 - pos;
Utility.RandomBytes(writer.RawBuffer.Slice(writer.Position, remaining));
writer.Seek(remaining, SeekOrigin.Current);
writer.Write((byte)0);
}
else
{
writer.Clear(30); // password
}
}