diff --git a/Novaria.Common/Crypto/GameDataExtraction.cs b/Novaria.Common/Crypto/GameDataExtraction.cs new file mode 100644 index 0000000..ad91bf8 --- /dev/null +++ b/Novaria.Common/Crypto/GameDataExtraction.cs @@ -0,0 +1,142 @@ +using System.Text; +using Serilog; + +namespace Novaria.Common.Crypto +{ + public class GameDataExtraction + { + public enum GameDataType + { + PrimaryInt, + PrimaryLong, + PrimaryString, + NoPrimary + } + + public class GameDataExtractionResult + { + public GameDataType DataType { get; set; } + public Dictionary PrimaryIntData { get; set; } + public Dictionary PrimaryLongData { get; set; } + public Dictionary PrimaryStringData { get; set; } + public List NoPrimaryData { get; set; } + } + + private int _magicKey; + private string _binVersion; + + public GameDataExtractionResult LoadCommonBinData(string filepath) + { + byte[] array = File.ReadAllBytes(filepath); + if (array == null || array.Length == 0) + { + return null; + } + + GameDataExtractionResult result = new GameDataExtractionResult(); + + using (MemoryStream memoryStream = new MemoryStream(array)) + { + using (BinaryReader binaryReader = new BinaryReader(memoryStream)) + { + // Uncomment and use actual validation if needed. + // if (binaryReader.ReadInt32() != _magicKey) + if (true) + { + int num = binaryReader.ReadInt16(); + byte[] array2 = binaryReader.ReadBytes(num); + // Uncomment and use actual version check if needed. + // if (Encoding.UTF8.GetString(array2) != _binVersion) + if (true) + { + bool hasPrimary = binaryReader.ReadByte() == 1; + byte b = binaryReader.ReadByte(); + bool isPrimaryInt = b == 1; + bool isPrimaryLong = b == 2; + num = binaryReader.ReadInt32(); + + if (hasPrimary) + { + if (isPrimaryInt) + { + result.DataType = GameDataType.PrimaryInt; + result.PrimaryIntData = LoadPrimaryKeyIntTable(binaryReader, num); + } + else if (isPrimaryLong) + { + result.DataType = GameDataType.PrimaryLong; + result.PrimaryLongData = LoadPrimaryLongIntTable(binaryReader, num); + } + else + { + result.DataType = GameDataType.PrimaryString; + result.PrimaryStringData = LoadPrimaryKeyStringTable(binaryReader, num); + } + } + else + { + result.DataType = GameDataType.NoPrimary; + result.NoPrimaryData = LoadNoPrimaryKeyTable(binaryReader, num); + } + } + } + } + } + + return result; + } + + private Dictionary LoadPrimaryKeyIntTable(BinaryReader br, int length) + { + Dictionary table = new Dictionary(); + for (int i = 0; i < length; i++) + { + int key = br.ReadInt32(); + int valueLength = br.ReadInt16(); + byte[] value = br.ReadBytes(valueLength); + table[key] = value; + } + return table; + } + + private Dictionary LoadPrimaryLongIntTable(BinaryReader br, int length) + { + Dictionary table = new Dictionary(); + for (int i = 0; i < length; i++) + { + long key = br.ReadInt64(); + int valueLength = br.ReadInt16(); + byte[] value = br.ReadBytes(valueLength); + table[key] = value; + } + return table; + } + + private Dictionary LoadPrimaryKeyStringTable(BinaryReader br, int length) + { + Dictionary table = new Dictionary(); + for (int i = 0; i < length; i++) + { + int keyLength = br.ReadInt16(); + byte[] keyBytes = br.ReadBytes(keyLength); + string key = Encoding.UTF8.GetString(keyBytes); + int valueLength = br.ReadInt16(); + byte[] value = br.ReadBytes(valueLength); + table[key] = value; + } + return table; + } + + private List LoadNoPrimaryKeyTable(BinaryReader br, int length) + { + List list = new List(); + for (int i = 0; i < length; i++) + { + int dataLength = br.ReadInt16(); + byte[] data = br.ReadBytes(dataLength); + list.Add(data); + } + return list; + } + } +} diff --git a/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Login.cs b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Login.cs index eb8cf92..7576bb5 100644 --- a/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Login.cs +++ b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Login.cs @@ -35,32 +35,585 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers public Packet PlayerDataHandler(Nil req) { // example: different netmsgid returned, if new player player_new_notify, other wise player_data_ack + + PlayerInfo pcapPlayerInfo = (PlayerInfo)PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.player_data_succeed_ack); + AccInfo accountInfo = new AccInfo() { Id = 1, Hashtag = 4562, HeadIcon = 100101, - NickName = "seggs", + NickName = "ArkanDash", Gender = false, Signature = "", TitlePrefix = 1, - TitleSuffix = 1, + TitleSuffix = 2, SkinId = 10301, - CreateTime = DateTime.Now.Ticks, + CreateTime = pcapPlayerInfo.Acc.CreateTime, }; + + accountInfo.Newbies.Add(pcapPlayerInfo.Acc.Newbies); + accountInfo.NextPackage = pcapPlayerInfo.Acc.NextPackage; - accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 101, StepId = -1 }); - accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 102, StepId = -1 }); - - PlayerInfo pcapPlayerInfo = (PlayerInfo)PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.player_data_succeed_ack); + //accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 101, StepId = -1 }); + //accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 102, StepId = -1 }); PlayerInfo playerInfoResponse = new PlayerInfo() { - Acc = pcapPlayerInfo.Acc + Acc = accountInfo }; + playerInfoResponse.Chars.AddRange( + [ + new Proto.Char() + { + Tid = 111, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 11101, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[0].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 117, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 11701, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[1].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 108, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 10801, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[2].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 123, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 12301, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[3].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 127, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 12701, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[4].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 107, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 10701, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[5].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 132, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 13201, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[6].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 135, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 13501, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[7].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 126, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 12601, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[8].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 118, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 11801, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[9].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 142, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 14201, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[10].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 119, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 11901, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[11].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 103, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 10301, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[12].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 125, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 12501, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[13].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 120, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 12001, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[14].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 112, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 11201, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[15].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + new Proto.Char() + { + Tid = 113, + Exp = 0, + DatingLandmarkIds = [], + DatingEventIds = [], + DatingEventRewardIds = [], + EquipmentIds = [ + 0, + 0, + 0 + ], + Level = 90, + SkillLvs = [ + 10, + 10, + 10, + 10, + 1 + ], + Skin = 11301, + AffinityLevel = 20, + AffinityExp = 0, + Advance = 8, + Plots = [], + AffinityQuests = pcapPlayerInfo.Chars[16].AffinityQuests, + TalentNodes = ByteString.Empty, + CreateTime = 1736745112, + NextPackage = ByteString.Empty + }, + ]); + playerInfoResponse.Res.AddRange(pcapPlayerInfo.Res); + playerInfoResponse.Items.AddRange(pcapPlayerInfo.Items); + playerInfoResponse.Formation = pcapPlayerInfo.Formation; + playerInfoResponse.StarTowerRankTicket = 3; + playerInfoResponse.Energy = pcapPlayerInfo.Energy; + playerInfoResponse.WorldClass = pcapPlayerInfo.WorldClass; + playerInfoResponse.Agent = pcapPlayerInfo.Agent; + playerInfoResponse.RglPassedIds.AddRange(pcapPlayerInfo.RglPassedIds); + playerInfoResponse.Equipments.AddRange(pcapPlayerInfo.Equipments); + playerInfoResponse.RegionBossLevels.AddRange(pcapPlayerInfo.RegionBossLevels); + playerInfoResponse.Quests = pcapPlayerInfo.Quests; + playerInfoResponse.State = pcapPlayerInfo.State; + playerInfoResponse.SendGiftCnt = 0; + playerInfoResponse.Board.AddRange(pcapPlayerInfo.Board); + playerInfoResponse.DatingCharIds.AddRange(pcapPlayerInfo.DatingCharIds); + playerInfoResponse.Achievements = pcapPlayerInfo.Achievements; + playerInfoResponse.Handbook.AddRange(pcapPlayerInfo.Handbook); + playerInfoResponse.SigninIndex = 0; + playerInfoResponse.Titles.AddRange(pcapPlayerInfo.Titles); + playerInfoResponse.DailyInstances.AddRange(pcapPlayerInfo.DailyInstances); + playerInfoResponse.Dictionaries.AddRange(pcapPlayerInfo.Dictionaries); + playerInfoResponse.Activities.AddRange(pcapPlayerInfo.Activities); + playerInfoResponse.Phone = pcapPlayerInfo.Phone; + playerInfoResponse.TalentResetTime = 0; + playerInfoResponse.EquipmentDoubleCount = 0; + playerInfoResponse.Discs.AddRange(pcapPlayerInfo.Discs); + playerInfoResponse.Story = pcapPlayerInfo.Story; + playerInfoResponse.VampireSurvivorRecord = pcapPlayerInfo.VampireSurvivorRecord; + playerInfoResponse.DailyActiveIds.AddRange(pcapPlayerInfo.DailyActiveIds); + playerInfoResponse.TourGuideQuestGroup = 0; + playerInfoResponse.HonorList.AddRange(pcapPlayerInfo.HonorList); + playerInfoResponse.Honors.AddRange(pcapPlayerInfo.Honors); + playerInfoResponse.DailyShopRewardStatus = true; + playerInfoResponse.TowerTicket = 0; + playerInfoResponse.ServerTs = pcapPlayerInfo.ServerTs; + playerInfoResponse.NextPackage = pcapPlayerInfo.NextPackage; - Log.Information("Sending player_new_notify packet: " + JsonSerializer.Serialize(pcapPlayerInfo)); - return Packet.Create(NetMsgId.player_data_succeed_ack, pcapPlayerInfo); + Log.Information("Sending player_new_notify packet = " + JsonSerializer.Serialize(playerInfoResponse)); + return Packet.Create(NetMsgId.player_data_succeed_ack, playerInfoResponse); } [ProtocolHandler(NetMsgId.player_ping_req)] diff --git a/Novaria.GameServer/Controllers/Api/ProtocolHandlers/RegionBossLevel.cs b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/RegionBossLevel.cs new file mode 100644 index 0000000..8c43c99 --- /dev/null +++ b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/RegionBossLevel.cs @@ -0,0 +1,22 @@ +using Novaria.Common.Core; +using Proto; +using Serilog; + +namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers +{ + public class RegionBossLevel : ProtocolHandlerBase + { + public RegionBossLevel(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory) + { + + } + + [ProtocolHandler(NetMsgId.region_boss_level_apply_req)] + public Packet RegionBossLevelApplyHandler(RegionBossLevelApplyReq req) + { + ChangeInfo regionBossChangeInfo = new ChangeInfo(); + + return Packet.Create(NetMsgId.region_boss_level_apply_succeed_ack, regionBossChangeInfo); + } + } +} diff --git a/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Star.cs b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Star.cs new file mode 100644 index 0000000..228df09 --- /dev/null +++ b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Star.cs @@ -0,0 +1,33 @@ +using Google.Protobuf; +using Novaria.Common.Core; +using Proto; +namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers +{ + public class Star : ProtocolHandlerBase + { + public Star(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory) + { + + } + + [ProtocolHandler(NetMsgId.star_tower_info_req)] // req id goes here + public Packet PlayerLoginHandler(Nil req) + { + StarTowerInfo towerResp = new(); + + return Packet.Create(NetMsgId.star_tower_info_succeed_ack, towerResp); + } + + [ProtocolHandler(NetMsgId.star_tower_build_brief_list_get_req)] + public Packet StarTowerBuildListGetHandler(Nil req) + { + return Packet.Create(NetMsgId.star_tower_build_brief_list_get_succeed_ack, PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.star_tower_build_brief_list_get_succeed_ack)); + } + + [ProtocolHandler(NetMsgId.star_tower_build_detail_get_req)] + public Packet StarTowerBuildDetailGetHandler(StarTowerBuildDetailGetReq req) + { + return Packet.Create(NetMsgId.star_tower_build_detail_get_succeed_ack, PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.star_tower_build_detail_get_succeed_ack)); + } + } +} diff --git a/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Tower.cs b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Tower.cs new file mode 100644 index 0000000..fac1347 --- /dev/null +++ b/Novaria.GameServer/Controllers/Api/ProtocolHandlers/Tower.cs @@ -0,0 +1,21 @@ +using Google.Protobuf; +using Novaria.Common.Core; +using Proto; +namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers +{ + public class Tower : ProtocolHandlerBase + { + public Tower(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory) + { + + } + + [ProtocolHandler(NetMsgId.tower_growth_detail_req)] + public Packet TowerGrowthDetailHandler(Nil req) + { + TowerGrowthDetailResp resp = new TowerGrowthDetailResp(); + + return Packet.Create(NetMsgId.tower_growth_detail_succeed_ack, resp); + } + } +} diff --git a/Novaria.GameServer/GameServer.cs b/Novaria.GameServer/GameServer.cs index ec18164..1ab3583 100644 --- a/Novaria.GameServer/GameServer.cs +++ b/Novaria.GameServer/GameServer.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Serilog; using Novaria.GameServer.Controllers.Api.ProtocolHandlers; +using Novaria.Common.Crypto; namespace Novaria.GameServer { @@ -11,6 +12,19 @@ namespace Novaria.GameServer public static void Main(string[] args) { PcapParser.PcapParser.Instance.LoadAllPackets(); // turn this off after real handlers are finished + + // IDK how to dump + /*Log.Warning("Dumping Data....."); + var tables = Assembly.GetExecutingAssembly() + .GetTypes() + .Where(t => t.Name.StartsWith("table_")); + + foreach (var file in Directory.GetFiles("../Novaria.Common/dataBin/")) + { + Log.Information(file); + var data = new GameDataExtraction().LoadCommonBinData(file); + Log.Information(data.ToString()); + }*/ Log.Information("Starting SDK Server..."); try diff --git a/Novaria.PcapParser/PcapParser.cs b/Novaria.PcapParser/PcapParser.cs index da8b92a..dafd46f 100644 --- a/Novaria.PcapParser/PcapParser.cs +++ b/Novaria.PcapParser/PcapParser.cs @@ -44,7 +44,7 @@ namespace Novaria.PcapParser public void Parse(string pcapFileName, bool auto_key = true) { - string pcapJsonFile = File.ReadAllText($"../../../../Novaria.PcapParser/{pcapFileName}"); // disgusting pathing, but "not hardcoded" now ig + string pcapJsonFile = File.ReadAllText($"../Novaria.PcapParser/{pcapFileName}"); // disgusting pathing, but "not hardcoded" now ig var data = System.Text.Json.JsonSerializer.Deserialize>(pcapJsonFile); foreach (PcapPacket packet in data) diff --git a/proxy.bat b/proxy.bat index 34c301d..e0f1e16 100644 --- a/proxy.bat +++ b/proxy.bat @@ -1 +1 @@ -mitmproxy -k -m wireguard --set stream_large_bodies=3m --set block_global=false --mode local -s .\emu.py \ No newline at end of file +mitmproxy -k -m wireguard --set stream_large_bodies=3m --set block_global=false --mode local:nova.exe -s .\proxy.py \ No newline at end of file diff --git a/proxy2.bat b/proxy2.bat new file mode 100644 index 0000000..9f6c397 --- /dev/null +++ b/proxy2.bat @@ -0,0 +1 @@ +mitmweb -k -m wireguard --set stream_large_bodies=3m --set block_global=false --mode local:nova.exe -s .\proxy2.py \ No newline at end of file diff --git a/proxy2.py b/proxy2.py new file mode 100644 index 0000000..77dc24c --- /dev/null +++ b/proxy2.py @@ -0,0 +1,39 @@ +from mitmproxy import ctx, http +from mitmproxy.proxy import layer + +def load(loader): + ctx.options.connection_strategy = "lazy" + ctx.options.upstream_cert = False + ctx.options.ssl_insecure = True + ctx.options.allow_hosts = ['nova-static.yostar.cn', 'nova.yostar.cn', 'sdk-api.yostar.cn', 'static-stellasora.yostar.net', "udata-api.open.yostar.net"] + +SERVER_HOST = "localhost" +SERVER_PORT = 5000 + +TARGET_HOSTS = [ + "nova-static.yostar.cn", + "nova.yostar.cn", + "sdk-api.yostar.cn", + "static-stellasora.yostar.net", + "udata-api.open.yostar.net" +] + +KILL_HOST_LIST = [ + 'log.aliyuncs.com', + 'er.ns.aliyuncs.com', + 'toy.log.nexon.io', + 'm-api.nexon.com' +] + +def request(flow: http.HTTPFlow) -> None: + if any(flow.request.pretty_host.endswith(host) for host in KILL_HOST_LIST): + flow.kill() + return + if flow.request.pretty_host in TARGET_HOSTS: + flow.request.scheme = 'http' + flow.request.host = SERVER_HOST + flow.request.port = SERVER_PORT + return + else: + flow.kill() + return