473,938 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print .pcap file content on cosole/file that should be similar as Wire shark

1 New Member
Hi
I need Code that Print .pcap file content on cosole/file that should be similar with as Wire shark works.

Thanks.
Apr 27 '10 #1
2 3594
Banfa
9,065 Recognized Expert Moderator Expert
If you can not find a utility to do this, Wireshark itself has a basic export to text file.

If that wont do then you can access the data through the winpcap library or the file format is available here for you to decode the file yourself directly.

A lot of the information displayed by Wireshare is not stored in the file. Rather Wireshark decodes the packet data itself using its own stored database of transport protocol knowledge to determine the data.
Apr 27 '10 #2
seladb
4 New Member
You didn't mention what programming language you're using. But if C++ fits you, you can use PcapPlusPlus - it has both pcap reading and packet printing (quite similar to Wireshark) features. See the following code example:
Expand|Select|Wrap|Line Numbers
  1. // open the pcap file
  2. PcapFileReaderDevice pcapReader("/your/pcap/file/path.pcap");
  3. pcapReader.open();
  4. RawPacket rawPacket;
  5.  
  6. // go over all packet in file
  7. while (pcapReader.getNextPacket(rawPacket))
  8. {
  9.     // parse the packet
  10.     Packet packet(&rawPacket);
  11.  
  12.     // print packet as string to stdout (you can print it to a file, stream, etc.)
  13.     std::cout << packet.printToString() << "\n\n";
  14. }
  15.  
  16. // close the pcap file
  17. pcapReader.close();
  18.  
Feb 19 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4384
by: Jared Frailey | last post by:
I'm new to CSS and I want to show URLs for links in parentheses when printing. Example: Given the html: <a href="http://www.google.com">Google</a> Print: Google (http://www.google.com) One way to do this is to do the following:
1
4490
by: Pierre Maricq | last post by:
Hi, I am using Win2000 and Access2000. I need to build build a macro or write a VBA in Access that would screen all files contained in a directory on my C drive (files are structrured DAT files ) and update an Access table with the following information: (1) Filename (variable lenght) (2) Modified File Date/Time
5
7789
by: Tony Gahlinger | last post by:
In reading up on raw socket programming under RedHat 9.2, I come across 'typedef struct pcap pcap_t' in pcap.h. Ok, so pcap_t is of type pcap, but I can't find any include file that tells me what pcap is itself. Ideas, anyone? --Tony
5
3175
by: z. f. | last post by:
hi, i have a vb.net web application and i make a request using internet explorer to an aspx page. the aspx page size if over 170KB, and the page in internet explorer looks truncated and in the view-source the text/html is truncated in the middle of a line. the last line looks like that: <td with and that's it. i checked the HTTP headers and saw that the aspx page have a Transfer-Encoding: chunked header, while asp page that have the...
1
8771
by: amc river | last post by:
Hi, Anyone know of if there is a java class that extract every field of a pcap format file? thanks
1
3406
by: sangith | last post by:
Hi, I tried the packet capture module program. I did a file transfer using ftp from this host to another server. But when I ran the program, it was just hanging off and it did not print the src ip, dst ip, src port, dst port. Should I run this program as a Daemon? If so, how do I do that? I would appreciate your response.
0
2868
by: Astan Chee | last post by:
Hi, Im using pyflag to parse .pcap files. Pyflag displays the data part of the .pcap file in binary and I was wondering what this means. How do I decode the 'data' part of the packet without using external libraries? What does these non-alpha numerical information mean? Is there a (python) dictionary/documentation somewhere that I can use to parse this data? Thanks again. Cheers Astan
0
1779
by: Michael Matthews | last post by:
Hello, I'm fairly new to Python, and have run into dead ends in trying to figure out what is going on. The basic thing I am trying to do is get pylibpcap working on a Python installation. More precisely, I want to get it working on an ActiveState Python installation. I have it working on cygwin (Windows XP). I was hoping to just be able to copy the pcap.py and _pcapmodule.dll file to a directory in the ActiveState install's sys.path...
1
2675
by: lancer6238 | last post by:
Hi all, I'm writing a program using libpcap, and I have multiple pcap files in a folder that I want to capture. I currently have handle = pcap_open_offline("/data/traffic/pcap1.pcap", errbuf"); which works fine since pcap_open_offline() takes in a filename. However, I want to process multiple pcap files from the directory /
0
1581
by: lancer6238 | last post by:
Hi all, I'm writing a program using libpcap, and I have multiple pcap files in a folder that I want to capture. I currently have handle = pcap_open_offline("/data/traffic/pcap1.pcap", errbuf"); which works fine since pcap_open_offline() takes in a filename. However, I want to process multiple pcap files from the directory /data/traffic/ at once. Is there a way to do that? Thank you.
0
10132
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9963
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11284
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6072
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.