Skip to content

Commit

Permalink
fix other type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierskip committed Nov 23, 2024
1 parent 3f6761f commit 521aab0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/dns_observe/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import datetime
import argparse

__version__ = "0.6.1"
__version__ = "0.6.2"

# DNS query type
class QueryType:
Expand Down Expand Up @@ -80,7 +80,7 @@ def query(self, qname, qtype=QueryType.A):
if len(dns_record.answers) == 0:
code = dns_record.flags & 0b1111
reply = DNS_RCODE.get(code, 'Unassigned')
print(f"Time: {now}, Reply code: {reply}({code})")
print(f"Time: {now}, Reply code: {reply}({code}), Answer RRS: 0")
if len(dns_record.answers) == 1:
single = True
if len(dns_record.answers) > 1:
Expand Down Expand Up @@ -141,11 +141,13 @@ def _parse_name(self, response: bytes, offset: int) -> tuple[str, int]:
p, _set = self._parse_name(response, _offset) # 递归调用
parts.extend(p) # list extend
offset += 2
nlen = 0
nlen = 0 # break
else:
parts.append(response[offset+1:offset+nlen+1]) # list append
offset += nlen + 1
nlen = response[offset]
if nlen == 0: # offset + 1 before break
offset += 1

return parts, offset

Expand Down
9 changes: 4 additions & 5 deletions tests/domain_list.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
google.com
google.com.hk
google.cn
googlevideo.com
googleapis.com
google-analytics.com
googletagmanager.com
googleusercontent.com
ggpht.com
gstatic.com
googleapis.com
facebook.com
fbcdn.net
twitter.com
Expand All @@ -20,9 +23,5 @@ github.com
github.io
disqus.com
imgur.com
google.com
googlevideo.com
google-analytics.com
googletagmanager.com
reddit.com
redd.it

0 comments on commit 521aab0

Please sign in to comment.