IP address by Domain Name

0 votes

I am trying to get IP address of a domain.. i am using following code

>> import socket
>> socket.gethostbyname('www.google.com')

its giving me following error..

Traceback (most recent call last):
  File "<pyshell#18>", line 1, in <module>
    socket.gethostbyname('www.google.com')
gaierror: [Errno 11001] getaddrinfo failed


What is wrong with my code...is there any method in Python to acquire an IP address from a domain name?
Feb 23, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
509 views

1 answer to this question.

0 votes

The code you provided is accurate. Perhaps you have a firewall between you and these servers that is preventing the request from being sent?

Hope this will help!

For more, enroll in Cyber security masters program today.

Thank you!

answered Feb 24, 2022 by Edureka
• 12,690 points

Related Questions In Cyber Security & Ethical Hacking

0 votes
0 answers

find IP address by domain in go

I am using below code for an ...READ MORE

Feb 16, 2022 in Cyber Security & Ethical Hacking by Edureka
• 12,690 points
1,202 views
+1 vote
1 answer

How to find IP address of nodes in my network?

The IP address of the nodes connected ...READ MORE

answered Feb 9, 2019 in Cyber Security & Ethical Hacking by Omkar
• 69,220 points
4,921 views
0 votes
1 answer

How to find MAC address using IP address?

To find the MAC address, run this ...READ MORE

answered Feb 9, 2019 in Cyber Security & Ethical Hacking by Omkar
• 69,220 points
2,339 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
0 votes
1 answer

Current.Request.Url give my computer IP address not domain name

Your application likely has a load balancer ...READ MORE

answered Nov 7, 2022 in Cyber Security & Ethical Hacking by Edureka
• 12,690 points
1,511 views
0 votes
1 answer

Can I determine the current IP from a known MAC Address?

ARP may be used to retrieve an ...READ MORE

answered Feb 20, 2022 in Cyber Security & Ethical Hacking by Edureka
• 12,690 points
623 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP