pcap path "not hardcoded" anymore

This commit is contained in:
raphaeIl
2025-01-14 08:00:26 -05:00
parent 2ac86f80b6
commit 7bd937dac5
7 changed files with 19119 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ namespace Novaria.Common.Core
} }
packetWriter.Write(msgIdBytes.AsSpan<byte>()); packetWriter.Write(msgIdBytes.AsSpan<byte>());
packetWriter.Write(packet.msgBody.AsSpan<byte>()); packetWriter.Write(packet.msgBody.AsSpan<byte>());
byte[] packetData = ((MemoryStream)packetWriter.BaseStream).ToArray(); byte[] packetData = ((MemoryStream)packetWriter.BaseStream).ToArray();
@@ -262,6 +262,8 @@ namespace Novaria.Common.Core
msgBody = decrypted_bytes[2..], msgBody = decrypted_bytes[2..],
}; };
Utils.PrintByteArray(decrypted_bytes);
IKEReq ike_request = IKEReq.Parser.ParseFrom(packet.msgBody); IKEReq ike_request = IKEReq.Parser.ParseFrom(packet.msgBody);
return ike_request; return ike_request;

View File

@@ -8,6 +8,7 @@ using Novaria.Common.Util;
//using Mono.Security.Cryptography; //using Mono.Security.Cryptography;
using NSec.Cryptography; using NSec.Cryptography;
using Serilog;
using static System.Runtime.InteropServices.JavaScript.JSType; using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Novaria.Common.Crypto namespace Novaria.Common.Crypto
@@ -46,15 +47,20 @@ namespace Novaria.Common.Crypto
FIRST_IKE_KEY = new byte[] { 51, 76, 83, 57, 38, 111, 89, 100, 115, 112, 94, 53, 119, 105, 56, 38, 90, 120, 67, 35, 99, 55, 77, 90, 103, 55, 51, 104, 98, 69, 68, 119 }; FIRST_IKE_KEY = new byte[] { 51, 76, 83, 57, 38, 111, 89, 100, 115, 112, 94, 53, 119, 105, 56, 38, 90, 120, 67, 35, 99, 55, 77, 90, 103, 55, 51, 104, 98, 69, 68, 119 };
if (clientType == ClientType.Mobile) //if (clientType == ClientType.Mobile)
{ //{
FIRST_IKE_KEY = Encoding.ASCII.GetBytes("3LS9&oYdsp^5wi8&ZxC#c7MZg73hbEDw"); // FIRST_IKE_KEY = Encoding.ASCII.GetBytes("3LS9&oYdsp^5wi8&ZxC#c7MZg73hbEDw");
} // Log.Information("Mobile Client Type with key:");
// Utils.PrintByteArray(FIRST_IKE_KEY);
//}
else //else
{ //{
FIRST_IKE_KEY = Encoding.ASCII.GetBytes("#$*;1H&x*)0!@,/OcIe4VbiL[~fLyE7t"); // FIRST_IKE_KEY = Encoding.ASCII.GetBytes("#$*;1H&x*)0!@,/OcIe4VbiL[~fLyE7t");
} // Log.Information("PC Client Type with key:");
// Utils.PrintByteArray(FIRST_IKE_KEY);
//}
FIRST_IKE_KEY = Encoding.ASCII.GetBytes("3LS9&oYdsp^5wi8&ZxC#c7MZg73hbEDw");
associatedData = new byte[13]; associatedData = new byte[13];

View File

@@ -19,11 +19,9 @@ namespace Novaria.PcapParser
public int totalPacketsCount = 0; public int totalPacketsCount = 0;
public List<NovaPacket> packets = new List<NovaPacket>(); public List<NovaPacket> packets = new List<NovaPacket>();
private readonly string rootPath = "E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.PcapParser\\";
public void Parse(string pcapFileName, bool auto_key = true) public void Parse(string pcapFileName, bool auto_key = true)
{ {
string pcapJsonFile = File.ReadAllText(rootPath + pcapFileName); string pcapJsonFile = File.ReadAllText($"../../../../Novaria.PcapParser/{pcapFileName}"); // disgusting pathing, but "not hardcoded" now ig
var data = System.Text.Json.JsonSerializer.Deserialize<List<PcapPacket>>(pcapJsonFile); var data = System.Text.Json.JsonSerializer.Deserialize<List<PcapPacket>>(pcapJsonFile);
foreach (PcapPacket packet in data) foreach (PcapPacket packet in data)
@@ -90,7 +88,7 @@ namespace Novaria.PcapParser
public void SavePackets(string saveFileName) public void SavePackets(string saveFileName)
{ {
Console.WriteLine($"Got {packets.Count} packet(s) out a total of {totalPacketsCount}"); Console.WriteLine($"Got {packets.Count} packet(s) out a total of {totalPacketsCount}");
File.WriteAllText(rootPath + saveFileName, JsonConvert.SerializeObject(packets, Formatting.Indented)); File.WriteAllText($"../../../{saveFileName}", JsonConvert.SerializeObject(packets, Formatting.Indented));
} }
public IMessage GetPcapPacket(NetMsgId msgId) public IMessage GetPcapPacket(NetMsgId msgId)

File diff suppressed because it is too large Load Diff

BIN
Novaria.SDKServer/Character Normal file

Binary file not shown.

View File

@@ -102,6 +102,8 @@ namespace Novaria.GameServer.Controllers.Api
Request.Body.CopyTo(memoryStream); // Copy request body to MemoryStream Request.Body.CopyTo(memoryStream); // Copy request body to MemoryStream
byte[] rawPayload = memoryStream.ToArray(); // Get raw bytes from MemoryStream byte[] rawPayload = memoryStream.ToArray(); // Get raw bytes from MemoryStream
Utils.PrintByteArray(rawPayload);
IKEReq ikeRequest = HttpNetworkManager.Instance.ParseIkeRequest(rawPayload); IKEReq ikeRequest = HttpNetworkManager.Instance.ParseIkeRequest(rawPayload);
Log.Information("Decoded Packet: " + JsonSerializer.Serialize(ikeRequest)); Log.Information("Decoded Packet: " + JsonSerializer.Serialize(ikeRequest));

View File

@@ -11,6 +11,7 @@ using System.Numerics;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using Nova.Client;
namespace Novaria.GameServer namespace Novaria.GameServer
{ {
@@ -18,13 +19,16 @@ namespace Novaria.GameServer
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
byte[] spub = new byte[] { 0, 219, 176, 103, 73, 245, 239, 125, 227, 240, 79, 51, 62, 250, 113, 143, 251, 155, 158, 45, 101, 1, 6, 185, 140, 153, 221, 163, 200, 112, 161, 11, 138, 163, 7, 71, 182, 127, 144, 192, 147, 169, 124, 54, 220, 208, 253, 121, 80, 41, 4, 97, 51, 129, 32, 228, 40, 227, 89, 226, 152, 51, 24, 105, 233, 140, 153, 114, 142, 244, 105, 13, 201, 150, 39, 192, 101, 50, 39, 57, 59, 110, 88, 201, 150, 221, 251, 248, 247, 250, 33, 114, 125, 200, 182, 163, 176 }; //byte[] spub = new byte[] { 0, 219, 176, 103, 73, 245, 239, 125, 227, 240, 79, 51, 62, 250, 113, 143, 251, 155, 158, 45, 101, 1, 6, 185, 140, 153, 221, 163, 200, 112, 161, 11, 138, 163, 7, 71, 182, 127, 144, 192, 147, 169, 124, 54, 220, 208, 253, 121, 80, 41, 4, 97, 51, 129, 32, 228, 40, 227, 89, 226, 152, 51, 24, 105, 233, 140, 153, 114, 142, 244, 105, 13, 201, 150, 39, 192, 101, 50, 39, 57, 59, 110, 88, 201, 150, 221, 251, 248, 247, 250, 33, 114, 125, 200, 182, 163, 176 };
byte[] cpriv = new byte[] { 10,128,76,30}; //byte[] cpriv = new byte[] { 10,128,76,30};
byte[] res = DiffieHellman.Instance.CalculateKey(spub, cpriv); //byte[] res = DiffieHellman.Instance.CalculateKey(spub, cpriv);
Utils.PrintByteArray(res); //Utils.PrintByteArray(res);
Log.Information("Starting SDK Server...");
//table_Character table_Character = table_Character.Parser.ParseFrom(File.ReadAllBytes("E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\Character"));
//Log.Information("Starting SDK Server...");
try try
{ {
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);