Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8481773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:39:04+00:00 2026-06-10T19:39:04+00:00

I have tcpdump like this sudo tcpdmp tcp -n -i eth0 -w test.dmp I

  • 0

I have tcpdump like this

sudo tcpdmp tcp -n -i eth0 -w test.dmp

I want to calculate the number of tcp bytes going through eth0. I capture all the package using tcpdump as above. Is the file size equal the number of bytes or tcpdump add additional information into the dump file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:39:06+00:00Added an answer on June 10, 2026 at 7:39 pm

    Yes, tcpdump adds additional information to the file.

    It (currently) writes only in pcap format, which means there’s a 24-byte header at the beginning of the file, giving information such as the link-layer header type for packets in the file, so the first thing you’d need to do would be to subtract 24 from the size of the file.

    In addition, each packet has a 16-byte header giving an arrival time stamp for the packet, the length of the packet, and the number of bytes of packet data that was captured. This means that you would need to subtract 16*{number of packets} from the length – but the only way to get the number of packets is to read the file, so you can’t get the number of bytes just by looking at the file size!

    Note also that some versions of tcpdump did not default to a “snapshot length” of 0, so the number of bytes of packet data that is captured may be less than the number of packet bytes on the network.

    Therefore, what you should do is write a program (use libpcap, as it already knows pcap format and you don’t have to write your own code to understand it) that reads all the packets and adds up the “length of the packet” field (it’s the len field in the struct pcap_pkthdr structure; do not use caplen, as that’s the number of bytes of packet data that was captured) values for all the packets.

    You say eth0, so the link-layer header type is probably Ethernet, and there is, for example, no radio meta-data, as might be the case if you were capturing in monitor mode on a Wi-Fi adapter. In the cases where there’s extra meta-data in the link-layer header, you’d need to subtract that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tcpdump traces from which I want to recover reassemble HTTP requests and
#I used to have this, but I don't want to write to the disk
I have some large pcap (packet capture) files collected with tcpdump. I would like
I am running tcpdump in a subprocess like this: pcap_process = subprocess.Popen(['tcpdump', '-s 0',
I'm making a program to calculate latency from a tcpdump/pcap file and I want
I'm trying to capture packets from two devices on my network. I have tcpdump
I have been trying to filter tcpdump output based on packets lengths. But I
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.