mirror of
https://github.com/raphaeIl/Novaria.git
synced 2025-12-14 07:24:48 +01:00
crypto attempts
This commit is contained in:
104
Novaria.SDKServer/Controllers/Api/GatewayController.cs
Normal file
104
Novaria.SDKServer/Controllers/Api/GatewayController.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Novaria.Common.Crypto;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using Serilog;
|
||||
using Novaria.Common.Utils;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Novaria.SDKServer.Controllers.Api
|
||||
{
|
||||
[Route("/agent-zone-1")]
|
||||
public class GatewayController : ControllerBase
|
||||
{
|
||||
public int req_count;
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult PostRequest()
|
||||
{
|
||||
//var memoryStream = new MemoryStream();
|
||||
|
||||
//Request.Body.CopyTo(memoryStream);
|
||||
//byte[] requestBodyBytes = memoryStream.ToArray();
|
||||
//Log.Information("Received Gateway Post Request, Payload: ");
|
||||
//Utils.PrintByteArray(requestBodyBytes);
|
||||
|
||||
Response.Headers.Add("Date", DateTime.UtcNow.ToString("R"));
|
||||
Response.Headers.Add("Content-Length", "171");
|
||||
Response.Headers.Add("Connection", "keep-alive");
|
||||
|
||||
Response.Headers.Append("Set-Cookie", "SERVERID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/");
|
||||
Response.Headers.Append("Set-Cookie", "SERVERCORSID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/;SameSite=None;Secure");
|
||||
|
||||
string filePath = "E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\response1"; // Replace with the actual file path
|
||||
|
||||
if (req_count == 1)
|
||||
{
|
||||
filePath = "E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\response2"; // Replace with the actual file path
|
||||
}
|
||||
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
|
||||
Response.Body.WriteAsync(fileBytes, 0, fileBytes.Length);
|
||||
|
||||
req_count++;
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
[HttpOptions] // Ike
|
||||
public IActionResult OptionsRequest()
|
||||
{
|
||||
// store key which is used in AeadTool
|
||||
|
||||
// Set response headers
|
||||
Response.Headers.Add("Date", DateTime.UtcNow.ToString("R"));
|
||||
Response.Headers.Add("Content-Length", "251");
|
||||
Response.Headers.Add("Connection", "keep-alive");
|
||||
|
||||
// Set cookies
|
||||
Response.Headers.Append("Set-Cookie", "acw_tc=cb6df452e3196d1ec00d2fcdf7726b25ed2accbaa45e1066701a61d2da90b384;path=/;HttpOnly;Max-Age=1800");
|
||||
Response.Headers.Append("Set-Cookie", "SERVERID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/");
|
||||
Response.Headers.Append("Set-Cookie", "SERVERCORSID=eef797ff9d3671d413582d7dc2f39f29|1736422941|1736422941;Path=/;SameSite=None;Secure");
|
||||
|
||||
// Set binary content as the response body
|
||||
string filePath = "E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\options_response"; // Replace with the actual file path
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
|
||||
// Write bytes directly to response body
|
||||
Response.Body.WriteAsync(fileBytes, 0, fileBytes.Length);
|
||||
|
||||
// Return no content since the body is written manually
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
//private DiffieHellmanManaged SendKey;
|
||||
|
||||
//// put in connection prob
|
||||
//public static void SetAeadKey(byte[] pubKey) // original lead to HttpNetworkManager
|
||||
//{
|
||||
// byte[] array = this.SendKey.DecryptKeyExchange(pubKey);
|
||||
// int num = array.Length;
|
||||
// if (num > 32)
|
||||
// {
|
||||
// num = 32;
|
||||
// }
|
||||
// this.key3 = new byte[32];
|
||||
// Buffer.BlockCopy(array, 0, this.key3, 0, num);
|
||||
// this.HasKey3 = true;
|
||||
// this.seq = 1;
|
||||
//}
|
||||
|
||||
//public byte[] DecryptKeyExchange(byte[] keyEx)
|
||||
//{
|
||||
// BigInteger bigInteger = new BigInteger(keyEx).ModPow(this.m_X, this.m_P);
|
||||
// byte[] bytes = bigInteger.GetBytes();
|
||||
// bigInteger.Clear();
|
||||
// return bytes;
|
||||
//}
|
||||
}
|
||||
}
|
||||
35
Novaria.SDKServer/Controllers/HealthGameController.cs
Normal file
35
Novaria.SDKServer/Controllers/HealthGameController.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Serilog;
|
||||
|
||||
namespace Novaria.SDKServer.CoNovariaollers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("/health-game")]
|
||||
public class HealthGameController : ControllerBase
|
||||
{
|
||||
[Route("identity-auth")]
|
||||
public IResult PostIdentityAuth()
|
||||
{
|
||||
Log.Information("post login received!");
|
||||
|
||||
string jsonResponse = @"
|
||||
{
|
||||
""Code"": 200,
|
||||
""Data"": {
|
||||
""Identity"": {
|
||||
""BirthDate"": """",
|
||||
""IDCard"": ""500*********11861*"",
|
||||
""PI"": """",
|
||||
""RealName"": ""*思"",
|
||||
""State"": 1,
|
||||
""Type"": 0,
|
||||
""Underage"": false
|
||||
}
|
||||
},
|
||||
""Msg"": ""OK""
|
||||
}
|
||||
";
|
||||
return Results.Text(jsonResponse, "application/json");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,20 +39,6 @@ namespace Novaria.SDKServer.CoNovariaollers
|
||||
Log.Information("Response bytes:");
|
||||
return File(response, "text/html");
|
||||
}
|
||||
|
||||
[HttpGet("{*catchAll}")]
|
||||
public IResult CatchAllGet(string catchAll)
|
||||
{
|
||||
Log.Information($"HttpGet: {catchAll}");
|
||||
return Results.Empty;
|
||||
}
|
||||
|
||||
[HttpPost("{*catchAll}")]
|
||||
public IResult CatchAllPost(string catchAll)
|
||||
{
|
||||
Log.Information($"HttpGet: {catchAll}");
|
||||
return Results.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Serilog;
|
||||
|
||||
namespace Novaria.SDKServer.CoNovariaollers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("/user")]
|
||||
public class SDKController : ControllerBase
|
||||
{
|
||||
[Route("login")]
|
||||
public IResult PostLogin()
|
||||
{
|
||||
Log.Information("post login received!");
|
||||
return Results.Text(@"
|
||||
{
|
||||
""Code"": 200,
|
||||
""Data"": {},
|
||||
""Msg"": ""夏萝莉是小楠梁""
|
||||
}
|
||||
");
|
||||
}
|
||||
}
|
||||
}
|
||||
129
Novaria.SDKServer/Controllers/UserController.cs
Normal file
129
Novaria.SDKServer/Controllers/UserController.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Serilog;
|
||||
|
||||
namespace Novaria.SDKServer.CoNovariaollers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("/user")]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
[Route("login")]
|
||||
public IResult PostLogin()
|
||||
{
|
||||
Log.Information("post login received!");
|
||||
|
||||
string jsonResponse = @"
|
||||
{
|
||||
""Code"": 200,
|
||||
""Data"": {
|
||||
""IsNew"": true,
|
||||
""IsTestAccount"": false,
|
||||
""User"": {
|
||||
""DestroyState"": 0,
|
||||
""ID"": 1,
|
||||
""PID"": ""CN-NOVA"",
|
||||
""State"": 1,
|
||||
""Token"": ""f94d936f7235f84493564ee0282e845cccd44828""
|
||||
}
|
||||
},
|
||||
""Msg"": ""OK""
|
||||
}
|
||||
";
|
||||
return Results.Text(jsonResponse, "application/json");
|
||||
}
|
||||
|
||||
[Route("quick-login")]
|
||||
public IResult PostQuickLogin()
|
||||
{
|
||||
Log.Information("post login received!");
|
||||
|
||||
string jsonResponse = @"
|
||||
{
|
||||
""Code"": 200,
|
||||
""Data"": {
|
||||
""Destroy"": {
|
||||
""DestroyAt"": 0
|
||||
},
|
||||
""Identity"": {
|
||||
""BirthDate"": """",
|
||||
""IDCard"": ""500*********11861*"",
|
||||
""PI"": """",
|
||||
""RealName"": ""*思"",
|
||||
""State"": 1,
|
||||
""Type"": 0,
|
||||
""Underage"": false
|
||||
},
|
||||
""IsTestAccount"": false,
|
||||
""Keys"": [
|
||||
{
|
||||
""NickName"": ""123****4567"",
|
||||
""Type"": ""mobile""
|
||||
}
|
||||
],
|
||||
""User"": {
|
||||
""DestroyState"": 0,
|
||||
""ID"": 1,
|
||||
""PID"": ""CN-NOVA"",
|
||||
""State"": 1,
|
||||
""Token"": ""f94d936f7235f84493564ee0282e845cccd44828""
|
||||
},
|
||||
""Yostar"": {
|
||||
""CreatedAt"": 1735902342,
|
||||
""DefaultNickName"": """",
|
||||
""ID"": 1,
|
||||
""NickName"": ""夏萝莉是小楠梁"",
|
||||
""Picture"": """",
|
||||
""State"": 1
|
||||
}
|
||||
},
|
||||
""Msg"": ""OK""
|
||||
}
|
||||
";
|
||||
return Results.Text(jsonResponse, "application/json");
|
||||
|
||||
}
|
||||
|
||||
[Route("detail")]
|
||||
public IResult PostDetail()
|
||||
{
|
||||
string jsonResponse = @"
|
||||
{
|
||||
""Code"": 200,
|
||||
""Data"": {
|
||||
""Destroy"": {
|
||||
""DestroyAt"": 0
|
||||
},
|
||||
""Identity"": null,
|
||||
""IsTestAccount"": false,
|
||||
""Keys"": [
|
||||
{
|
||||
""NickName"": ""123****4567"",
|
||||
""Type"": ""mobile""
|
||||
}
|
||||
],
|
||||
""User"": {
|
||||
""DestroyState"": 0,
|
||||
""ID"": 1,
|
||||
""PID"": ""CN-NOVA"",
|
||||
""State"": 1,
|
||||
""Token"": ""f94d936f7235f84493564ee0282e845cccd44828""
|
||||
},
|
||||
""Yostar"": {
|
||||
""CreatedAt"": 1,
|
||||
""DefaultNickName"": """",
|
||||
""ID"": 1,
|
||||
""NickName"": ""夏萝莉是小楠梁"",
|
||||
""Picture"": """",
|
||||
""State"": 1
|
||||
}
|
||||
},
|
||||
""Msg"": ""OK""
|
||||
}
|
||||
";
|
||||
|
||||
return Results.Text(jsonResponse, "application/json");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,12 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Novaria.Common\Novaria.Common.csproj" />
|
||||
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.Reflection;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Newtonsoft.Json;
|
||||
using Novaria.Common.Crypto;
|
||||
using Novaria.Common.Utils;
|
||||
using Pb;
|
||||
using Serilog;
|
||||
|
||||
@@ -11,6 +15,106 @@ namespace Novaria.SDKServer
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var protos = FileDescriptorSet.Parser.ParseFrom(PB.ProtoPB);
|
||||
var tables = FileDescriptorSet.Parser.ParseFrom(PB.TablePB);
|
||||
var tempDatas = FileDescriptorSet.Parser.ParseFrom(PB.RogueLikeTempDataPB);
|
||||
|
||||
foreach (var fileDescriptorProto in protos.File)
|
||||
{
|
||||
|
||||
Console.WriteLine(fileDescriptorProto.ToString());
|
||||
//Utils.SaveFileDescriptorProtoToFile(fileDescriptorProto, "protos");
|
||||
}
|
||||
|
||||
foreach (var fileDescriptorProto in tables.File)
|
||||
{
|
||||
//Utils.SaveFileDescriptorProtoToFile(fileDescriptorProto, "tables");
|
||||
}
|
||||
|
||||
foreach (var fileDescriptorProto in tempDatas.File)
|
||||
{
|
||||
//Utils.SaveFileDescriptorProtoToFile(fileDescriptorProto, "temp_datas");
|
||||
}
|
||||
|
||||
Span<byte> ss = new byte[]
|
||||
{
|
||||
0, 5, 10, 134, 1, 68, 109, 47, 77, 102, 110, 116, 78, 49, 107, 78,
|
||||
97, 83, 47, 49, 79, 110, 121, 51, 86, 82, 76, 100, 90, 67, 69, 113,
|
||||
47, 71, 47, 70, 81, 112, 83, 86, 65, 114, 48, 81, 112, 101, 107, 104,
|
||||
104, 106, 83, 69, 48, 51, 73, 121, 107, 108, 65, 102, 65, 84, 112, 83,
|
||||
56, 85, 80, 76, 107, 76, 103, 48, 80, 119, 116, 80, 48, 67, 78, 86,
|
||||
43, 76, 85, 103, 98, 51, 75, 97, 79, 111, 56, 89, 115, 106, 68, 66,
|
||||
86, 77, 51, 47, 65, 83, 108, 80, 77, 109, 56, 68, 50, 111, 119, 108,
|
||||
71, 119, 106, 81, 83, 71, 105, 54, 106, 79, 97, 102, 99, 49, 122, 84,
|
||||
98, 107, 89, 81, 121, 76, 43, 56, 121, 90, 103
|
||||
};
|
||||
|
||||
Span<byte> result = new byte[ss.Length];
|
||||
|
||||
ReadOnlySpan<byte> key = new byte[]
|
||||
{
|
||||
21, 218, 151, 4, 236, 175, 191, 183, 193, 244, 248, 163, 11, 144, 99, 164,
|
||||
138, 121, 155, 96, 50, 149, 206, 111, 180, 143, 229, 65, 219, 192, 118, 47
|
||||
};
|
||||
|
||||
ReadOnlySpan<byte> nonce = new byte[]
|
||||
{
|
||||
231, 71, 160, 150, 98, 120, 185, 234, 18, 80, 239, 227
|
||||
};
|
||||
|
||||
ReadOnlySpan<byte> data = new byte[]
|
||||
{
|
||||
18, 191, 220, 69, 194, 61, 223, 106, 190, 177, 23, 221, 204, 255, 80, 97,
|
||||
197, 131, 41, 185, 42, 139, 225, 133, 223, 140, 11, 43, 152, 78, 4, 163,
|
||||
87, 50, 33, 61, 168, 219, 213, 188, 78, 115, 60, 143, 185, 165, 3, 62,
|
||||
154, 34, 156, 61, 175, 105, 25, 129, 254, 143, 225, 107, 211, 9, 201, 7,
|
||||
10, 85, 115, 115, 131, 209, 20, 48, 124, 149, 33, 52, 204, 166, 154, 207,
|
||||
206, 28, 76, 249, 48, 191, 249, 11, 236, 193, 49, 216, 226, 101, 52, 234,
|
||||
73, 79, 154, 226, 141, 9, 70, 194, 252, 202, 65, 168, 247, 161, 228, 84,
|
||||
246, 133, 84, 64, 64, 252, 55, 44, 5, 164, 143, 110, 140, 232, 125, 91,
|
||||
244, 62, 170, 18, 0, 212, 72, 235, 250, 85, 143, 89, 26, 162, 186, 243,
|
||||
4, 222, 193, 249, 215, 243, 155, 204, 88, 131, 145
|
||||
};
|
||||
|
||||
AeadTool.Dencrypt_ChaCha20(result, key, nonce, data);
|
||||
|
||||
Utils.PrintByteArray(result.ToArray());
|
||||
|
||||
return;
|
||||
//byte[] bytes = File.ReadAllBytes("E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\req1");
|
||||
|
||||
// byte[] data = new byte[] {
|
||||
// 88, 2, 120, 1, 106, 8, 79, 102, 102, 105, 99, 105, 97, 108,
|
||||
// 98, 5, 122, 104, 95, 67, 78, 114, 16, 100, 99, 49, 56, 101,
|
||||
// 49, 50, 98, 57, 54, 50, 57, 101, 57, 52, 101, 26, 48, 18,
|
||||
// 40, 50, 50, 97, 99, 56, 56, 54, 101, 53, 102, 98, 101, 101,
|
||||
// 102, 52, 100, 98, 98, 56, 100, 56, 51, 54, 100, 56, 98, 99,
|
||||
// 98, 49, 54, 54, 54, 56, 100, 98, 55, 99, 97, 55, 100, 8,
|
||||
// 240, 186, 151, 225, 3
|
||||
//};
|
||||
|
||||
//var a = UserRequest.Parser.ParseFrom(data);
|
||||
|
||||
//Console.WriteLine(JsonConvert.SerializeObject(a));
|
||||
|
||||
//ServerListMeta message;
|
||||
|
||||
//using (var input = File.OpenRead("E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\test_protos.pb"))
|
||||
//{
|
||||
// message = ServerListMeta.Parser.ParseFrom(input);
|
||||
//}
|
||||
|
||||
//Console.WriteLine(message.Announcement);
|
||||
|
||||
//return;
|
||||
|
||||
//byte[] bytes = File.ReadAllBytes("E:\\documents\\Decompiling\\Extracted\\NOVA\\Novaria\\Novaria.SDKServer\\req1");
|
||||
|
||||
//byte[] result = AeadTool.DecryptAesCBCInfo(AeadTool.DEFAULT_SERVERLIST_KEY, bytes[..16], bytes[16..(((int)(bytes.Length / 16)) * 16)]);
|
||||
|
||||
////Utils.PrintByteArray(result);
|
||||
//string resstr = System.Text.Encoding.UTF8.GetString(result);
|
||||
//Console.WriteLine(resstr); // Output: "Hello"
|
||||
Log.Information("Starting SDK Server...");
|
||||
try
|
||||
{
|
||||
|
||||
3
Novaria.SDKServer/options_response
Normal file
3
Novaria.SDKServer/options_response
Normal file
@@ -0,0 +1,3 @@
|
||||
<EFBFBD><EFBFBD>d<EFBFBD>
|
||||
'<27><1A>!<21>15L<35>M<EFBFBD>m<EFBFBD>P<EFBFBD><50><0F>}n1<6E><31>b
|
||||
㏐<EFBFBD>&<26><08><><EFBFBD><EFBFBD>u<g<>Ui<55>OP1C<31><43><EFBFBD><EFBFBD>#<23>뱇<1D>Ht<48><0E> <20><>EZ<15>j<EFBFBD>MlZ<6C>B<EFBFBD>{<13>m<EFBFBD>tKY'V<>d<EFBFBD><64>?<3F><>ߨ<EFBFBD><DFA8>Lf<4C><66>:`W<>
|
||||
2
Novaria.SDKServer/req1
Normal file
2
Novaria.SDKServer/req1
Normal file
@@ -0,0 +1,2 @@
|
||||
<15><>GsQ<>xK!P]<5D><1D>kl<6B><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>b6&J<1E><><EFBFBD>q-<12>H<EFBFBD>ߺ<EFBFBD>8<EFBFBD>Qi<51><69><EFBFBD><EFBFBD><EFBFBD>B4<42>_<EFBFBD><5F>UH<55>H<><48>/z*Q<>Xu<58><75>/<2F>[Hؽ<17>Y<EFBFBD>@<40><1F>JQc&HsV<73><56><11><>& <20><>H<EFBFBD><0B>
|
||||
<EFBFBD>$P<><50>e<><65>v<EFBFBD>y<>åV<C3A5> |,|<7C>n<14><><EFBFBD><EFBFBD>v<EFBFBD><76>/i<>aSq<53>S.<2E>4<EFBFBD><34>ߝ<EFBFBD><DF9D>*d!
|
||||
BIN
Novaria.SDKServer/resData
Normal file
BIN
Novaria.SDKServer/resData
Normal file
Binary file not shown.
BIN
Novaria.SDKServer/response1
Normal file
BIN
Novaria.SDKServer/response1
Normal file
Binary file not shown.
1
Novaria.SDKServer/response2
Normal file
1
Novaria.SDKServer/response2
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>bJ<EFBFBD>6|<12>><3E>Od<4F>.<2E>æ<>ADW<44>Q<>i[<5B>
|
||||
5637
Novaria.SDKServer/test_protos.pb
Normal file
5637
Novaria.SDKServer/test_protos.pb
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user