iT邦幫忙

2022 iThome 鐵人賽

DAY 18
0
Security

不想上班系列系列 第 18

[Day 18] 收集DNS(use dnspython)

  • 分享至 

  • xImage
  •  

Sample code

  • Get SOA record

    import dns.resolver
    
    SOA_records = dns.resolver.resolve('zonetransfer.me', 'SOA')
    for SOA in SOA_records:
        print("[*] Found SOA record: {}".format(SOA))
    
  • Get A record

    import dns.resolver
    
    A_records = dns.resolver.resolve('zonetransfer.me', 'A')
    for A in A_records:
      print("[*] Found A record: {}".format(A))
    
  • Get NS record

    import dns.resolver
    
    NS_records = dns.resolver.resolve('zonetransfer.me', 'NS')
    for NS in NS_records:
        print("[*] Found NS record: {}".format(NS))
    
  • AXFR

    • use NS record IP found host
     import dns.resolver
     import dns.zone
    
     NS_records = dns.resolver.resolve('zonetransfer.me', 'NS')
     for NS in NS_records:
         print("[*] NS: {}".format(NS))
    
         ns_ip = dns.resolver.resolve(NS.target, 'A')
         for ip in ns_ip:
             print("[*] IP for {} is {}".format(server, ip))
             zone = dns.zone.from_xfr(dns.query.xfr(ip, 'zonetransfer.me'))
             for host in zone:
                 print("[*] Found Host: {}.zonetransfer.me".format(host))
    
  • 參考資料


上一篇
[Day 17] 收集DNS-dig(Kali 工具)
下一篇
[Day 19] 收集DNS-域名枚舉常用工具
系列文
不想上班系列30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言