uh hello guys uh welcome to this video
So in this video I will show you a
Python script which will actually show
you the actual IP address of a specific
domain name So it's
a socket programming I will show you the
simplest of example of creating a socket
and finding out the IP address of the
domain name that you will enter Let me
show you example that I'm talking about
So we have written this simple Python
script using the socket
module inside Python So right here we
are importing this uh website
freemediatools.com
www.freemediatools.com So here you can
replace any website This is my website
here I want to find out the IP address
So as soon as I execute this Python
script now it will create the socket it
will make the request and then it will
find out the IP address which is there
You can see it socket successfully
created and then it prints out this is
actually the IP address of this domain
name The socket has been successfully
connected to Google So this
is so in this easy way you can replace
it here Let's suppose I replace it here
Google So now it will find out the IP
address of Google So you can
see So now let me show you the actual
module here Uh it's built in You need
not have to install it Simply import
this So it comes within the default
installation of Python So you simply
import the socket module and then you
actually import the system
module which is also a built-in module
And now inside the try block we simply
use the socket module It contains the
socket function And here you specify
these two arguments here which is socket
AF
in
N sock uh and then we need to say
stream after writing this uh the socket
will be successfully created
So in this way if
the socket will be successfully created
and then we will be making a simple
request So we'll set the port number The
port number will be 80 by default And
then inside again this try
block we will make this simple request
to find out the IP address of the
specific domain name So here it contains
this function which is get host by
name So here you need to specify the
address So you simply
say you replace
the website URL address You specify it
and then it makes the request and then
stores it inside this host IP variable
So you can simply print
it So if I run this now you will see
that
uh on line number
9
19 So this is parentheses
So now you can see it is printed out
successfully the IP
address If I change this let's suppose
to any
other So in this easy way you can find
out the IP address of any domain Just
write this and it will print out the IP
address You can change to any domain
here Let's suppose I change it to
github.com So again it will print out
the IP address So this is a very simple
example of socket programming inside
Python It's a very simple example of
finding out the IP address of a specific
domain It has various other uses as well
but this was the very simplest of
example So thank you very much for
watching this video and also check out
my website freemediatools.com
uh which contains thousands of tools