Haven't done much with this one and the proxy it's self is not my code, I've just adapted it and added optional logging. It can be used as a base to modify or log packets in any game really.
The packets sent are ridiculous and there is very little information on how they work. Basically each packet has multiple sets of data inside to decrease the size of the packets sent.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.IO;
namespace proxy
{
class Program
{
public static IPEndPoint m_listenEp = null;
public static EndPoint m_connectedClientEp = null;
public static IPEndPoint m_sendEp = null;
public static Socket m_UdpListenSocket = null;
public static Socket m_UdpSendSocket = null;
static void Main(string[] args)
{
Listen("IP GOES HERE", 6667, true);
}
static void Listen(string IP, int Port, bool Log = false)
{
StreamWriter sw = null;
if (Log)
{
sw = new StreamWriter(@"C:\UT.txt");
sw.AutoFlush = true;
}
// Creates Listener UDP Server
m_listenEp = new IPEndPoint(IPAddress.Any, Port);
m_UdpListenSocket = new Socket(m_listenEp.Address.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
m_UdpListenSocket.Bind(m_listenEp);
//Connect to zone IP EndPoint
m_sendEp = new System.Net.IPEndPoint(IPAddress.Parse(IP), Port);
m_connectedClientEp = new System.Net.IPEndPoint(IPAddress.Any, Port);
byte[] data = new byte[1024];
while (true)
{
if (m_UdpListenSocket.Available > 0)
{
int size = m_UdpListenSocket.ReceiveFrom(data, ref m_connectedClientEp); //client to listener
if (m_UdpSendSocket == null)
{
// Connect to UDP Game Server.
m_UdpSendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
}
m_UdpSendSocket.SendTo(data, size, SocketFlags.None, m_sendEp); //listener to server.
if (Log)
{
sw.WriteLine("");
foreach (var b in data)
{
sw.Write(b + ",");
}
sw.WriteLine("");
}
}
if (m_UdpSendSocket != null && m_UdpSendSocket.Available > 0)
{
int size = m_UdpSendSocket.Receive(data); //server to client.
m_UdpListenSocket.SendTo(data, size, SocketFlags.None, m_connectedClientEp); //listner
if (Log)
{
sw.WriteLine("");
foreach (var b in data)
{
sw.Write(b+",");
}
sw.WriteLine("");
}
}
}
}
}
}