Hi, I would like to export [protocol,source port ,destination port] from pcap file as csv file. Would it be possible to get results like [tcp,5423,22] [udp,9334,161]. I need something like if protocol column is tcp,print tcp.srcport in source port column and tcp.dstport in destination port column and same for udp as well. I do not want create seperate columns for tcp ports and udp ports. Can I do it with tshark -R?? asked 24 Jan '17, 10:25 subinjp |
One Answer:
You ought to be able to mostly achieve this with
The "Protocol" column will indicate the most upper-layer protocol present in the packet though and not specifically "tcp" or "udp", and if you want the fields comma-separated and surrounded by those You can probably get a bit closer if you first add all the columns you want within Wireshark first+, and then run
Again, the protocol name printed will be the most upper-layer protocol present in the packet. If you don't care about "udp" and "tcp" vs. their IP protocol numbers "17" and "6" respectively, then you could substitute " +Wireshark column preferences are added via answered 24 Jan '17, 13:01 cmaynard ♦♦ |
@cmaynard Thank you very much for the answer.. The problem is packet capture is happening in a remote server. I have access to server only through command line(using ssh). So I am not able to add columns in to wireshark using gui. I am using only tshark to access the pcap file.
Can I change the format of columns or add columns using tshark itself?? or Is there any way to add columns in to wireshark without using gui.?
You can change the columns using
tshark
alone using the-o "gui.column.format:...
method described above.You could also directly edit the Wireshark "preferences" file found in the Wireshark personal configuration folder. Search for "gui.column.format" in the file and then add/modify columns as desired. Take heed when editing though, and I would suggest making a copy of the file first in case you make a mistake or to be able to restore the original preferences file later. Better would be to create a separate profile and edit the profile's preference file instead, thus leaving the original one alone. You can specify the profile to use with
tshark
's-C <profile>
option.Thank you..:):)