mirror of
https://github.com/raphaeIl/Novaria.git
synced 2025-12-12 14:34:38 +01:00
more handler, unfinished excel dump, added proxy alternative
This commit is contained in:
142
Novaria.Common/Crypto/GameDataExtraction.cs
Normal file
142
Novaria.Common/Crypto/GameDataExtraction.cs
Normal file
@@ -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<int, byte[]> PrimaryIntData { get; set; }
|
||||||
|
public Dictionary<long, byte[]> PrimaryLongData { get; set; }
|
||||||
|
public Dictionary<string, byte[]> PrimaryStringData { get; set; }
|
||||||
|
public List<byte[]> 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<int, byte[]> LoadPrimaryKeyIntTable(BinaryReader br, int length)
|
||||||
|
{
|
||||||
|
Dictionary<int, byte[]> table = new Dictionary<int, byte[]>();
|
||||||
|
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<long, byte[]> LoadPrimaryLongIntTable(BinaryReader br, int length)
|
||||||
|
{
|
||||||
|
Dictionary<long, byte[]> table = new Dictionary<long, byte[]>();
|
||||||
|
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<string, byte[]> LoadPrimaryKeyStringTable(BinaryReader br, int length)
|
||||||
|
{
|
||||||
|
Dictionary<string, byte[]> table = new Dictionary<string, byte[]>();
|
||||||
|
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<byte[]> LoadNoPrimaryKeyTable(BinaryReader br, int length)
|
||||||
|
{
|
||||||
|
List<byte[]> list = new List<byte[]>();
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
int dataLength = br.ReadInt16();
|
||||||
|
byte[] data = br.ReadBytes(dataLength);
|
||||||
|
list.Add(data);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,32 +35,585 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
|
|||||||
public Packet PlayerDataHandler(Nil req)
|
public Packet PlayerDataHandler(Nil req)
|
||||||
{
|
{
|
||||||
// example: different netmsgid returned, if new player player_new_notify, other wise player_data_ack
|
// 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()
|
AccInfo accountInfo = new AccInfo()
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
Hashtag = 4562,
|
Hashtag = 4562,
|
||||||
HeadIcon = 100101,
|
HeadIcon = 100101,
|
||||||
NickName = "seggs",
|
NickName = "ArkanDash",
|
||||||
Gender = false,
|
Gender = false,
|
||||||
Signature = "",
|
Signature = "",
|
||||||
TitlePrefix = 1,
|
TitlePrefix = 1,
|
||||||
TitleSuffix = 1,
|
TitleSuffix = 2,
|
||||||
SkinId = 10301,
|
SkinId = 10301,
|
||||||
CreateTime = DateTime.Now.Ticks,
|
CreateTime = pcapPlayerInfo.Acc.CreateTime,
|
||||||
};
|
};
|
||||||
|
|
||||||
accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 101, StepId = -1 });
|
accountInfo.Newbies.Add(pcapPlayerInfo.Acc.Newbies);
|
||||||
accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 102, StepId = -1 });
|
accountInfo.NextPackage = pcapPlayerInfo.Acc.NextPackage;
|
||||||
|
|
||||||
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()
|
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));
|
Log.Information("Sending player_new_notify packet = " + JsonSerializer.Serialize(playerInfoResponse));
|
||||||
return Packet.Create(NetMsgId.player_data_succeed_ack, pcapPlayerInfo);
|
return Packet.Create(NetMsgId.player_data_succeed_ack, playerInfoResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ProtocolHandler(NetMsgId.player_ping_req)]
|
[ProtocolHandler(NetMsgId.player_ping_req)]
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
Novaria.GameServer/Controllers/Api/ProtocolHandlers/Star.cs
Normal file
33
Novaria.GameServer/Controllers/Api/ProtocolHandlers/Star.cs
Normal file
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Novaria.GameServer/Controllers/Api/ProtocolHandlers/Tower.cs
Normal file
21
Novaria.GameServer/Controllers/Api/ProtocolHandlers/Tower.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
using Novaria.GameServer.Controllers.Api.ProtocolHandlers;
|
using Novaria.GameServer.Controllers.Api.ProtocolHandlers;
|
||||||
|
using Novaria.Common.Crypto;
|
||||||
|
|
||||||
namespace Novaria.GameServer
|
namespace Novaria.GameServer
|
||||||
{
|
{
|
||||||
@@ -12,6 +13,19 @@ namespace Novaria.GameServer
|
|||||||
{
|
{
|
||||||
PcapParser.PcapParser.Instance.LoadAllPackets(); // turn this off after real handlers are finished
|
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...");
|
Log.Information("Starting SDK Server...");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Novaria.PcapParser
|
|||||||
|
|
||||||
public void Parse(string pcapFileName, bool auto_key = true)
|
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<List<PcapPacket>>(pcapJsonFile);
|
var data = System.Text.Json.JsonSerializer.Deserialize<List<PcapPacket>>(pcapJsonFile);
|
||||||
|
|
||||||
foreach (PcapPacket packet in data)
|
foreach (PcapPacket packet in data)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
mitmproxy -k -m wireguard --set stream_large_bodies=3m --set block_global=false --mode local -s .\emu.py
|
mitmproxy -k -m wireguard --set stream_large_bodies=3m --set block_global=false --mode local:nova.exe -s .\proxy.py
|
||||||
1
proxy2.bat
Normal file
1
proxy2.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mitmweb -k -m wireguard --set stream_large_bodies=3m --set block_global=false --mode local:nova.exe -s .\proxy2.py
|
||||||
39
proxy2.py
Normal file
39
proxy2.py
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user