Wireshark-dev: Re: [Wireshark-dev] Adding "copy packet data" functionality to the packet list a
Douglas Pratley wrote:
Hiya
There are a few items in the Wishlist about being able to copy packet
data to the clipboard that I'm thinking of having a go at (partially)
implementing.
Good!
I'm not going to look at actually being able to edit the packet list,
just being able to get data out of Wireshark.
Edit the packet list would be a huge effort in itself, believe me :-)
I don't want to change the existing "Copy" in the details pane, so I'd
be looking at adding a new menu item (a submenu):
Copy Packet Data > As Text
As Hex
As Base64 (maybe)
As Binary (if possible)
As it would not be the standard "Copy" item, I don't think it should
be added to the "Edit" menu.
The current also isn't the "standard copy item".
I don't know what the "Copy Packet Data > As Text" would actually do?
Having two Copy menu items in the details context menu might be too
much, however, "remixing" the copy menu items will be easy once the
functionality is settled, so the menu structure shouldn't be a problem.
The most interesting question is: which copy functionality makes sense
in which context menu.
Judging from comments in the Wishlist, it may not be possible to do a
raw binary copy.
I've tried to implement the binary copy some time ago - it wasn't
working on Win32 (might work on Unix systems - I don't know). As we've
change the GTK/GLib version in the meantime it might also work now on
Win32. We probably can simply disable the menu items for platforms that
don't support it.
When I remember correct, in principle in GTK/GLib it should be possible
to put multiple formats into the clipboard (with different MIME types),
but the Win32 implementation of GTK/GLib only implemented the text format.
I think that the menu item should copy the data _only_ for the
selected part of the frame - effectively the bytes _highlighted_ in
the bytes pane (otherwise it risks being a duplication of
functionality in the bytes pane).
The current byte pane functionality is a bit odd, as a right click on
the selected bytes selects a smaller subset. We might better move this
functionality completely to the details menu - but I'm not sure on this.
Similarly in the packet list pane:
Copy Summary Data > As Text
As CSV
This would copy the column data as chosen in the preferences. I can't
see that there is any meaning to copying the packet summary "as
binary" (or some text encoding of the binary).
But it might be a real value to copy the whole packet in this menu.
Something like:
Copy ->
Summary as Text
Summary as CSV
Packet Bytes as Hex
Packet Bytes as Binary (when possible)
There's also a suggestion that it might be nice to be able to select
multiple lines in the packet list and packet details panes. If this
were possible, then it might make sense to add the "Copy Packet Data"
menu to the packet list (as well as extending the standard "Copy" in
the details pane to copy the displayed text). However, I'm not
confident that I've understood the existing Select / Browse
functionality - turning on "Browse" seems to lead to wierd behaviour
in Windows / GTK2, and the code looks as if it inverts the Select /
Browse setting. If anyone could let me know what this _should_ do I'd
be grateful; also for any hints from anyone who has tried some of this
before...
The current select / browse functionality IS odd in my eyes too (at
least on Win32). However, selecting multiple packets would be really
nice, but that would require some deep internal changes of the packet
list code and a lot of other parts of WS. So this is really not the
topic for a start to "fix" all this...
Cheers
Doug
Regards, ULFL