Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overall Offset of Packet within File #327

Open
lovejotd opened this issue Sep 24, 2021 · 3 comments
Open

Overall Offset of Packet within File #327

lovejotd opened this issue Sep 24, 2021 · 3 comments

Comments

@lovejotd
Copy link

Is there anyway when I processing files, to know the offset of the current packet within the larger pcap file? I am having a hard time figuring/finding it out, and it could be helpful for me. Thanks!

@kayoub5
Copy link
Collaborator

kayoub5 commented Sep 24, 2021

What's the os?
In Linux you could get the file object and use ftell on it

@lovejotd
Copy link
Author

Ideally this would need to work in either windows or Linux. Do you have an example of what you mean? Or link to an example?

@kayoub5
Copy link
Collaborator

kayoub5 commented Sep 24, 2021

Use FILE *pcap_file(pcap_t *) to get file pointer, then long int ftell ( FILE * stream ); to get file position.
You will need to write your own interop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants