Image

Imagealiversion2_0 wrote in Imagecpp

I need to insert bytes into specific parts of an ICMP packet, but I have no idea how. The program I am writing generates the packets, so I only need to figure out how to control the position of the data.
I should be able to control everything after the 4th byte (after the checksum). For example, with variables such as:

int location = 5;
int length = 4;
string payload = "192.168.72.33";

this should insert "192.168.72.33" in the 5th through 8th bytes. (This is a length of 4 bytes).

I was just wondering if anyone had any ideas how to start such a task.

xposted to advancedcpp, cpp, cprogramming, and computer science.