MX Record lookup and check

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 incoming mail to redirected into the void)

Now I won't lie, I'm not a competent programmer in the slightest! I'm about 40 pages into "dive into python" and can read and understand the most basic code. But I'm willing to learn rather than just being given an answer.

So would anyone be able to suggest which language I should be using?

I was thinking of using python and starting with something along the lines of using 0s.system() to do a (dig +nocmd mx +noall +answer) to pull up the records, I then get a bit confused about how to compare this to a existing set of records.

Sorry if that all sounds like nonsense!

Thanks Chris


Take a look at dnspython, a module that should do the lookups for you just fine without needing to resort to system calls.

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

>>> import dns.resolver
>>> domain = ''
>>> for x in dns.resolver.query(domain, 'MX'):
...     print x.to_text()

Need Your Help

How to wait for a JFrame to close before continuing?

java swing user-interface jdialog cardlayout

My program consists of 3 main 'sections'. Main function, Login form and App form. The main function should do something like: Open Login form, wait for it to close, then open App form. I can't get ...

Add character in the middle of a string

string cakephp split character add

I have a list of six digit codes (some are 7). What I need is to put a space after the fourth character of each code, to make it more readable in my views. It would be like: