Hello All, I am right now writing a pcap file to save all packets, as soon as I receive. Then I am opening that pcap into wireshark using Also when I provide the pcap file, and after running the command if I append packets in the file would wireshark analyse them also? Thank you very much. asked 24 Jul '13, 10:07 WiData |
2 Answers:
Well, you don't have to call dumpcap, as that's just the capturing process to generate a pcap data stream, that is piped to Wireshark. So, basically what you need to do in your program is similar to this.
tcpdump writes a data stream (pcap data structure) to STDOUT (-w -). That output is piped to STDIN of Wireshark (-i -). So, in your c++ program the part of tcpdump is obsolete, as you create the packets yourself. So here is the way to go. First option:
Second option:
Regards answered 25 Jul '13, 11:23 Kurt Knochner ♦ showing 5 of 7 show 2 more comments |
When running a live capture, Wireshark actually runs dumpcap to do the capturing which then pipes the packets into the Wireshark process, maybe you could use that technique. answered 24 Jul '13, 10:19 grahamb ♦ Grahamb: Quick follow up, I am creating pcap headers in a c++ files and in the same file I want to execute (24 Jul '13, 15:23) WiData 1 I'm afraid that's out of my knowledge zone. (25 Jul '13, 02:38) grahamb ♦ |
@kurt: thanks a lot for your feedback and it is very useful. I appreciate giving a detailed answer. I am just confused over one thing, I dont want to kill the wireshark process. As the packet are being created I just want them to pass to the wireshark application? I hope I am clear enough in asking this.
That was just in case you want to end the whole workflow within your c++ application (at the end). If you don't want to that, don't kill the process and let the user end Wireshark by closing the GUI window.
@kurt: thanks a lot for your help. I tried it and it seems it almost worked except the same error like the post in http://ask.wireshark.org/questions/14773/end-of-file-on-pipe-magic-during-open I am using this code http://pastie.org/8188169 Am I doing something wrong with the pipe? The d_msg is the pcap header which I want to pass to the wireshark.
And when I use this http://pastie.org/8188232 I get this error
The file "/tmp/wireshark_mine.pcap_20130730012654_ndbFzk" is a capture for a network type that Wireshark doesn't support
Not sure where I am going wrong.What is your OS?
Linux-Ubuntu 12.04
I also tried with the mkfifo() function. No Change with it. Its like I am almost there and then I can not resolve it. Should I be using netcat? I am not much familiar with it but I think it may be useful.