Domain Lookup on Android

—

in —
Estimated Reading Time: 2 minutes

DNS and WHOIS on Android

Occasionally you need to look up information about a domain. My favourite tool to do this is whois via the command line. Usually I have a PC nearby to run that but every now and then, all I have is my Android phone. Building a domain lookup app for Android addresses that problem while providing a familiar interface without extra hassle.

One scan, several sources

The interface uses a terminal-inspired layout headed “DOMAIN INTEL.” Enter a domain, tap SCAN, and the app fills panels for IP addresses, A records, MX records, TXT records, reverse DNS, and WHOIS. A keyboard search action starts the same workflow.

Those panels draw on three different network mechanisms. Java’s InetAddress API handles address resolution and reverse lookups through the device’s resolver. MX and TXT queries go to Google’s DNS-over-HTTPS endpoint. WHOIS uses a direct TCP connection to a registration server.

Preparing the domain

Before starting network work, the app trims the input, removes a URL scheme and a leading lowercase www., and strips a path and port. It then converts internationalized names to ASCII and lowercases the result.

For example, https://www.example.com/path becomes example.com. This makes pasted addresses more convenient, although the routine is not a complete URL parser or domain validator. A plain domain remains the most predictable input.

Following a WHOIS referral

WHOIS begins with a server selected from the domain suffix. The implementation includes mappings for suffixes such as .com, .net, .org, and .ca, with whois.iana.org as the fallback.

The app sends the domain over TCP port 43 and reads the text response. If a line begins with Whois Server: or refer:, it can follow that referral to a different server. It follows one referral and displays the resulting response as selectable text.

A Quick Utility

Domain Lookup provides a compact place to inspect several aspects of a domain from an Android device. The app is pretty simple, doing this one job. I might add a few minor features in the future.

Project Code

The code is available on GitHub.

GitHub repository: https://github.com/revnoah/DomainLookup