[Winpcap-users] Re : printing pkt_data

Gianluca Varenni gianluca.varenni at cacetech.com
Mon May 29 15:13:00 GMT 2006


  ----- Original Message ----- 
  From: joe kibz 
  To: winpcap-users at winpcap.org 
  Sent: Monday, May 29, 2006 12:54 AM
  Subject: [Winpcap-users] Re : printing pkt_data


  Problem:

  I am having problems printing out pkt_data . I wanna print it first in binary then actual text line by line just like in ethereal .

  Does anybody know how pkt_data captured can be printed out like that ?

Uhm, what do you mean by "line-by-line"? Which panel of ethereal are you referring to (middle panel or botton panel)?

Printing in hex is quite simple (loop through packet data, and print with "printf("%2.2x ", pkt_data[i])"). If you want to print the ascii content, you can use the same loop and use something like

if (isalnum(pkt_data[i])
    printf("%c", pkt_data[i]);
else
    printf(".");

If you want a more "formatted" output, the you will probably need to decode the packet protocols (like ethereal does).

Have a nice day
GV


  joe 


------------------------------------------------------------------------------
  Do you Yahoo!?
  Get on board. You're invited to try the new Yahoo! Mail Beta.


------------------------------------------------------------------------------


  _______________________________________________
  Winpcap-users mailing list
  Winpcap-users at winpcap.org
  https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060529/791fc995/attachment.htm


More information about the Winpcap-users mailing list