leonsmith / pydig

Python wrapper library for the 'dig' command line tool
GNU General Public License v3.0
36 stars 10 forks source link

what is problem ?? i dont understand #9

Closed Phoenix1112 closed 4 years ago

Phoenix1112 commented 4 years ago

hello. i am using pydig module. I am trying to use the pydig module on 2 different computers.

1 -) digitalocean ubuntu 19 VPS 2 -) my home computer

both computers have python3.7.5 installed. but I see interesting results. When I query A dns record with pydig, if the subdomain doesn't have the A record, the results show the cname dns record.(my home computer(kali linux))

The list appears to be empty when I use the pydig module on ubuntu server. that is, if there is no subdomain A record, but there is a cname record, pydig does not show the cname record.

example Kali linux:

a = pydig.query("trace-psdev.starbucks.com","A")

print(a)

output : ['s00174atww2twsps.trafficmanager.net.']

trace-psdev.starbucks.com not have A record. But pydig viewing cname record.

Now digitalocean ubuntu vps server:

a = pydig.query("trace-psdev.starbucks.com","A")

print(a)

output : [ ]

Why doesn't it show anything? what is the problem?

leonsmith commented 4 years ago

This is more than likely due to querying two different nameservers. Can you attempt it like this instead?

resolver = pydig.Resolver(
    nameservers=[
        '1.1.1.1',
        '1.0.0.1',
    ]
)
resolver.query('trace-psdev.starbucks.com', 'A')

That will cause each machine to use the same namesevers rathers than your default configured for each machine. (It's more than likely your ISP at home is doing weird things with the results so it's best to always specify another set you trust like cloudflares 1.1.1.1 or googles 8.8.8.8)

Phoenix1112 commented 4 years ago

@leonsmith thank you.. it is worked now.. i think this is ubuntu problem. When some nameserver settings are not made on ubuntu servers, this is reflected in the programs. I always hate the dns configuration of ubuntu servers. I am using pydig module without any problems with kali linux. If the target site does not have an A record, the pydig module shows the cname record. this is a good advantage for me. The method you showed above worked great in ubuntu. thanks

leonsmith commented 4 years ago

Glad it worked for you!