|
-
January 4th, 2008, 05:12 PM
#1
winpcap search pkt_data for string
I'm trying to use winpcap to search incoming packets for a fixed ascii string, the print that packet to the console. ie, If the string was "hello" any packet containing a website etc. that has the word "hello" on it, is printed.
pkt_data is an array of u_char and I was thinking I could write a for loop:
for (i=0; header->len; i++)
{
idbuff=pkt_data[i] + pkt_data[i+1] + pkt_data[i+2] + pkt_data[i+3]+ pkt_data[i+4];
if (strcmp(idbuff, "hello")==0)
...
but I know that the values stored in pkt_data aren't ascii characters. To be honest I have almost no clue what I'm doing, and Im certain there's a million things wrong with my code snippet. Can anyone help me, or point me in the right direction? Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|