WHOIS Domain Lookup Tool in Python

NeuralNine · Beginner ·💻 AI-Assisted Coding ·3y ago

Key Takeaways

This video demonstrates how to build a simple WHOIS tool in Python for looking up domains and IP addresses using the python-whois package.

Full Transcript

what is going on guys welcome back in this little video today we're going to learn how to build a simple who is tool in Python so let us get right into it [Music] all right so let us get started with the very Basics first a who is query is essentially used to figure out who owns an IP address or who owns a domain so if you see a website you want to know who is behind that website you can just send a simple who is Quarry for the domain or 40 IP address to get some information about the owner and maybe you want to do this on a large scale maybe you have multiple domains multiple IP addresses that you want to gather information from and you want to do some data analysis or maybe you just want to do this on a regular basis frequently so it makes sense to automate the process and this is what we're going to learn how to do in this video we're going to learn how to automate who is we're going to build a simple who is Bond so just a script that gathers information about domains and IP addresses and for that we're going to open up the command line first and we're going to say pip install the package python Dash who is like this and once it's installed we're going to import just who is so we don't import python who is we import who is and in order to now get information about a domain or IP address all we need to do uh is we need to say rest equals response equals who is dot who is and then for example spotify.com then of course we also want to print the result and when I now run this you can see that we get a dictionary object with some information here so for example the domain name itself where the domain was registered uh the updated dates the creation date the expiration date um some name servers some stuff that you might be interested in I think you also get in some cases in this case not the city the address you can also see the organization and of course you can use that object to print individual uh Fields so you can say for example give me everything or you can say give me the organization give me the creation date creation underscore date and you will get the individual values here as well so this is one thing that you can do you can just get a domain name and you can get the individual fields and maybe you can gather them for multiple domains so what you could do in a data science context is you could have something like a sites list you can say okay I'm interested in uh I don't know some dates prediction or some some mean of the expiration date or I don't know what you want to do you want to get some information from multiple domains like facebook.com spotify.com instagram.com meta.com something like that you have many many many domains here let's say a thousand and you want to do something with them so you want to say for example I want to know all the companies Behind These websites so I can say companies equals and I can use a list comprehension to say who is dot who is of the site and from that I want to get the organization 4S in science so a use case could be I have a thousand uh or the Thousand most popular domains and I want to know um which companies own those domains and maybe a company occurs twice or three times so I would do that and then I would just print the companies like this see Meta platforms meta platforms already occur twice then we have Spotify Instagram um you can see that we get easily the organization of course I can do the same thing with the creation data and everything so I can say creation day to maybe figure out which one is the oldest right so I can say creation dates um so I can first of all just print that but then we can use that of course to filter some data so for example um there you go you can see here a daytime object what I can now do is I can say for example I want to have the first the first website here so the website that was created or the domain that was created uh the earliest so I can say print sites uh which sides the site that has the index or the index of the site um where the creation date is the smallest so I get the minimal uh the minimum creation date I get the index where it occurs in the creation dates list and I get the same index for the sites and then I can see which of those websites is the oldest in this case it's meta.com now doesn't mean necessarily that Facebook owns meta.com for that long it just means that the domain exists for that long so this is a different a difference here and one thing that you might also want to do I'm just showing you some use cases here because this video is quite beginner friendly we're just going here through some very very basic stuff but one thing that you might want to do here is also you might want to gather contact information so um maybe you want to find emails of certain websites uh of certain management teams or of certain support mails or something and maybe we have a website like whatsapp.com here as well I may want to do something like emails is equal to who is done who is s dot emails which is a list so not just one email 4S in science and then we can print emails and not every company has a lot of emails listed so for example um I mean actually those are just domain specific as far as I understand so you can't really get uh maybe I was wrong about this you can't really get support emails here most of the time I think you have some control over the emails that you put there so maybe you can actually also have a contact mail there but usually those are for abuse and for domain specific questions but you can still gather emails for for certain use cases uh with that approach now one thing I want to show you here is first of all that we can do that on IP addresses and second of all that not always do you get information about the real owner of the website so if I print for example who is dot who is and then I enter the IP address 81.19159.28 and let's just remove all of this here if I just print that you can see some information here but you can also see that uh you don't really understand who owns that so you can see okay the domain name is worldforyou.com and you can see that word for you owns that website but this is actually the IP address of uh neural nine so this is actually my IP address and you don't really see my information here so you can see okay it's Austria but you don't really see anything about me so you wouldn't see that the owner is me or you also don't see that the owner is neural nine my company so you just see that world for you is hosting that um which is also nice to know that you don't actually always get 100 the owner but maybe just the hosting provider so that's it for today's video I hope you enjoyed it and hope you learned something if so let me know by hitting the like button and leaving a comment in the comment section down below and of course don't forget to subscribe to this Channel and hit the notification Bell to not miss a single future video for free other than that thank you much for watching see you next video and bye foreign foreign [Music]

Original Description

In this video, we learn how to build a simple WHOIS tool in Python for looking up domains. ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾ 📚 Programming Books & Merch 📚 🐍 The Python Bible Book: https://www.neuralnine.com/books/ 💻 The Algorithm Bible Book: https://www.neuralnine.com/books/ 👕 Programming Merch: https://www.neuralnine.com/shop 🌐 Social Media & Contact 🌐 📱 Website: https://www.neuralnine.com/ 📷 Instagram: https://www.instagram.com/neuralnine 🐦 Twitter: https://twitter.com/neuralnine 🤵 LinkedIn: https://www.linkedin.com/company/neuralnine/ 📁 GitHub: https://github.com/NeuralNine 🎙 Discord: https://discord.gg/JU4xr8U3dm 🎵 Outro Music From: https://www.bensound.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from NeuralNine · NeuralNine · 0 of 60

← Previous Next →
1 Visualizing Stock Data With Candlestick Charts in Python
Visualizing Stock Data With Candlestick Charts in Python
NeuralNine
2 Python Beginner Tutorial #1 - Installation and First Program
Python Beginner Tutorial #1 - Installation and First Program
NeuralNine
3 Python Beginner Tutorial #2 - Variables and Data Types
Python Beginner Tutorial #2 - Variables and Data Types
NeuralNine
4 Python Beginner Tutorial #3 - Operators and User Input
Python Beginner Tutorial #3 - Operators and User Input
NeuralNine
5 Python Beginner Tutorial #4 - If Statements and Conditions
Python Beginner Tutorial #4 - If Statements and Conditions
NeuralNine
6 Python Beginner Tutorial #5 - Loops
Python Beginner Tutorial #5 - Loops
NeuralNine
7 Python Beginner Tutorial #6 - Sequences and Collections
Python Beginner Tutorial #6 - Sequences and Collections
NeuralNine
8 Python Beginner Tutorial #7 - Functions
Python Beginner Tutorial #7 - Functions
NeuralNine
9 Python Beginner Tutorial #8 - Exception Handling
Python Beginner Tutorial #8 - Exception Handling
NeuralNine
10 Python Beginner Tutorial #9 - File Operations
Python Beginner Tutorial #9 - File Operations
NeuralNine
11 Python Beginner Tutorial #10 - String Functions
Python Beginner Tutorial #10 - String Functions
NeuralNine
12 Python Intermediate Tutorial #1 - Classes and Objects
Python Intermediate Tutorial #1 - Classes and Objects
NeuralNine
13 Python Intermediate Tutorial #2 - Inheritance
Python Intermediate Tutorial #2 - Inheritance
NeuralNine
14 Python Intermediate Tutorial #3 - Multithreading
Python Intermediate Tutorial #3 - Multithreading
NeuralNine
15 Python Intermediate Tutorial #4 - Synchronizing Threads
Python Intermediate Tutorial #4 - Synchronizing Threads
NeuralNine
16 Python Intermediate Tutorial #5 - Events and Daemon Threads
Python Intermediate Tutorial #5 - Events and Daemon Threads
NeuralNine
17 Python Intermediate Tutorial #6 - Queues
Python Intermediate Tutorial #6 - Queues
NeuralNine
18 Python Intermediate Tutorial #7 - Sockets and Network Programming
Python Intermediate Tutorial #7 - Sockets and Network Programming
NeuralNine
19 Python Intermediate Tutorial #8 - Database Programming
Python Intermediate Tutorial #8 - Database Programming
NeuralNine
20 Python Intermediate Tutorial #9 - Recursion
Python Intermediate Tutorial #9 - Recursion
NeuralNine
21 Python Intermediate Tutorial #10 - XML Processing
Python Intermediate Tutorial #10 - XML Processing
NeuralNine
22 Python Intermediate Tutorial #11 - Logging
Python Intermediate Tutorial #11 - Logging
NeuralNine
23 Python Data Science Tutorial #1 - Anaconda and PyCharm Setup
Python Data Science Tutorial #1 - Anaconda and PyCharm Setup
NeuralNine
24 Python Data Science Tutorial #2 - NumPy Arrays
Python Data Science Tutorial #2 - NumPy Arrays
NeuralNine
25 Python Data Science Tutorial #3 - Numpy Functions
Python Data Science Tutorial #3 - Numpy Functions
NeuralNine
26 Python Data Science Tutorial #4 - Plotting Functions With Matplotlib
Python Data Science Tutorial #4 - Plotting Functions With Matplotlib
NeuralNine
27 Python Data Science Tutorial #5 - Subplots and Multiple Windows
Python Data Science Tutorial #5 - Subplots and Multiple Windows
NeuralNine
28 Python Data Science Tutorial #6 - Matplotlib Styling
Python Data Science Tutorial #6 - Matplotlib Styling
NeuralNine
29 Python Data Science Tutorial #7 - Bar Charts with Matplotlib
Python Data Science Tutorial #7 - Bar Charts with Matplotlib
NeuralNine
30 Python Data Science Tutorial #8 - Pie Charts with Matplotlib
Python Data Science Tutorial #8 - Pie Charts with Matplotlib
NeuralNine
31 Python Data Science Tutorial #9 - Plotting Histograms with Matplotlib
Python Data Science Tutorial #9 - Plotting Histograms with Matplotlib
NeuralNine
32 Python Data Science Tutorial #10 - Scatter Plots with Matplotlib
Python Data Science Tutorial #10 - Scatter Plots with Matplotlib
NeuralNine
33 Python Data Science Tutorial #11 - 3D Plotting with Matplotlib
Python Data Science Tutorial #11 - 3D Plotting with Matplotlib
NeuralNine
34 Python Data Science Tutorial #12 - Pandas Series
Python Data Science Tutorial #12 - Pandas Series
NeuralNine
35 Python Data Science Tutorial #13 - Pandas Data Frames
Python Data Science Tutorial #13 - Pandas Data Frames
NeuralNine
36 Python Data Science Tutorial #14 - Pandas Statistics
Python Data Science Tutorial #14 - Pandas Statistics
NeuralNine
37 Python Data Science Tutorial #15 - Pandas Sorting and Functions
Python Data Science Tutorial #15 - Pandas Sorting and Functions
NeuralNine
38 Python Data Science Tutorial #16 - Pandas Merging Data Frames
Python Data Science Tutorial #16 - Pandas Merging Data Frames
NeuralNine
39 Python Data Science Tutorial #17 - Pandas Queries
Python Data Science Tutorial #17 - Pandas Queries
NeuralNine
40 Python Machine Learning Tutorial #1 - What is Machine Learning?
Python Machine Learning Tutorial #1 - What is Machine Learning?
NeuralNine
41 Python Machine Learning Tutorial #2 - Linear Regression
Python Machine Learning Tutorial #2 - Linear Regression
NeuralNine
42 Python Machine Learning Tutorial #3 - K-Nearest Neighbors Classification
Python Machine Learning Tutorial #3 - K-Nearest Neighbors Classification
NeuralNine
43 Python Machine Learning #4 - Support Vector Machines
Python Machine Learning #4 - Support Vector Machines
NeuralNine
44 Python Machine Learning Tutorial #5 - Decision Trees and Random Forest Classification
Python Machine Learning Tutorial #5 - Decision Trees and Random Forest Classification
NeuralNine
45 Python Machine Learning Tutorial #6 - K-Means Clustering
Python Machine Learning Tutorial #6 - K-Means Clustering
NeuralNine
46 Python Machine Learning Tutorial #7 - Neural Networks
Python Machine Learning Tutorial #7 - Neural Networks
NeuralNine
47 Python Machine Learning Tutorial #8 - Handwritten Digit Recognition with Tensorflow
Python Machine Learning Tutorial #8 - Handwritten Digit Recognition with Tensorflow
NeuralNine
48 Generating Poetic Texts with Recurrent Neural Networks in Python
Generating Poetic Texts with Recurrent Neural Networks in Python
NeuralNine
49 Stock Portfolio Visualization with Matplotlib in Python
Stock Portfolio Visualization with Matplotlib in Python
NeuralNine
50 Analyzing Coronavirus with Python (COVID-19)
Analyzing Coronavirus with Python (COVID-19)
NeuralNine
51 Making Text Images Readable Again with Python and OpenCV
Making Text Images Readable Again with Python and OpenCV
NeuralNine
52 Neural Networks Simply Explained (Theory)
Neural Networks Simply Explained (Theory)
NeuralNine
53 Motion Filtering with OpenCV in Python
Motion Filtering with OpenCV in Python
NeuralNine
54 Top 5 Programming Languages To Learn in 2020
Top 5 Programming Languages To Learn in 2020
NeuralNine
55 Simple TCP Chat Room in Python
Simple TCP Chat Room in Python
NeuralNine
56 Image Classification with Neural Networks in Python
Image Classification with Neural Networks in Python
NeuralNine
57 Edge Detection with OpenCV in Python
Edge Detection with OpenCV in Python
NeuralNine
58 S&P 500 Web Scraping with Python
S&P 500 Web Scraping with Python
NeuralNine
59 Simple Sentiment Text Analysis in Python
Simple Sentiment Text Analysis in Python
NeuralNine
60 Introduction - Algorithms & Data Structures #1
Introduction - Algorithms & Data Structures #1
NeuralNine

This video teaches how to build a simple WHOIS tool in Python to look up domain and IP address information, and how to automate and analyze the data from these lookups.

Key Takeaways
  1. Install the python-whois package using pip
  2. Import the whois module in Python
  3. Use the whois function to query a domain or IP address
  4. Parse the response data to extract relevant information
  5. Use list comprehensions to gather data from multiple domains or IP addresses
💡 The python-whois package provides a simple way to automate WHOIS lookups in Python, but the data returned may not always include the actual owner of the domain or IP address.

Related Reads

📰
Indian AI coding startup Emergent becomes a unicorn with $130M Series C
Emergent, an AI coding startup, reaches unicorn status with $130M Series C funding, achieving $120 million annualized revenue run rate and 200,000 paying customers, demonstrating the growing demand for AI-powered coding solutions
TechCrunch AI
📰
Disposable software
Learn how the rise of AI-powered coding tools like Claude Code is changing the way we think about software development and maintenance
Seth Godin's Blog
📰
Join live event: Building With AI Without Creating Technical Debt
Learn how to build with AI without creating technical debt in a live event hosted by Software Mansion
Reddit r/learnprogramming
📰
I Built an AI Coding Cost Tracker to Finally See What Copilot and Cursor Are Actually Costing Me
Learn how to track the costs of AI coding assistants like Copilot and Cursor to optimize your workflow and budget
Dev.to AI
Up next
How to Create ONE PAGE Website using Claude AI (FREE & FAST)
Quick Tips - Web Desiign & Ai Tools
Watch →