Thanks, Guy pal! I use strstr to search for a specific string in a HTTP header (Content-Length, for example) and I have changed it successfully. (I use printf to print the payload.)
I do the task in my callback function. But, how to send the package? IMHO, will the package be sent twice? (first, origin message; second, modified message) So how to send the message after being modified? Can you give me a simple example? Best regards, George Ma ----- Original Message ----- From: Guy Harris To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [tcpdump-workers] What to change the content of a package. Sent: Thu May 16 15:55:03 CST 2002 > On Thu, May 16, 2002 at 11:42:36AM +0800, [EMAIL PROTECTED] wrote: > > I want to use libpcap to change the content of a package. > > (the content of a HTML page of a TCP package) The framework > > of the program I am using is taken from sniffer.c supplied > > at http://www.tcpdump.org/sniffer.c. > > > > My trouble is the function > > > > void got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char >*packet) > > > > takes the package as a const variable, so I can not change the content > > of a const variable. > > > > Do you have some ideas about how to change the content of a package in > > my case? (I simply want to change a string in HTML page.) > > Make a copy of the packet, and change the copy instead. - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe