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

Add mDNS daemon #4385

Merged
merged 1 commit into from
May 13, 2024
Merged

Add mDNS daemon #4385

merged 1 commit into from
May 13, 2024

Conversation

gpotter2
Copy link
Member

  • add new mdnsd (mDNS_am) command
  • add tests for mDNS_am
  • also add tests for LLMNR_am

Copy link

codecov bot commented May 12, 2024

Codecov Report

Attention: Patch coverage is 72.41379% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 82.20%. Comparing base (29b5413) to head (a6c3e58).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4385      +/-   ##
==========================================
+ Coverage   81.56%   82.20%   +0.63%     
==========================================
  Files         352      352              
  Lines       83601    83622      +21     
==========================================
+ Hits        68193    68743     +550     
+ Misses      15408    14879     -529     
Files Coverage Δ
scapy/layers/llmnr.py 97.87% <ø> (ø)
scapy/layers/dns.py 88.26% <72.41%> (-0.37%) ⬇️

... and 18 files with indirect coverage changes

@gpotter2 gpotter2 merged commit b44f9a2 into secdev:master May 13, 2024
23 checks passed
@gpotter2 gpotter2 deleted the mdnsd branch May 14, 2024 06:16

See :class:`~scapy.layers.dns.mDNS_am`::

>>> mdnsd(iface="eth0", joker="192.168.1.1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it doesn't work with avahi-resolve -n. When that command is run without -4 or -6 avahi sends A and AAAA queries and since only A can be answered no replies are sent by scapy. I "fixed" it with

diff --git a/scapy/layers/dns.py b/scapy/layers/dns.py
index c1977429..80902dcf 100644
--- a/scapy/layers/dns.py
+++ b/scapy/layers/dns.py
@@ -1649,8 +1649,6 @@ class DNS_am(AnsweringMachine):
                         continue  # next
                 except TimeoutError:
                     pass
-            # Error
-            break
         else:
             if not ans:
                 # No rq was actually answered, as none was valid. Discard.

but there should probably be a better way to fix that closer to the rq.qtype in [1, 28] clause. I'll try to come up with a better fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this.

I've played around with it quite a bit and there are numerous other inconsistencies compared to a normal server. The IP id is wrong, same for the ttl, etc. I'll PR some changes tonight.

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.

None yet

2 participants