Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SocketLogger: A class to log all socket traffic. #4893

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

Open
antoniovazquezblanco wants to merge 1 commit into secdev:master
base: master
Choose a base branch
Loading
from antoniovazquezblanco:log

Conversation

@antoniovazquezblanco
Copy link
Contributor

@antoniovazquezblanco antoniovazquezblanco commented Jan 3, 2026

Checklist:

  • If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
  • I squashed commits belonging together
  • I added unit tests or explained why they are not relevant
  • I executed the regression tests (using tox)
  • If the PR is still not finished, please create a Draft Pull Request

I've created a dummy package that I've been using to log all socket traffic to a pcap file. Sometimes this was useful for debugging my own scripts.

@polybassa noticed this package and commented if I could create a PR to upstream that utility: antoniovazquezblanco/scapy-socketlogger#3

Copy link
Contributor Author

BTW, please let me know if you have any suggestion. I was never that happy with the naming I chose nor the way I've implemented this. If you have any better ideas they will be appreciated :)

Copy link

codecov bot commented Jan 3, 2026
edited
Loading

Codecov Report

❌ Patch coverage is 0% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.81%. Comparing base (40fc5ec) to head (49be0c1).

Files with missing lines Patch % Lines
scapy/socket_logger.py 0.00% 27 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## master #4893 +/- ##
==========================================
- Coverage 80.85% 80.81% -0.04% 
==========================================
 Files 369 370 +1 
 Lines 90961 90988 +27 
==========================================
- Hits 73542 73536 -6 
- Misses 17419 17452 +33 
Files with missing lines Coverage Δ
scapy/socket_logger.py 0.00% <0.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

gpotter2 commented Jan 4, 2026

Hi ! Thanks for the PR.

A few notes:

  • if this were to be merged, it should be added to supersocket.py and inherit a super socket. Most likely you could inherit a SimpleSocket
  • I would use a code pattern that uses super instead of storing the initial method, if possible.

I'm not sure if this isn't too specific to end up in Scapy. But those are breaking in any case ^^

Thanks & happy new year !

Copy link
Contributor Author

Hi @gpotter2!

Thanks for your comments. Just for clarification, you mean that I should implement the functionality in the base socket and allow to specify a pcapwriter on it's creation?

Otherwise, if I go the inheritance route, this cannot be enabled/disabled and it would not work for the sockets that do not inherit from SimpleSocket. Or am I missing something?

Happy new year! :D

Copy link
Member

gpotter2 commented Jan 5, 2026

If I recall properly, SimpleSocket already acts as a wrapper of any existing socket. So it would make sense to inherit it

Copy link
Contributor Author

antoniovazquezblanco commented Jan 5, 2026
edited
Loading

imagen

Not everything seems to inherit from simple socket...

I can implement this as part of SuperSocket wich seems to be the root node...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /