Using DNS in python to query type MX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Benny the Guard
    New Member
    • Jun 2007
    • 92

    Using DNS in python to query type MX

    Anyone know if python has a module to issue a query similar to:

    dig <domain> MX

    To discover server names? Rather not use 3rd party modules since this needs to run on a bunch of machines, thus one more dependency is difficult to accomodate. Thanks!
  • jlm699
    Contributor
    • Jul 2007
    • 314

    #2
    You mean just execute a linux command line command? Or are you asking if Python has a built-in module that would give you the same functionality cross-platform??

    For the former:
    [code=python]
    import os
    os.system( 'dig <domain> MX' )
    ## OR alternately
    os.popen( 'dig <domain> MX' )
    [/code]

    for the latter, I'm not so sure that Python has that functionality inherently. This would more than likely have to come from an external module.

    Comment

    Working...