免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123
最近访问板块 发新帖
楼主: lsstarboy
打印 上一主题 下一主题

[FreeBSD] 奇怪的DNS请求包 [复制链接]

论坛徽章:
27
水瓶座
日期:2014-08-22 21:06:34程序设计版块每日发帖之星
日期:2015-11-25 06:20:0015-16赛季CBA联赛之新疆
日期:2015-12-19 19:05:48IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:3315-16赛季CBA联赛之上海
日期:2016-04-15 19:51:31程序设计版块每日发帖之星
日期:2016-04-17 06:23:29程序设计版块每日发帖之星
日期:2016-04-23 06:20:00程序设计版块每日发帖之星
日期:2016-05-26 06:20:00每日论坛发贴之星
日期:2016-05-26 06:20:0015-16赛季CBA联赛之辽宁
日期:2017-02-16 23:59:47
21 [报告]
发表于 2015-06-18 10:40 |只看该作者
要不你抓包1个月存到数据库,应该所有都全了

论坛徽章:
27
水瓶座
日期:2014-08-22 21:06:34程序设计版块每日发帖之星
日期:2015-11-25 06:20:0015-16赛季CBA联赛之新疆
日期:2015-12-19 19:05:48IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:31IT运维版块每日发帖之星
日期:2015-12-25 06:20:3315-16赛季CBA联赛之上海
日期:2016-04-15 19:51:31程序设计版块每日发帖之星
日期:2016-04-17 06:23:29程序设计版块每日发帖之星
日期:2016-04-23 06:20:00程序设计版块每日发帖之星
日期:2016-05-26 06:20:00每日论坛发贴之星
日期:2016-05-26 06:20:0015-16赛季CBA联赛之辽宁
日期:2017-02-16 23:59:47
22 [报告]
发表于 2015-06-18 10:52 |只看该作者
  1. %%
  2. %% %CopyrightBegin%
  3. %%
  4. %% Copyright Ericsson AB 1997-2009. All Rights Reserved.
  5. %%
  6. %% The contents of this file are subject to the Erlang Public License,
  7. %% Version 1.1, (the "License"); you may not use this file except in
  8. %% compliance with the License. You should have received a copy of the
  9. %% Erlang Public License along with this software. If not, it can be
  10. %% retrieved online at http://www.erlang.org/.
  11. %%
  12. %% Software distributed under the License is distributed on an "AS IS"
  13. %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  14. %% the License for the specific language governing rights and limitations
  15. %% under the License.
  16. %%
  17. %% %CopyrightEnd%
  18. %%
  19. %%
  20. %% Defintion for Domain Name System
  21. %%

  22. %%
  23. %% Currently defined opcodes
  24. %%
  25. -define(QUERY,    16#0).          %% standard query
  26. -define(IQUERY,   16#1).              %% inverse query
  27. -define(STATUS,   16#2).              %% nameserver status query
  28. %% -define(xxx,   16#3)  %% 16#3 reserved
  29. %%  non standard
  30. -define(UPDATEA,  16#9).               %% add resource record
  31. -define(UPDATED,  16#a).               %% delete a specific resource record
  32. -define(UPDATEDA, 16#b).               %% delete all nemed resource record
  33. -define(UPDATEM,  16#c).               %% modify a specific resource record
  34. -define(UPDATEMA, 16#d).               %% modify all named resource record

  35. -define(ZONEINIT, 16#e).               %% initial zone transfer
  36. -define(ZONEREF,  16#f).               %% incremental zone referesh


  37. %%
  38. %% Currently defined response codes
  39. %%
  40. -define(NOERROR,  0).                %% no error
  41. -define(FORMERR,  1).                %% format error
  42. -define(SERVFAIL, 2).                %% server failure
  43. -define(NXDOMAIN, 3).                %% non existent domain
  44. -define(NOTIMP,          4).                %% not implemented
  45. -define(REFUSED,  5).                %% query refused
  46. %%        non standard
  47. -define(NOCHANGE, 16#f).                %% update failed to change db
  48. -define(BADVERS,  16).

  49. %%
  50. %% Type values for resources and queries
  51. %%
  52. -define(T_A,                1).                %% host address
  53. -define(T_NS,                2).                %% authoritative server
  54. -define(T_MD,                3).                %% mail destination
  55. -define(T_MF,                4).                %% mail forwarder
  56. -define(T_CNAME,        5).                %% connonical name
  57. -define(T_SOA,                6).                %% start of authority zone
  58. -define(T_MB,                7).                %% mailbox domain name
  59. -define(T_MG,                8).                %% mail group member
  60. -define(T_MR,                9).                %% mail rename name
  61. -define(T_NULL,                10).                %% null resource record
  62. -define(T_WKS,                11).                %% well known service
  63. -define(T_PTR,                12).                %% domain name pointer
  64. -define(T_HINFO,        13).                %% host information
  65. -define(T_MINFO,        14).                %% mailbox information
  66. -define(T_MX,                15).                %% mail routing information
  67. -define(T_TXT,                16).                %% text strings
  68. -define(T_AAAA,         28).            %% ipv6 address
  69. %% SRV (RFC 2052)
  70. -define(T_SRV,          33).            %% services
  71. %% NAPTR (RFC 2915)
  72. -define(T_NAPTR,        35).            %% naming authority pointer
  73. -define(T_OPT,          41).            %% EDNS pseudo-rr RFC2671(7)
  74. %% SPF (RFC 4408)
  75. -define(T_SPF,          99).            %% server policy framework
  76. %%      non standard
  77. -define(T_UINFO,        100).                %% user (finger) information
  78. -define(T_UID,                101).                %% user ID
  79. -define(T_GID,                102).                %% group ID
  80. -define(T_UNSPEC,        103).                %% Unspecified format (binary data)
  81. %%        Query type values which do not appear in resource records
  82. -define(T_AXFR,                252).                %% transfer zone of authority
  83. -define(T_MAILB,        253).                %% transfer mailbox records
  84. -define(T_MAILA,        254).                %% transfer mail agent records
  85. -define(T_ANY,                255).                %% wildcard match

  86. %%
  87. %% Symbolic Type values for resources and queries
  88. %%
  89. -define(S_A,                a).                %% host address
  90. -define(S_NS,                ns).                %% authoritative server
  91. -define(S_MD,                md).                %% mail destination
  92. -define(S_MF,                mf).                %% mail forwarder
  93. -define(S_CNAME,        cname).                %% connonical name
  94. -define(S_SOA,                soa).                %% start of authority zone
  95. -define(S_MB,                mb).                %% mailbox domain name
  96. -define(S_MG,                mg).                %% mail group member
  97. -define(S_MR,                mr).                %% mail rename name
  98. -define(S_NULL,                null).                %% null resource record
  99. -define(S_WKS,                wks).                %% well known service
  100. -define(S_PTR,                ptr).                %% domain name pointer
  101. -define(S_HINFO,        hinfo).                %% host information
  102. -define(S_MINFO,        minfo).                %% mailbox information
  103. -define(S_MX,                mx).                %% mail routing information
  104. -define(S_TXT,                txt).                %% text strings
  105. -define(S_AAAA,         aaaa).          %% ipv6 address
  106. %% SRV (RFC 2052)
  107. -define(S_SRV,          srv).           %% services
  108. %% NAPTR (RFC 2915)
  109. -define(S_NAPTR,        naptr).         %% naming authority pointer
  110. -define(S_OPT,          opt).           %% EDNS pseudo-rr RFC2671(7)
  111. %% SPF (RFC 4408)
  112. -define(S_SPF,          spf).           %% server policy framework
  113. %%      non standard
  114. -define(S_UINFO,        uinfo).                %% user (finger) information
  115. -define(S_UID,                uid).                %% user ID
  116. -define(S_GID,                gid).                %% group ID
  117. -define(S_UNSPEC,        unspec).        %% Unspecified format (binary data)
  118. %%        Query type values which do not appear in resource records
  119. -define(S_AXFR,                axfr).                %% transfer zone of authority
  120. -define(S_MAILB,        mailb).                %% transfer mailbox records
  121. -define(S_MAILA,        maila).                %% transfer mail agent records
  122. -define(S_ANY,                any).                %% wildcard match

  123. %%
  124. %% Values for class field
  125. %%

  126. -define(C_IN,                1).              %% the arpa internet
  127. -define(C_CHAOS,        3).                %% for chaos net at MIT
  128. -define(C_HS,                4).                %% for Hesiod name server at MIT
  129. %%  Query class values which do not appear in resource records
  130. -define(C_ANY,                255).                %% wildcard match


  131. %% indirection mask for compressed domain names
  132. -define(INDIR_MASK, 16#c0).

  133. %%
  134. %% Structure for query header, the order of the fields is machine and
  135. %% compiler dependent, in our case, the bits within a byte are assignd
  136. %% least significant first, while the order of transmition is most
  137. %% significant first.  This requires a somewhat confusing rearrangement.
  138. %%
  139. -record(dns_header,
  140.         {
  141.          id = 0,       %% ushort query identification number
  142.          %% byte F0
  143.          qr = 0,       %% :1   response flag
  144.          opcode = 0,   %% :4   purpose of message
  145.          aa = 0,       %% :1   authoritive answer
  146.          tc = 0,       %% :1   truncated message
  147.          rd = 0,       %% :1   recursion desired
  148.          %% byte F1
  149.          ra = 0,       %% :1   recursion available
  150.          pr = 0,       %% :1   primary server required (non standard)
  151.                        %% :2   unused bits
  152.          rcode = 0     %% :4   response code
  153.         }).

  154. -record(dns_rec,
  155.         {
  156.          header,       %% dns_header record
  157.          qdlist = [],  %% list of question entries
  158.          anlist = [],  %% list of answer entries
  159.          nslist = [],  %% list of authority entries
  160.          arlist = []   %% list of resource entries
  161.         }).

  162. %% DNS resource record
  163. -record(dns_rr,
  164.         {
  165.          domain = "",   %% resource domain
  166.          type = any,    %% resource type
  167.          class = in,    %% reource class
  168.          cnt = 0,       %% access count
  169.          ttl = 0,       %% time to live
  170.          data = [],     %% raw data
  171.           %%
  172.          tm,            %% creation time
  173.          bm = [],       %% Bitmap storing domain character case information.
  174.          func = false   %% Optional function calculating the data field.
  175.         }).

  176. -define(DNS_UDP_PAYLOAD_SIZE, 1280).

  177. -record(dns_rr_opt,           %% EDNS RR OPT (RFC2671), dns_rr{type=opt}
  178.         {
  179.           domain = "",        %% should be the root domain
  180.           type = opt,
  181.           udp_payload_size = ?DNS_UDP_PAYLOAD_SIZE, %% RFC2671(4.5 CLASS)
  182.           ext_rcode = 0,      %% RFC2671(4.6 EXTENDED-RCODE)
  183.           version = 0,        %% RFC2671(4.6 VERSION)
  184.           z = 0,              %% RFC2671(4.6 Z)
  185.           data = []           %% RFC2671(4.4)
  186.          }).

  187. -record(dns_query,
  188.         {
  189.          domain,     %% query domain
  190.          type,        %% query type
  191.          class      %% query class
  192.          }).
复制代码
回复 19# lsstarboy


   

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
23 [报告]
发表于 2015-06-18 16:24 |只看该作者
回复 21# shijiang1130

不可能存留太长时间,我这儿一天光dns请求记录就接近2G。

抓了几分钟的包,仔细分析了一下,wireshark用的diply filter:udp && !(udp[10:2]== 01:00 || udp[10:2] == 81:80)

用的最多的就是:
请求包: 0x0100
响应包: 0x8180

还有几个:
请求失败:0x8182
未找到记录: 0x8183

还出现几个正常返回的记录:

0x8580   

再核实一下看看,如果仅有这几个的话,还是可以做个acl规则的。

论坛徽章:
0
24 [报告]
发表于 2015-07-31 19:53 |只看该作者
声明一下,我是外行。刚看到用53端口,突然想到了会不会是dnscrypt?

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
25 [报告]
发表于 2015-07-31 22:13 |只看该作者
回复 23# polter

看起来好像有可能,不知道它走的哪个协议,找个时间抓包对比一下看看。
   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP