Markus LookUp

Thank you for using mlu. Please enjoy working with it!
Markus

Manual

Whether you enter a domain or an IP address you will get appropriate results.

A small and easy to use script to do all the domain and IP address querying you need on a daily base.

Domain query

If you are using mlu with a domain, it should look like this:


mlu charw.at
				

It will display something like this:


Displays MX-, NS-, WWW-records for domains or reverse queries for IP-addresses
Query using ns1.orange.at.

charw.at.		86400	IN	NS	ns2.campusspeicher.at.
charw.at.		86400	IN	NS	ns1.campusspeicher.at.

ns2.campusspeicher.at.	66855	IN	A	89.200.169.10
ns1.campusspeicher.at.	66855	IN	A	89.200.168.66

charw.at.		86400	IN	MX	10 mail.charw.at.
charw.at.		86400	IN	MX	190 mail2.charw.at.

charw.at.		86400	IN	NS	ns1.campusspeicher.at.
charw.at.		86400	IN	NS	ns2.campusspeicher.at.

mail2.charw.at.		86400	IN	A	88.80.209.59
mail.charw.at.		86400	IN	A	89.200.169.108
ns2.campusspeicher.at.	66855	IN	A	89.200.169.10
ns1.campusspeicher.at.	66855	IN	A	89.200.168.66

www.charw.at.		86400	IN	A	89.200.169.108

	serial = 1220283466
	refresh = 10800
				

Depending the name server used, the result may vary, but basicaly ist will simalar to the on shown above.

IP address query

If you are using mlu with an IP address, it could look like this:


mlu 89.200.169.108
				

The result may then look similar to the following


Displays MX-, NS-, WWW-records for domains or reverse queries for IP-addresses
Query using ns1.orange.at.

108.169.200.89.in-addr.arpa	name = server21.campusspeicher.de.

169.200.89.in-addr.arpa	nameserver = reverse2.antagus.de.
169.200.89.in-addr.arpa	nameserver = reverse.antagus.de.
				

Again, depending on the name server used, results may vary, but I guess, you get the point.

alternative name server

The script is currently using ns1.orange.at as default name server. If you want to use an alternate one, you might by entering your preferred server after the domain, simply separated by a space.


mlu charw.at res1.telekom.at
				

The result may then look similar to the following:


Displays MX-, NS-, WWW-records for domains or reverse queries for IP-addresses
Query using res1.telekom.at.

charw.at.		86400	IN	NS	ns2.campusspeicher.at.
charw.at.		86400	IN	NS	ns1.campusspeicher.at.

charw.at.		86400	IN	MX	190 mail2.charw.at.
charw.at.		86400	IN	MX	10 mail.charw.at.

mail2.charw.at.		86400	IN	A	88.80.209.59
mail.charw.at.		86400	IN	A	89.200.169.108

www.charw.at.		86400	IN	A	89.200.169.108

	serial = 1220283466
	refresh = 10800
				

You may have noticed that this result varies from the first one as ns1.orange.at displays the IP-addresses of the nameserver whereas res1.telekom.at does not show these.

Code

Further descriptions are marked as comments (#) directly in the script.


#!/bin/bash

# THE BEER-WARE LICENCE - charw.at/mlu

echo "Displays MX-, NS-, WWW-records for domains or reverse queries for IP-addresses."

mc5=0
mc6=0
mc6=$(echo `expr "$2" : '[a-zA-Z]'`)

if [ "$mc6" != "0" ]; then
	mc5=$2
else
	mc5=ns1.orange.at
fi
echo "Query using "$mc5"."

mc1=0
mc1=$(echo `expr "$1" : '.*[a-zA-Z]'`)

if [ "$mc1" = "0" ]; then
	nslookup $1 -recurse $mc5 | grep -v Server | grep -v Address | grep -v 'answer:' | grep -v Authoritative
else

	mc2=0
	mc2=$(dig +noquestion @$mc5 $1 mx | grep -v ';')
	mc3=0
	mc3=$(echo `expr "$mc2" : '.*SOA'`)
	dig +noquestion @$mc5 $1 ns | grep -v ';'

if [ "$mc3" != "0" ]; then
	dig +noquestion @$mc5 $1 ns | grep -v ';'
	echo "No MX record"
	echo
else
	dig +noquestion @$mc5 $1 mx | grep -v ';'
fi

	dig @$mc5 www.$1 | grep -v ';' |grep www

	dig @$mc5 $1 txt | grep "spf"

	echo
	nslookup -q=soa $1 $mc5 | grep serial
	nslookup -q=soa $1 $mc5 | grep refresh
	echo
fi
			

Licence

THE BEER-WARE LICENCE - <charw.at/mlu>
Copyright © Markus Charwat 2006-2012
As long as you retain this notice you can do whatever you want with mlu.
If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.