コード例 #1
0
ファイル: test_dnsrecon.py プロジェクト: hartl3y94/dnsrecon
 def test_in_cache(self):
     namelist_filename = 'namelist.tmp'
     namelist = ['localhost', 'test', 'www', 'mail']
     with open(namelist_filename, 'w') as fd:
         fd.writelines([f"{name}\n" for name in namelist])
     helper = DnsHelper('zonetransfer.me')
     ns = '81.4.108.41'
     result = in_cache(helper, namelist_filename, ns)
     os.remove(namelist_filename)
     assert len(result) == 1 and result[0]['type'] == 'A'
コード例 #2
0
 def test_zone_transfer(self):
     helper = DnsHelper('megacorpone.com')
     records = helper.zone_transfer()
     assert len(records) == 30
コード例 #3
0
 def test_get_ptr(self):
     helper = DnsHelper('megacorpone.com')
     records = helper.get_ptr('51.79.37.18')
     assert len(records) == 1 and match(r'^.+\.megacorpone\.com$',
                                        records[0][1])
コード例 #4
0
 def test_get_soa(self):
     helper = DnsHelper('megacorpone.com')
     records = helper.get_soa()
     for record in records:
         assert record[0] == 'SOA'
コード例 #5
0
 def test_get_srv(self):
     helper = DnsHelper('nsztm1.digi.ninja')
     records = helper.get_srv('_sip._tcp.zonetransfer.me')
     for record in records:
         assert record[0] == 'SRV'
コード例 #6
0
 def test_get_ip(self):
     helper = DnsHelper('google.com')
     records = helper.get_ip('google.com')
     for record in records:
         ip = IPAddress(record[2])
         assert ip.version in [4, 6]  # ~ redundant
コード例 #7
0
 def test_get_txt(self):
     helper = DnsHelper('gmail.com')
     records = helper.get_txt()
     for record in records:
         assert record[0] == 'TXT'
コード例 #8
0
 def test_get_mx(self):
     helper = DnsHelper('google.com')
     records = helper.get_mx()
     for record in records:
         assert record[0] == 'MX'
コード例 #9
0
 def test_get_aaaa(self):
     helper = DnsHelper('google.com')
     records = helper.get_aaaa('ipv6.google.com')
     for record in records:
         assert record[0] in ['AAAA', 'CNAME']
コード例 #10
0
 def test_get_ptr(self):
     helper = DnsHelper('megacorpone.com')
     records = helper.get_ptr('51.79.37.18')
     assert len(records) == 1 and 'megacorpone.com' in records[0][1]
コード例 #11
0
 def test_zone_transfer(self):
     helper = DnsHelper('zonetransfer.me')
     records = helper.zone_transfer()
     assert len(records) == 135
コード例 #12
0
 def test_se_result_process(self):
     helper = DnsHelper('zonetransfer.me')
     hosts = ['www.megacorpone.com', 'www.zonetransfer.me']
     result = cli.se_result_process(helper, hosts)
     assert len(result) >= 2