3

Libpcap helps to capture network packets and save them in '.pcap' files. I know how to do this but how to extract files from the payload? I want to analyze pcap file, extract files (maybe using 'magic numbers' ?), guess their extension and save these files so I can view them. If someone downloaded a PNG image I want to get image.png on my computer. I know I can use Wireshark or any other sniffer but my aim is to write my own one. The question is: how do I extract files from pcap capture file?

C code will be much appreciated.

Notice: WinPcap is OK, but it would be better if the code was multiplatform.

ForceBru
  • 43,482
  • 10
  • 63
  • 98

2 Answers2

2

Well you can use wireshark to view the packet. The link below shows you how to make your own packet sniffer in C

http://www.binarytides.com/packet-sniffer-code-c-linux/

Khan
  • 464
  • 3
  • 6
  • 18
  • I know perfectly well _how to capture packets_, but it would be once to have more info about payload processing. – ForceBru Dec 14 '14 at 10:40
1

Wireshark is able to do that.

See: http://www.behindthefirewalls.com/2014/01/extracting-files-from-network-traffic-pcap.html

Weston
  • 1,845
  • 13
  • 12