Skip to content

Conversation

@antoniovazquezblanco
Copy link
Contributor

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

@antoniovazquezblanco
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 :)

@codecov
Copy link

codecov bot commented Jan 3, 2026

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.

@gpotter2
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 !

@antoniovazquezblanco
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

@gpotter2
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

@antoniovazquezblanco
Copy link
Contributor Author

antoniovazquezblanco commented Jan 5, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants