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 domain.com 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

Answers


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 = 'hotmail.com'
>>> for x in dns.resolver.query(domain, 'MX'):
...     print x.to_text()
...
5 mx3.hotmail.com.
5 mx4.hotmail.com.
5 mx1.hotmail.com.
5 mx2.hotmail.com.

Need Your Help

Unable to pass model into partial view inside layout pages

asp.net-mvc-3 partial-views

I have a layout page within that layout I have used a partial view, the partial view contains a menu feature that I have built, I split the menu into a partial view to ensure it is easy to maintain...

Use dependant subscriptions in Iron-router WaitOn and use them in helper functions

mongodb meteor iron-router

When doing the following implementation , i get problems because it's look like the data is not available in client side:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.