I've looked and can't see to find anything on this.
So I have a pc bridged though my main pc, how would I intercept and edit a packet (that i know is going to my other pc) from my main pc? I know how to intercept it, but i can't find anything on editing it.
My current code is:
static void Main()
{
// Retrieve all capture devices
var devices = CaptureDeviceList.New();
var device = devices.FirstOrDefault(dev => dev.Description.ToLowerInvariant().Contains("intel(r)"));
// check device isn't null
if (device == null)
throw new NullReferenceException();
while(true)
{
// open device
device.Open();
var capture = device.GetNextPacket();
if (capture == null || capture.Data == null)
continue;
var packet = PacketDotNet.Packet.ParsePacket(capture.LinkLayerType, capture.Data);
var asciiz = Encoding.ASCII.GetString(capture.Data);
if (asciiz.ToLowerInvariant().Contains("xeraxic"))
{
asciiz = asciiz.Replace("<view>1</view>",
"<view>2</view>");
packet.PayloadPacket.PayloadPacket.PayloadData = Encoding.ASCII.GetBytes(asciiz);
Console.WriteLine("Modified Packet, fingers crossed");
}
// close device
device.Close();
}
}