mirror of
https://github.com/raphaeIl/Novaria.git
synced 2025-12-12 14:34:38 +01:00
fix dh (by plagiarism), refactor pcapparser
This commit is contained in:
@@ -113,18 +113,28 @@ namespace Novaria.GameServer.Controllers.Api
|
||||
Log.Information("RECEIVED client public key: ");
|
||||
Utils.PrintByteArray(clientPublicKey);
|
||||
|
||||
AeadTool.key3 = DiffieHellman.Instance.CalculateKey(clientPublicKey);
|
||||
Console.WriteLine("OLD::");
|
||||
|
||||
Console.WriteLine(new System.Numerics.BigInteger(clientPublicKey.Reverse().ToArray()));
|
||||
|
||||
Console.WriteLine("OLD::");
|
||||
|
||||
//AeadTool.key3 = DiffieHellman.Instance.CalculateKey(clientPublicKey);
|
||||
AeadTool.SetAeadKey(clientPublicKey);
|
||||
Log.Information("KEY3 (chacha20 key) calculated: ");
|
||||
Utils.PrintByteArray(AeadTool.key3);
|
||||
|
||||
byte[] pubKey = AeadTool.GetPubKey();
|
||||
|
||||
IKEResp ikeResponse = new IKEResp()
|
||||
{
|
||||
PubKey = ByteString.CopyFrom(AeadTool.PS_PUBLIC_KEY.Reverse().ToArray()),
|
||||
//PubKey = ByteString.CopyFrom(AeadTool.PS_PUBLIC_KEY.Reverse().ToArray()),
|
||||
PubKey = ByteString.CopyFrom(pubKey),
|
||||
Token = AeadTool.TOKEN
|
||||
};
|
||||
|
||||
Log.Information("Sending ps server public key: ");
|
||||
Utils.PrintByteArray(AeadTool.PS_PUBLIC_KEY);
|
||||
Utils.PrintByteArray(pubKey);
|
||||
|
||||
Packet ikePacket = new Packet()
|
||||
{
|
||||
|
||||
@@ -52,20 +52,6 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
|
||||
accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 101, StepId = -1 });
|
||||
accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 102, StepId = -1 });
|
||||
|
||||
|
||||
byte[] real_key = AeadTool.key3;
|
||||
ClientType real_client_type = AeadTool.clientType;
|
||||
|
||||
// load from pcap
|
||||
AeadTool.clientType = ClientType.Mobile; // my pcap were from mobile so gotta switch it over
|
||||
AeadTool.InitAeadTool();
|
||||
|
||||
PcapParser.PcapParser.Instance.Parse("all_mainmenu_packets.json");
|
||||
|
||||
// after pcap parse switch it back, this should rlly be done inside PcapParser.Parse()
|
||||
AeadTool.clientType = real_client_type;
|
||||
AeadTool.InitAeadTool();
|
||||
|
||||
PlayerInfo pcapPlayerInfo = (PlayerInfo)PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.player_data_succeed_ack);
|
||||
|
||||
PlayerInfo playerInfoResponse = new PlayerInfo()
|
||||
@@ -73,7 +59,6 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
|
||||
Acc = pcapPlayerInfo.Acc
|
||||
};
|
||||
|
||||
AeadTool.key3 = real_key;
|
||||
Log.Information("Sending player_new_notify packet: " + JsonSerializer.Serialize(pcapPlayerInfo));
|
||||
return Packet.Create(NetMsgId.player_data_succeed_ack, pcapPlayerInfo);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Novaria.GameServer
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
PcapParser.PcapParser.Instance.LoadAllPackets(); // turn this off after real handlers are finished
|
||||
|
||||
Log.Information("Starting SDK Server...");
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user