MX Record lookup and check

后端 未结 2 561
情歌与酒
情歌与酒 2021-02-04 05:38

I need to create a tool that will check a domains live mx records against what should be expected (we have had issues with some of our staff fiddling with them and causing all i

2条回答
  •  礼貌的吻别
    2021-02-04 06:18

    With [dnspython][1] module (not built-in, you must pip install it):

    >>> import dns.resolver
    >>> domain = 'hotmail.com'
    >>> for x in dns.resolver.resolve(domain, 'MX'):
    ...     print(x.to_text())
    ...
    5 mx3.hotmail.com.
    5 mx4.hotmail.com.
    5 mx1.hotmail.com.
    5 mx2.hotmail.com.
    

提交回复
热议问题