Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 7554] New: Add ability to add/remove packet comments using

Date: Wed, 1 Aug 2012 07:54:51 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7554

           Summary: Add ability to add/remove packet comments using
                    editcap
           Product: Wireshark
           Version: SVN
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Low
         Component: Extras
        AssignedTo: bugzilla-admin@xxxxxxxxxxxxx
        ReportedBy: niels@xxxxxxxxxx


Build Information:
wireshark 1.9.0 (SVN Rev 44155 from /trunk)

Copyright 1998-2012 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GTK+ 2.24.10, with Cairo 1.10.2, with Pango 1.30.0, with
GLib 2.32.3, with libpcap, with libz 1.2.3.4, without POSIX capabilities,
without libnl, with SMI 0.4.8, with c-ares 1.7.5, with Lua 5.2, without Python,
with GnuTLS 2.12.14, with Gcrypt 1.5.0, with MIT Kerberos, with GeoIP, with
PortAudio <= V18, with AirPcap.

Running on Linux 3.2.0-27-generic, with locale en_US.UTF-8, with libpcap
version
1.1.1, with libz 1.2.3.4, GnuTLS 2.12.14, Gcrypt 1.5.0, without AirPcap.

Built using gcc 4.6.3.
--
Capture file formats such as pcapng allow annotating a capture file with
comments.  The ability to modify the comments of a capture file from the
command-line is a useful feature.  This patch adds a new editcap switch '-k'
which allows modifying the packet comments of a capture file.  Below is the
usage() information for the new switch:

 modify the packet comment of a given packet. Use format
 "<packet#>:<cmt>" to add comment "<cmt>" to packet
 number "<packet#>" and format "<packet#>:" to remove any comment
 from packet number "<packet#>". If <comment_format> is in the
 form "@FILE", read comment formats, one per line, from FILE. This
 option may be specified multiple times. NOTE: Not all output file
 types support packet comments.

For example, if input capture 'in.cap' contains 10 packets and one wishes to
add the comment "This is a comment" to packet 3, one would run:

 editcap -F pcagng -k "3:This is a comment" in.cap out.cap 1-10

Or to remove any comment from packet 3:

 editcap -F pcagng -k "3:" in.cap out.cap 1-10

If one wishes to add a large number of comments to a capture file, one might
tell editcap to read comments from file 'cmts' using the @FILE format:

 editcap -F pcapng -k @cmts in.cap out.cap 1-10

where the file 'cmts' could look something like:

------------------------------------Cut
here------------------------------------
3:This is a comment
2:This is also a comment
5:
7:One more comment
------------------------------------Cut
here------------------------------------

Feedback on the patch would be great, below is a list of things I'd like to
hear back about:

o The output file has to support packet comments for this to be useful.  Should
an error/warning be printed if the select output file type doesn't support
packet comments?

o Currently, the patch limits the maximum number of comments to 512, following
the limit on packet range specifiers in editcap.  

o When reading comment formats from a file, a buffer of 1024 characters is
allocated, limiting the longest comment string.  

o Comment formats read from a file are delimited by newlines, meaning each
comment must be on a single line.

o There may be other formats that would work better than the "<packet#>:<cmt>"
comment format used in my patch.

Again, comments or suggestions would be welcome!

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.