Python Forum
How would I find the url name from a ip address
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How would I find the url name from a ip address
#1
What I would like to do is enter a ip address like 216.40.47.17 and get the name of the website.
I know I am going have to go through a dns server, I am not sure how to do that.
Maybe some one can help some.

Thank you
Renny
Reply
#2
import socket

url = "216.40.47.17"
print(socket.gethostbyaddr(url))
Reply
#3
Hi Axel,
I am working on the dark website.
here is my script

import requests
from bs4 import BeautifulSoup


session = requests.session()
r = session.get('http://darkzzx4avcsuofgfez5zq75cqc4mprjvfqywo45dfcaxrwqg6qrlfid.onion/')
session = requests.session()
session.proxies ={}
session.proxies['http'] = 'socks5h://127.0.0.1:9150'
session.proxies['https'] = 'socks5h://127.0.0.1:9150'

print(r.headers)



import socket

r= input("Enter Website name  ")
try:
    print("Ip address of " + r + (" is ") + socket.gethostbyname(r))
except socket.error as e:
    print("Error : {} ".format(e))
here is what happen. it can not find the site address:

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
= RESTART: C:\Users\Renny\Desktop\dark_web_scraping and hacking\Python_Scripts\python scripts\scrap_dark_2.py
{'Date': 'Fri, 08 Oct 2021 16:30:27 GMT', 'Content-Length': '0', 'Connection': 'close'}
Enter Website name  http://darkzzx4avcsuofgfez5zq75cqc4mprjvfqywo45dfcaxrwqg6qrlfid.onion/
Error : [Errno 11001] getaddrinfo failed 
>>> 
What do I need to do to get the ip address of the dark website? Cry
Reply
#4
The site http://darkzzx4avcsuofgfez5zq75cqc4mprjv...fid.onion/ does not exist.
Reply
#5
I know this site is working and I still get the same error

here is the proof
Enter Website name  http://garlic7ravilyupx.onion/
<Response [200]>

{'X-Correlation-Id': 'aaaaaaaa', 'Date': 'Wed, 13 Oct 2021 20:10:56 GMT', 'Content-Length': '0', 'Connection': 'close'}


be low this is socket out put
enter the host name garlic7ravilyupx.onion/
Error : ()

I get the error
Enter Website name  http://cnn.com
<Response [200]>

{'Connection': 'keep-alive', 'Content-Length': '153272', 'Content-Type': 'text/html; charset=utf-8', 'x-servedByHost': '::ffff:127.0.0.1', 'access-control-allow-origin': '*', 'cache-control': 'max-age=60', 'content-security-policy': "default-src 'self' blob: https://*.cnn.com:* http://*.cnn.com:* *.cnn.io:* *.cnn.net:* *.turner.com:* *.turner.io:* *.ugdturner.com:* courageousstudio.com *.vgtf.net:*; script-src 'unsafe-eval' 'unsafe-inline' 'self' *; style-src 'unsafe-inline' 'self' blob: *; child-src 'self' blob: *; frame-src 'self' *; object-src 'self' *; img-src 'self' data: blob: *; media-src 'self' data: blob: *; font-src 'self' data: *; connect-src 'self' data: *; frame-ancestors 'self' https://*.cnn.com:* http://*.cnn.com:* https://*.cnn.io:* http://*.cnn.io:* *.turner.com:* https://www.google.com https://news.google.com https://www.google.co.uk https://amp-cnn-com.cdn.ampproject.org courageousstudio.com;", 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'Content-Encoding': 'gzip', 'Via': '1.1 varnish, 1.1 varnish', 'Accept-Ranges': 'bytes', 'Date': 'Wed, 13 Oct 2021 20:11:42 GMT', 'Age': '427', 'Set-Cookie': 'countryCode=US; Domain=.cnn.com; Path=/; SameSite=None; Secure, stateCode=MI; Domain=.cnn.com; Path=/; SameSite=None; Secure, geoData=coloma|MI|49038|US|NA|-400|broadband|42.200|-86.330; Domain=.cnn.com; Path=/; SameSite=None; Secure, FastAB=0=0991,1=9094,2=9471,3=3214,4=5582,5=4575,6=8681,7=5562,8=5853,9=2883; Domain=.cnn.com; Path=/; Expires=Sat Jul 01 2023 00:00:00 GMT; SameSite=Lax', 'X-Served-By': 'cache-dca12920-DCA, cache-cmh21529-CMH', 'X-Cache': 'HIT, HIT', 'X-Cache-Hits': '1, 6', 'X-Timer': 'S1634155903.929341,VS0,VE1', 'Vary': ', Accept-Encoding'}


be low this is socket out put
enter the host name cnn.com
ip Address of   cnn.com  Is  151.101.1.67
>>> 
Not a tor address it works fine.
Do you know why it can not return a tor ip address
Reply
#6
(Oct-13-2021, 08:13 PM)Blue Dog Wrote: Do you know why it can not return a tor ip address
Tor(onion) websites does not have IP addresses directly,
sites are identified by onion addresses,which is a fake DNS service that is implemented by the TOR network.
The point of hiding of IP address is for privacy,so identification of users can not be linked to a IP address.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020