NASA-AMMOS / NASA-AMMOS/AIT-Core

pcap.py should support nanosecond-resolution pcap files

Open
#173 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
56
Forks
35
Avg merge
1d 20h
Merged PRs (30d)
3

Description

There is code in pcap.py to support the magic number of both microsecond-resolution and nonsecond-resolution pcap files (if values[0] == 0xA1B2C3D4 or values[0] == 0xA1B23C4D), but the code that resolves the timestamp in a packet header assumes microsecond resolution:

@property
def ts (self):
    """Packet timestamp as a float, a combination of ts_sec and ts_usec"""
    return float(self.ts_sec) + (float(self.ts_usec) / 1e6)

I think if a nanosecond-resolution global header is found (A1B23C4C or byte-reversed) then the timestamp should be ts_sec + ts_usec/1e9. (And perhaps ts_usec is misnamed. Perhaps ts_frac?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pcap.py by reading the global-header magic-number handling and the Packet.ts property. Verify how microsecond and nanosecond pcap resolutions are identified, then ensure timestamps use the corresponding precision; done when both resolutions produce correct timestamps and the existing pcap coverage includes each case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.