serverlist handler + basic crypto, rename project

This commit is contained in:
raphaeIl
2025-01-08 23:19:50 -05:00
parent f855950370
commit 55c3fc1fec
563 changed files with 278 additions and 206 deletions

View File

@@ -1,92 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Pb;
namespace NTR.SDKServer.Controllers
{
[ApiController]
[Route("/")]
public class LauncherSDKController : ControllerBase
{
private readonly ILogger<LauncherSDKController> _logger;
public LauncherSDKController(ILogger<LauncherSDKController> logger)
{
_logger = logger;
}
[Route("meta/serverlist.html")]
public IActionResult GetConfig()
{
Console.WriteLine("serverlist get received!");
//https://nova-static.yostar.cn/meta/serverlist.html
ServerListMeta serverListMeta = new ServerListMeta()
{
Status = 200,
Announcement = "sdjsldkfsf",
};
var responseContent = System.IO.File.ReadAllBytes("E:\\documents\\Decompiling\\Extracted\\NOVA\\PS\\NTR.SDKServer\\bodyencrypted");
Console.WriteLine("responseContent: " + responseContent);
var responseHeaders = new HeaderDictionary
{
{ "Server", "Tengine" },
{ "Content-Type", "text/html; charset=utf-8" },
{ "Content-Length", responseContent.Length.ToString() },
{ "Connection", "keep-alive" },
{ "Date", DateTime.UtcNow.ToString("R") },
{ "x-oss-request-id", "677E5AB989F0063436699689" },
{ "x-oss-cdn-auth", "success" },
{ "Accept-Ranges", "bytes" },
{ "ETag", "\"F7BF56AF4420F308AE12106BDE15B4A0\"" },
{ "Last-Modified", DateTime.UtcNow.AddHours(-8).ToString("R") },
{ "x-oss-object-type", "Normal" },
{ "x-oss-hash-crc64ecma", "15118450623091409826" },
{ "x-oss-storage-class", "Standard" },
{ "Content-MD5", "979Wr0Qg8wiuEhBr3hW0oA==" },
{ "x-oss-server-time", "50" },
{ "Via", "ens-cache14.l2us3[1761,1761,200-0,M], ens-cache29.l2us3[1762,0], ens-cache15.us23[0,0,200-0,H], ens-cache9.us23[13,0]" },
{ "Age", "17639" },
{ "Ali-Swift-Global-Savetime", "1736334009" },
{ "X-Cache", "HIT TCP_HIT dirn:10:384655405" },
{ "X-Swift-SaveTime", DateTime.UtcNow.ToString("R") },
{ "X-Swift-CacheTime", "93312000" },
{ "Timing-Allow-Origin", "*" },
{ "EagleId", "0826799d17363516484194117e" }
};
//var response = new ContentResult
//{
// Content = responseContent,
// ContentType = "text/html; charset=utf-8",
// StatusCode = 200
//};
//foreach (var header in responseHeaders)
//{
// Response.Headers[header.Key] = header.Value;
//}
return null;
}
[HttpGet("{*catchAll}")]
public IResult CatchAllGet(string catchAll)
{
_logger.LogDebug($"HttpGet: {catchAll}");
return Results.Empty;
}
[HttpPost("{*catchAll}")]
public IResult CatchAllPost(string catchAll)
{
_logger.LogDebug($"HttpGet: {catchAll}");
return Results.Empty;
}
}
}

View File

@@ -1,64 +0,0 @@
using System.Reflection;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Pb;
using Serilog;
namespace NTR.SDKServer
{
public class SDKServer
{
public static void Main(string[] args)
{
byte[] serverlistResponse = new byte[]
{
8, 37, 18, 56, 10, 12, 229, 144, 175, 230, 152, 142, 230, 181, 139, 232,
175, 149, 18, 36, 104, 116, 116, 112, 115, 58, 47, 47, 110, 111, 118, 97,
46, 121, 111, 115, 116, 97, 114, 46, 99, 110, 47, 97, 103, 101, 110, 116,
45, 122, 111, 110, 101, 45, 49, 47, 24, 1, 32, 1, 24, 1, 34, 52, 230, 181,
139, 232, 175, 149, 229, 176, 154, 230, 156, 170, 229, 188, 128, 229, 167,
139, 239, 188, 140, 233, 162, 132, 232, 174, 161, 229, 188, 128, 230, 156,
141, 230, 151, 182, 233, 151, 180, 49, 230, 156, 136, 57, 230, 151, 165,
49, 49, 58, 48, 48, 50, 30, 104, 116, 116, 112, 115, 58, 47, 47, 110, 111,
118, 97, 46, 121, 111, 115, 116, 97, 114, 46, 99, 110, 47, 114, 101, 112,
111, 114, 116, 47
};
ServerListMeta serverListMeta = ServerListMeta.Parser.ParseFrom(serverlistResponse);
Console.WriteLine(serverListMeta);
System.IO.File.WriteAllText("E:\\documents\\Decompiling\\Extracted\\NOVA\\PS\\NTR.SDKServer\\serverlist.json", serverListMeta.ToString());
return;
Log.Information("Starting SDK Server...");
try
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.Configure<KestrelServerOptions>(op =>
op.AllowSynchronousIO = true
);
builder.Host.UseSerilog();
builder.Services.AddControllers();
builder.Services.AddControllers().AddApplicationPart(Assembly.GetAssembly(typeof(SDKServer)));
var app = builder.Build();
app.UseAuthorization();
app.UseSerilogRequestLogging();
app.MapControllers();
app.Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "An unhandled exception occurred during runtime");
}
finally
{
Log.CloseAndFlush();
}
}
}
}

43
NTR.sln
View File

@@ -1,43 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NTR", "NTR\NTR.csproj", "{355DD995-D62E-45E5-A793-0C7444B47AC0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NTR.SDKServer", "NTR.SDKServer\NTR.SDKServer.csproj", "{B95D975D-7B6C-4454-949D-4ABEF2F32CD6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NTR.GameServer", "NTR.GameServer\NTR.GameServer.csproj", "{A96262D4-4E2F-4380-BBF7-56871022CDBA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NTR.Common", "NTR.Common\NTR.Common.csproj", "{37D76E89-3E54-4DD7-A182-4123BC4E0DEA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{355DD995-D62E-45E5-A793-0C7444B47AC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{355DD995-D62E-45E5-A793-0C7444B47AC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{355DD995-D62E-45E5-A793-0C7444B47AC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{355DD995-D62E-45E5-A793-0C7444B47AC0}.Release|Any CPU.Build.0 = Release|Any CPU
{B95D975D-7B6C-4454-949D-4ABEF2F32CD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B95D975D-7B6C-4454-949D-4ABEF2F32CD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B95D975D-7B6C-4454-949D-4ABEF2F32CD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B95D975D-7B6C-4454-949D-4ABEF2F32CD6}.Release|Any CPU.Build.0 = Release|Any CPU
{A96262D4-4E2F-4380-BBF7-56871022CDBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A96262D4-4E2F-4380-BBF7-56871022CDBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A96262D4-4E2F-4380-BBF7-56871022CDBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A96262D4-4E2F-4380-BBF7-56871022CDBA}.Release|Any CPU.Build.0 = Release|Any CPU
{37D76E89-3E54-4DD7-A182-4123BC4E0DEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37D76E89-3E54-4DD7-A182-4123BC4E0DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37D76E89-3E54-4DD7-A182-4123BC4E0DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37D76E89-3E54-4DD7-A182-4123BC4E0DEA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {05CA4D67-C259-43C1-BEF3-FF525EDCF452}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Novaria.Common.Crypto
{
public static class AeadTool
{
public static readonly byte[] DEFAULT_SERVERLIST_KEY;
public static readonly byte[] DEFAULT_SERVERLIST_IV;
static AeadTool()
{
DEFAULT_SERVERLIST_KEY = new byte[] { 74, 72, 42, 67, 80, 51, 50, 57, 89, 120, 111, 103, 81, 74, 69, 120 };
DEFAULT_SERVERLIST_IV = new byte[] { 225, 92, 61, 72, 193, 89, 3, 64, 50, 61, 50, 145, 59, 128, 99, 72 };
}
public static byte[] DecryptAesCBCInfo(byte[] key, byte[] IV, byte[] cipherBytes)
{
return null;
}
public static byte[] EncryptAesCBCInfo(byte[] key, byte[] IV, byte[] plainBytes)
{
using (Aes aes = Aes.Create())
{
aes.Key = key;
aes.IV = IV;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
using (ICryptoTransform encryptor = aes.CreateEncryptor())
{
return encryptor.TransformFinalBlock(plainBytes, 0, plainBytes.Length);
}
}
}
}
}

View File

@@ -0,0 +1,14 @@
namespace Novaria.Common.Crypto
{
public static class XOR
{
public static void Crypt(byte[] bytes, byte[] key, uint offset = 0)
{
while (offset < bytes.Length)
{
bytes[offset] ^= key[offset % key.Length];
offset++;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More