Skip to content

Commit

Permalink
Merge pull request #1 from themeldingwars/localhost
Browse files Browse the repository at this point in the history
Adjustments to facilitate localhost captures
  • Loading branch information
Xsear authored Feb 24, 2024
2 parents eea8073 + 5890489 commit 2717c7d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions FauCap/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ public List<GameSession> PcapFileToFaucap(string InFile)

void OnPacketArrival(object sender, CaptureEventArgs e)
{
if (e.Packet.LinkLayerType == PacketDotNet.LinkLayers.Ethernet)
if (e.Packet.LinkLayerType == PacketDotNet.LinkLayers.Ethernet || e.Packet.LinkLayerType == PacketDotNet.LinkLayers.Null)
{

var packet = PacketDotNet.Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);

var udpPacket = (PacketDotNet.UdpPacket)packet.Extract<PacketDotNet.UdpPacket>();
Expand All @@ -61,7 +62,6 @@ void OnPacketArrival(object sender, CaptureEventArgs e)
byte[] data = udpPacket.PayloadData;

DateTime time = e.Packet.Timeval.Date;

if (IsHandshakePacket(data))
{
switch (Handshake.ReadName(data))
Expand Down Expand Up @@ -127,7 +127,8 @@ void OnPacketArrival(object sender, CaptureEventArgs e)
}
else if (data != null && CurrentStatus == Status.Hugged && Sessions.Last().SocketID == MemoryMarshal.Read<uint>(data))
{
bool fromServer = ipPacket.DestinationAddress.Address == Sessions.Last().LocalIp.Address;

bool fromServer = udpPacket.SourcePort == Sessions.Last().GameServerPort;
Sessions.Last().Datagrams.Add(new Datagram(Idx++, time, fromServer, data));
}

Expand Down
4 changes: 2 additions & 2 deletions FauCap/FauCap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
<Product>FauCap</Product>
<Version>1.12.0.0</Version>
<AssemblyVersion>1.13.0.0</AssemblyVersion>
<AssemblyVersion>1.14.0.0</AssemblyVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>1.13.0.0</PackageVersion>
<PackageVersion>1.14.0.0</PackageVersion>
</PropertyGroup>


Expand Down
2 changes: 1 addition & 1 deletion FauCap/PacketUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static ushort ReadSequenceStart(Span<byte> data)
}
public static ushort ReadGameServerPort(Span<byte> data)
{
return MemoryMarshal.Read<ushort>(data.Slice(10, 2));
return ReadUInt16BigEndian(data.Slice(10, 2));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions FauCapParser/FauCapParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>TheMeldingWars</Company>
<AssemblyVersion>1.13.0.0</AssemblyVersion>
<AssemblyVersion>1.14.0.0</AssemblyVersion>
<Version>1.12.0.0</Version>
<PackageVersion>1.13.0.0</PackageVersion>
<PackageVersion>1.14.0.0</PackageVersion>
</PropertyGroup>

</Project>

0 comments on commit 2717c7d

Please sign in to comment.